fix aio-grab
[vuplus_openembedded] / recipes / aio-grab / aio-grab / aio-grab_vuplus.patch
1 --- aio-grab/main.c     2009-06-26 01:13:25.000000000 +0900
2 +++ aio-grab/main3.c    2010-02-02 09:19:06.000000000 +0900
3 @@ -85,8 +85,8 @@
4  void combine(unsigned char *output, unsigned char *video, unsigned char *osd, unsigned char *osd_alpha, int xres, int yres);
5  char* upcase(char* mixedstr);
6  
7 -enum {UNKNOWN,PALLAS,VULCAN,XILLEON,BRCM7401,BRCM4380};
8 -char *stb_name[]={"unknown","Pallas","Vulcan","Xilleon","Brcm7401","Brcm4380"};
9 +enum {UNKNOWN,PALLAS,VULCAN,XILLEON,BRCM7401,BRCM4380, VUPLUSDUO, VUPLUSSOLO};
10 +char *stb_name[]={"unknown","Pallas","Vulcan","Xilleon","Brcm7401","Brcm4380", "VuplusDuo", "VuplusSolo"};
11  int stb_type=UNKNOWN;
12  
13  // main program
14 @@ -123,12 +123,27 @@
15         pclose(pipe);
16         if (stb_type == BRCM7401) // Bcrm7401 + Bcrm4380 use the same framebuffer string, so fall back to /proc/cpuinfO for detecting DM8000
17         {
18 -               pipe=popen("cat /proc/cpuinfo","r");
19 -               while (fgets(buf,sizeof(buf),pipe))
20 +               pipe=popen("cat /proc/stb/info/version","r");
21 +               memset(buf, 0, sizeof(buf));
22 +               fgets(buf,4,pipe);
23 +
24 +               printf("%s\n", buf);
25 +
26 +               if(!strcmp(buf, "120"))
27 +                       stb_type=VUPLUSDUO;
28 +               else if(!strcmp(buf, "140"))
29 +                       stb_type=VUPLUSSOLO;                            
30 +               pclose(pipe);
31 +
32 +               if(stb_type == UNKNOWN)
33                 {
34 -                       if (strstr(upcase(buf),"BRCM4380")) {stb_type=BRCM4380;}
35 +                       pipe=popen("cat /proc/cpuinfo","r");
36 +                       while (fgets(buf,sizeof(buf),pipe))
37 +                       {
38 +                               if (strstr(upcase(buf),"BRCM4380")) {stb_type=BRCM4380;}
39 +                       }
40 +                       pclose(pipe);
41                 }
42 -               pclose(pipe);
43         }
44         if (stb_type == UNKNOWN)
45         {
46 @@ -439,6 +454,21 @@
47  {
48         printf("Grabbing Video ...\n");
49         
50 +       if(stb_type == VUPLUSSOLO || stb_type == VUPLUSDUO)
51 +       {
52 +               
53 +               int fd_video = open("/dev/dvb/adapter0/video0", O_RDONLY);
54 +               if (fd_video < 0)
55 +               {
56 +                       printf("could not open video device");
57 +                       return;
58 +               }        
59 +               
60 +               int r = read(fd_video, video, 1920 * 1080 * 3 );
61 +               *xres = 1920;
62 +               *yres = 1080;
63 +               return;
64 +       }
65         int mem_fd;
66         //unsigned char *memory;
67         void *memory;