meta-opendreambox: stop using PR
[opendreambox.git] / meta-opendreambox / recipes-dreambox / tuxtxt / tuxbox-tuxtxt-32bpp / 32bpp.diff
1 diff -u tuxtxt_orig/tuxtxt.c tuxtxt/tuxtxt.c
2 --- tuxtxt_orig/tuxtxt.c        2009-01-29 21:36:31.000000000 +0100
3 +++ tuxtxt/tuxtxt.c     2009-01-29 21:38:42.000000000 +0100
4 @@ -7,12 +7,43 @@
5   *                       and DBLuelle <dbluelle@blau-weissoedingen.de>        *
6   *     russian and arabic support by Leonid Protasov <Lprot@mail.ru>         *
7   *                                                                            *
8 + *              ported 2006 to Dreambox 7025 / 32Bit framebuffer              *
9 + *                   by Seddi <seddi@i-have-a-dreambox.com>                   *
10 + *                                                                            *
11 + *              ported 32Bit framebuffer to Tuxtxt v1.99 (2008)               *
12 + *                      by the PLi team (Sat-Turner)                          *
13 + *                                                                            *
14 + *              ported to 20090130                                            *
15 + *                      by the PLi team (pieterg)                             *
16 + *                                                                            *
17   ******************************************************************************/
18  
19  
20  
21  #include "tuxtxt.h"
22  
23 +static char saved_wss[32];
24 +static char saved_pin8[32];
25 +
26 +void readproc(const char* source, char *dest)
27 +{
28 +       FILE *f=fopen(source, "rt");
29 +       if(f)
30 +       {
31 +               fgets(dest, 255, f);
32 +               fclose(f);
33 +       }
34 +}
35 +
36 +void writeproc(const char* dest, const char *value)
37 +{
38 +       FILE *f=fopen(dest, "w");
39 +       if (f)
40 +       {
41 +               fwrite(value, strlen(value), 1, f);
42 +               fclose(f);
43 +       }
44 +}
45  
46  int getIndexOfPageInHotlist()
47  {
48 @@ -137,10 +168,11 @@
49   * plugin_exec                                                                *
50   ******************************************************************************/
51  
52 -void plugin_exec(PluginParam *par)
53 +int main(int argc, char **argv)
54  {
55         char cvs_revision[] = "$Revision: 1.108 $";
56  
57 +       int cnt=0;
58  #if !TUXTXT_CFG_STANDALONE
59         int initialized = tuxtxt_init();
60         if ( initialized )
61 @@ -150,31 +182,71 @@
62         /* show versioninfo */
63         sscanf(cvs_revision, "%*s %s", versioninfo);
64         printf("TuxTxt %s\n", versioninfo);
65 +       printf("for 32bpp framebuffer\n");
66  
67         tuxtxt_SetRenderingDefaults(&renderinfo);
68         /* get params */
69         tuxtxt_cache.vtxtpid = renderinfo.fb = lcd = rc = renderinfo.sx = renderinfo.ex = renderinfo.sy = renderinfo.ey = -1;
70 +       if (argc==1)
71 +       {
72 +               printf("\nUSAGE: tuxtxt vtpid\n");
73 +               printf("No PID given, so scanning for PIDs ...\n\n");
74 +               tuxtxt_cache.vtxtpid=0;
75 +       }
76 +       else 
77 +       {
78 +               tuxtxt_cache.vtxtpid = atoi(argv[1]);
79 +       }
80 +
81 +       /* open Framebuffer */
82 +       if ((renderinfo.fb=open("/dev/fb0", O_RDWR)) == -1)
83 +       {
84 +               perror("TuxTxt <open /dev/fb0>");
85 +               return 0;
86 +       }
87 +       rc=-1;
88 +       while(1)
89 +       {
90 +               struct stat s;
91 +               char tmp[128];
92 +               sprintf(tmp, "/dev/input/event%d", cnt);
93 +               if (stat(tmp, &s))
94 +                       break;
95 +               /* open Remote Control */
96 +               if ((rc=open(tmp, O_RDONLY)) == -1)
97 +               {
98 +                       perror("TuxTxt <open remote control>");
99 +                       return 0;
100 +               }
101 +               if (ioctl(rc, EVIOCGNAME(128), tmp) < 0)
102 +                       perror("EVIOCGNAME failed");
103 +               if (strstr(tmp, "remote control"))
104 +                       break;
105 +               close(rc);
106 +               rc=-1;
107 +               ++cnt;
108 +       }
109 +
110 +       if (rc == -1)
111 +       {
112 +               printf("couldnt find correct input device!!!\n");
113 +               return -1;
114 +       }
115  
116 -       for (; par; par = par->next)
117 +       /* open LCD  */
118 +       if ((lcd=open("/dev/dbox/lcd0", O_RDWR)) == -1)
119         {
120 -               if (!strcmp(par->id, P_ID_VTXTPID))
121 -                       tuxtxt_cache.vtxtpid = atoi(par->val);
122 -               else if (!strcmp(par->id, P_ID_FBUFFER))
123 -                       renderinfo.fb = atoi(par->val);
124 -               else if (!strcmp(par->id, P_ID_LCD))
125 -                       lcd = atoi(par->val);
126 -               else if (!strcmp(par->id, P_ID_RCINPUT))
127 -                       rc = atoi(par->val);
128 -               else if (!strcmp(par->id, P_ID_OFF_X))
129 -                       renderinfo.sx = atoi(par->val);
130 -               else if (!strcmp(par->id, P_ID_END_X))
131 -                       renderinfo.ex = atoi(par->val);
132 -               else if (!strcmp(par->id, P_ID_OFF_Y))
133 -                       renderinfo.sy = atoi(par->val);
134 -               else if (!strcmp(par->id, P_ID_END_Y))
135 -                       renderinfo.ey = atoi(par->val);
136 +               perror("TuxTxt <open /dev/dbox/lcd0>");
137 +               return 0;
138         }
139  
140 +       renderinfo.previousbackcolor = tuxtxt_color_transp;
141 +       renderinfo.zoommode = 0;
142 +       renderinfo.sx = 80;
143 +       renderinfo.ex = 620;
144 +       renderinfo.sy = 30;
145 +       renderinfo.ey = 555;
146 +
147         if (tuxtxt_cache.vtxtpid == -1 || renderinfo.fb == -1 || rc == -1 || renderinfo.sx == -1 || renderinfo.ex == -1 || renderinfo.sy == -1 || renderinfo.ey == -1)
148         {
149                 printf("TuxTxt <Invalid Param(s)>\n");
150 @@ -242,6 +314,7 @@
151                                         int vendor = 3; /* values unknown, rely on requested values */
152  #endif
153  
154 +#if 0
155                                         if (vendor < 3) /* scart-parameters only known for 3 dboxes, FIXME: order must be like in info.h */
156                                         {
157                                                 for (i = 0; i < 6; i++) /* FIXME: FBLK seems to cause troubles */
158 @@ -274,6 +347,7 @@
159                                                                 perror("TuxTxt <ioctl(avs)>");
160                                                 }
161                                         }
162 +#endif
163                                         continue; /* otherwise ignore exit key */
164                                 }
165                                 default:
166 @@ -487,6 +561,14 @@
167                                 dumpl25 = ival & 1;
168                         else if (1 == sscanf(line, "UseTTF %i", &ival))
169                                 renderinfo.usettf = ival & 1;
170 +                       else if (1 == sscanf(line, "StartX %i", &ival))
171 +                               renderinfo.sx = ival;
172 +                       else if (1 == sscanf(line, "EndX %i", &ival))
173 +                               renderinfo.ex = ival;
174 +                       else if (1 == sscanf(line, "StartY %i", &ival))
175 +                               renderinfo.sy = ival;
176 +                       else if (1 == sscanf(line, "EndY %i", &ival))
177 +                               renderinfo.ey = ival;
178                 }
179                 fclose(conf);
180         }
181 @@ -534,6 +616,12 @@
182  #endif
183  
184  
185 +       readproc("/proc/stb/denc/0/wss", saved_wss);
186 +       writeproc("/proc/stb/denc/0/wss", saamodes[renderinfo.screen_mode1]);
187 +
188 +       readproc("/proc/stb/avs/0/sb", saved_pin8);
189 +       writeproc("/proc/stb/avs/0/sb", fncmodes[renderinfo.screen_mode1]);
190 +
191         /* setup rc */
192         ioctl(rc, RC_IOCTL_BCODES, 1);
193  
194 @@ -568,8 +656,6 @@
195         if (tuxtxt_cache.dmx != -1)
196             close(tuxtxt_cache.dmx);
197         tuxtxt_cache.dmx = -1;
198 -#else
199 -       tuxtxt_stop();
200  #endif
201  
202         if (restoreaudio)
203 @@ -579,6 +665,7 @@
204  #else
205                 int vendor = 3; /* values unknown, rely on requested values */
206  #endif
207 +#if 0
208                 if (vendor < 3) /* scart-parameters only known for 3 dboxes, FIXME: order must be like in info.h */
209                 {
210                         for (i = 1; i < 6; i += 2) /* restore dvb audio */
211 @@ -588,9 +675,17 @@
212                                         perror("TuxTxt <ioctl(avs)>");
213                         }
214                 }
215 +#endif
216         }
217  
218 +       /* close lcd */
219 +       close(lcd);
220 +       
221 +       /* close rc */
222 +       close(rc);
223  
224 +       lcd = rc = -1;
225
226         if (hotlistchanged)
227                 savehotlist();
228  
229 @@ -623,10 +718,20 @@
230                         fprintf(conf, "ShowLevel2p5 %d\n", renderinfo.showl25);
231                         fprintf(conf, "DumpLevel2p5 %d\n", dumpl25);
232                         fprintf(conf, "UseTTF %d\n", renderinfo.usettf);
233 +                       fprintf(conf, "StartX %d\n", renderinfo.sx);
234 +                       fprintf(conf, "EndX %d\n", renderinfo.ex);
235 +                       fprintf(conf, "StartY %d\n", renderinfo.sy);
236 +                       fprintf(conf, "EndY %d\n", renderinfo.ey);
237                         fclose(conf);
238                 }
239         }
240         tuxtxt_EndRendering(&renderinfo);
241 +
242 +       /* close framebuffer */
243 +       close(renderinfo.fb);
244 +
245 +       writeproc("/proc/stb/avs/0/sb", saved_pin8);
246 +       writeproc("/proc/stb/denc/0/wss", saved_wss);
247  }
248  /******************************************************************************
249   * GetTeletextPIDs                                                           *
250 @@ -1308,6 +1413,7 @@
251                                         memset(&menu[Menu_Width*MenuLine[M_COL] + 3+renderinfo.color_mode  ], 0x20,24-renderinfo.color_mode);
252                                         Menu_HighlightLine(menu, MenuLine[menuitem], 1);
253                                         tuxtxt_setcolors(&renderinfo,(unsigned short *)tuxtxt_defaultcolors, 0, tuxtxt_color_SIZECOLTABLE);
254 +                                       Menu_Init(menu, current_pid, menuitem, hotindex);
255                                         break;
256                                 case M_TRA:
257                                         saveconfig = 1;
258 @@ -1319,6 +1425,7 @@
259                                         memset(&menu[Menu_Width*MenuLine[M_TRA] + 3+renderinfo.trans_mode  ], 0x20,24-renderinfo.trans_mode);
260                                         Menu_HighlightLine(menu, MenuLine[menuitem], 1);
261                                         tuxtxt_setcolors(&renderinfo,(unsigned short *)tuxtxt_defaultcolors, 0, tuxtxt_color_SIZECOLTABLE);
262 +                                       Menu_Init(menu, current_pid, menuitem, hotindex);
263                                         break;
264                                 case M_PID:
265                                 {
266 @@ -1421,6 +1528,7 @@
267                                         memset(&menu[Menu_Width*MenuLine[M_COL] + 3+renderinfo.color_mode  ], 0x20,24-renderinfo.color_mode);
268                                         Menu_HighlightLine(menu, MenuLine[menuitem], 1);
269                                         tuxtxt_setcolors(&renderinfo,(unsigned short *)tuxtxt_defaultcolors, 0, tuxtxt_color_SIZECOLTABLE);
270 +                                       Menu_Init(menu, current_pid, menuitem, hotindex);
271                                         break;
272                                 case M_TRA:
273                                         saveconfig = 1;
274 @@ -1432,6 +1540,7 @@
275                                         memset(&menu[Menu_Width*MenuLine[M_TRA] + 3+renderinfo.trans_mode  ], 0x20,24-renderinfo.trans_mode);
276                                         Menu_HighlightLine(menu, MenuLine[menuitem], 1);
277                                         tuxtxt_setcolors(&renderinfo,(unsigned short *)tuxtxt_defaultcolors, 0, tuxtxt_color_SIZECOLTABLE);
278 +                                       Menu_Init(menu, current_pid, menuitem, hotindex);
279                                         break;
280                                 case M_PID:
281                                         if (!getpidsdone)
282 @@ -1731,8 +1840,8 @@
283                                         memcpy(&menu[Menu_Width*MenuLine[M_SC1] + Menu_Width - 5], &configonoff[menulanguage][renderinfo.screen_mode1  ? 3 : 0], 3);
284                                         Menu_HighlightLine(menu, MenuLine[menuitem], 1);
285  
286 -                                       ioctl(renderinfo.avs, AVSIOSSCARTPIN8, &fncmodes[renderinfo.screen_mode1]);
287 -                                       ioctl(renderinfo.saa, SAAIOSWSS, &saamodes[renderinfo.screen_mode1]);
288 +                                       writeproc("/proc/stb/avs/0/sb", fncmodes[renderinfo.screen_mode1]);
289 +                                       writeproc("/proc/stb/denc/0/wss", saamodes[renderinfo.screen_mode1]);
290  
291                                         break;
292  
293 @@ -1857,7 +1966,8 @@
294         }
295  
296         /* generate pagenumber */
297 -       temp_page |= Number << renderinfo.inputcounter*4;
298 +       if (renderinfo.inputcounter >= 0)
299 +               temp_page |= Number << renderinfo.inputcounter*4;
300  
301         renderinfo.inputcounter--;
302  
303 @@ -2318,8 +2428,8 @@
304         else if (renderinfo.transpmode == 1) /* semi-transparent BG with FG text */
305         {
306                 /* restore videoformat */
307 -               ioctl(renderinfo.avs, AVSIOSSCARTPIN8, &renderinfo.fnc_old);
308 -               ioctl(renderinfo.saa, SAAIOSWSS, &renderinfo.saa_old);
309 +               writeproc("/proc/stb/avs/0/sb", saved_pin8);
310 +               writeproc("/proc/stb/denc/0/wss", saved_wss);
311  
312                 tuxtxt_ClearBB(&renderinfo,tuxtxt_color_transp);
313                 tuxtxt_cache.pageupdate = 1;
314 @@ -2327,8 +2437,8 @@
315         else /* TV mode */
316         {
317                 /* restore videoformat */
318 -               ioctl(renderinfo.avs, AVSIOSSCARTPIN8, &renderinfo.fnc_old);
319 -               ioctl(renderinfo.saa, SAAIOSWSS, &renderinfo.saa_old);
320 +               writeproc("/proc/stb/avs/0/sb", saved_pin8);
321 +               writeproc("/proc/stb/denc/0/wss", saved_wss);
322  
323                 tuxtxt_ClearFB(&renderinfo,tuxtxt_color_transp);
324                 renderinfo.clearbbcolor = tuxtxt_cache.FullScrColor;
325 @@ -2765,8 +2875,8 @@
326                                 case KEY_VOLUMEDOWN:    RCCode = RC_MINUS;      break;
327                                 case KEY_MUTE:          RCCode = RC_MUTE;       break;
328                                 case KEY_HELP:          RCCode = RC_HELP;       break;
329 -                               case KEY_SETUP:         RCCode = RC_DBOX;       break;
330 -                               case KEY_HOME:          RCCode = RC_HOME;       break;
331 +                               case KEY_MENU:          RCCode = RC_DBOX;       break;
332 +                               case KEY_EXIT:          RCCode = RC_HOME;       break;
333                                 case KEY_POWER:         RCCode = RC_STANDBY;    break;
334                                 }
335                                 return 1;
336 @@ -2794,10 +2904,3 @@
337  
338         return 0;
339  }
340 -/* Local Variables: */
341 -/* indent-tabs-mode:t */
342 -/* tab-width:3 */
343 -/* c-basic-offset:3 */
344 -/* comment-column:0 */
345 -/* fill-column:120 */
346 -/* End: */
347 diff -u tuxtxt_orig/tuxtxt.h tuxtxt/tuxtxt.h
348 --- tuxtxt_orig/tuxtxt.h        2008-12-26 19:41:28.000000000 +0100
349 +++ tuxtxt/tuxtxt.h     2009-01-29 21:38:18.000000000 +0100
350 @@ -1,3 +1,6 @@
351 +#ifndef __tuxtxt_h__
352 +#define __tuxtxt_h__
353 +
354  /******************************************************************************
355   *                      <<< TuxTxt - Teletext Plugin >>>                      *
356   *                                                                            *
357 @@ -7,7 +10,16 @@
358   *                       and DBLuelle <dbluelle@blau-weissoedingen.de>        *
359   *     russian and arabic support by Leonid Protasov <Lprot@mail.ru>         *
360   *                                                                            *
361 - ******************************************************************************/
362 + *              ported 2006 to Dreambox 7025 / 32Bit framebuffer              *
363 + *                   by Seddi <seddi@i-have-a-dreambox.com>                   *
364 + *                                                                            *
365 + *              ported 32Bit framebuffer to Tuxtxt v1.99 (2008)               *
366 + *                      by the PLi team (Sat-Turner)                          *
367 + *                                                                            *
368 + *              ported to 1.106 (2008)                                        *
369 + *                      by the PLi team (pieterg)                             *
370 + *                                                                            *
371 +******************************************************************************/
372  
373  #define TUXTXT_CFG_STANDALONE 0  // 1:plugin only 0:use library
374  #define TUXTXT_DEBUG 0
375 @@ -37,7 +49,6 @@
376  #include <sys/mman.h>
377  
378  #include <dbox/fp.h>
379 -#include <plugin.h>
380  #include <dbox/lcd-ks0713.h>
381  
382  
383 @@ -1091,3 +1102,5 @@
384  /* comment-column:0 */
385  /* fill-column:120 */
386  /* End: */
387 +
388 +#endif