tuxbox-tuxcom-32bpp.bb: fixed build, cleanup bb file
[opendreambox.git] / meta-opendreambox / recipes-dreambox / tuxcom / tuxbox-tuxcom-32bpp / add_advanced_rc.diff
1 --- tuxcom/tuxcom.c     2006-06-29 23:44:21.000000000 +0200
2 +++ tuxcom/tuxcom.c     2008-10-22 22:34:16.000000000 +0200
3 @@ -36,7 +36,8 @@
4         struct input_event ev;
5         static __u16 rc_last_key = KEY_RESERVED;
6         static __u16 rc_last_code = KEY_RESERVED;
7 -       if(read(rc, &ev, sizeof(ev)) == sizeof(ev))
8 +       if ((read(rc[0], &ev, sizeof(ev)) == sizeof(ev)) ||
9 +           (rc[1] != -1 && read(rc[1], &ev, sizeof(ev)) == sizeof(ev)))
10         {
11                 if(ev.value)
12                 {
13 @@ -465,15 +466,16 @@
14  
15         //get params
16  
17 -
18 -       kb = fb = rc = sx = ex = sy = ey = -1;
19 +       kb = fb = sx = ex = sy = ey = -1;
20  
21         /* open Framebuffer */
22         fb=open("/dev/fb0", O_RDWR);
23  
24         /* open Remote Control */
25 -       int cnt=0;
26 -       while(1)
27 +       int cnt=0, rc_num=0;
28 +       rc[0]=rc[1]=-1;
29 +
30 +       while(rc_num < 2)
31         {
32                 struct stat s;
33                 char tmp[128];
34 @@ -481,20 +484,20 @@
35                 if (stat(tmp, &s))
36                         break;
37                 /* open Remote Control */
38 -               if ((rc=open(tmp, O_RDONLY)) == -1)
39 +               if ((rc[rc_num]=open(tmp, O_RDONLY | O_EXCL | O_NONBLOCK)) == -1)
40                 {
41                         perror("TuxCom <open remote control>");
42                         return 0;
43                 }
44 -               if (ioctl(rc, EVIOCGNAME(128), tmp) < 0)
45 +               if (ioctl(rc[rc_num], EVIOCGNAME(128), tmp) < 0)
46                         perror("EVIOCGNAME failed");
47 -               if (strstr(tmp, "remote control"))
48 -                       break;
49 -               close(rc);
50 -               rc=-1;
51 +               if (!strstr(tmp, "remote control"))
52 +                       close(rc[rc_num]);
53 +               else
54 +                       ++rc_num;
55                 ++cnt;
56         }
57 -       fcntl(rc, F_SETFL, fcntl(rc, F_GETFL) | O_EXCL | O_NONBLOCK);
58 +//     fcntl(rc, F_SETFL, fcntl(rc, F_GETFL) | O_EXCL | O_NONBLOCK);
59  
60         /* open dream ir keyboard */
61         cnt=0;
62 @@ -1308,7 +1311,10 @@
63  //     close(saa);
64  
65  //     fcntl(rc, F_SETFL, O_NONBLOCK);
66 -       close(rc);
67 +       if (rc[0] != -1)
68 +                       close(rc[0]);
69 +       if (rc[1] != -1)
70 +                       close(rc[1]);
71         close(kb);
72  
73         ClearEntries   (LEFTFRAME );
74 --- tuxcom/tuxcom.h     2006-06-29 23:44:25.000000000 +0200
75 +++ tuxcom/tuxcom.h     2008-10-22 22:29:15.000000000 +0200
76 @@ -259,7 +259,7 @@
77  //some data
78  
79  int avs, saa, fnc_old, saa_old, screenmode;
80 -int rc, fb, kb;
81 +int rc[2], fb, kb;
82  int sx, ex, sy, ey;
83  int PosX, PosY, StartX, StartY, FrameWidth, NameWidth, SizeWidth;
84  int curframe, cursort, curvisibility;