r5326 vince - /branches/vince/netsurf-fb/framebuffer/fb_init_linux.c

netsurf at semichrome.net netsurf at semichrome.net
Mon Sep 15 19:21:01 BST 2008


Author: vince
Date: Mon Sep 15 13:21:01 2008
New Revision: 5326

URL: http://source.netsurf-browser.org?rev=5326&view=rev
Log:
Improve linux mode setting

Modified:
    branches/vince/netsurf-fb/framebuffer/fb_init_linux.c

Modified: branches/vince/netsurf-fb/framebuffer/fb_init_linux.c
URL: http://source.netsurf-browser.org/branches/vince/netsurf-fb/framebuffer/fb_init_linux.c?rev=5326&r1=5325&r2=5326&view=diff
==============================================================================
--- branches/vince/netsurf-fb/framebuffer/fb_init_linux.c (original)
+++ branches/vince/netsurf-fb/framebuffer/fb_init_linux.c Mon Sep 15 13:21:01 2008
@@ -163,14 +163,14 @@
 }
 
 static int
-fb_setmode(char *name)
+fb_setmode(char *name, int bpp)
 {
         FILE *fp;
         char line[80],label[32],value[16];
         int  geometry=0, timings=0;
     
         /* load current values */
-        if (-1 == ioctl(fb,FBIOGET_VSCREENINFO,&fb_var)) {
+        if (ioctl(fb,FBIOGET_VSCREENINFO,&fb_var) == -1) {
                 perror("ioctl FBIOGET_VSCREENINFO");
                 exit(1);
         }
@@ -220,6 +220,10 @@
                         /* ok ? */
                         if (!geometry || !timings)
                                 return -1;
+
+                        if (bpp != 0)
+                                fb_var.bits_per_pixel = bpp;
+
                         /* set */
                         fb_var.xoffset = 0;
                         fb_var.yoffset = 0;
@@ -256,7 +260,7 @@
                 fprintf(stderr,"access %s: %s\n",vtname,strerror(errno));
                 exit(1);
         }
-        switch (fork()) {
+        /*        switch (fork()) {
         case 0:
                 break;
         case -1:
@@ -264,7 +268,7 @@
                 exit(1);
         default:
                 exit(0);
-        }
+                }
         close(tty);
         close(0);
         close(1);
@@ -273,7 +277,8 @@
         open(vtname,O_RDWR);
         dup(0);
         dup(0);
-
+*/
+        tty = open(vtname,O_RDWR);
         if (-1 == ioctl(tty,VT_GETSTATE, &vts)) {
                 perror("ioctl VT_GETSTATE");
                 exit(1);
@@ -310,7 +315,7 @@
 }
 
 int
-fb_init(char *device, char *mode, int vt)
+fb_init(char *device, char *mode, int bpp, int vt)
 {
         char   fbdev[16];
         struct vt_stat vts;
@@ -379,7 +384,7 @@
         tcgetattr(tty, &term);
     
         /* switch mode */
-        fb_setmode(mode);
+        fb_setmode(mode, bpp);
     
         /* checks & initialisation */
         if (-1 == ioctl(fb,FBIOGET_FSCREENINFO,&fb_fix)) {
@@ -492,8 +497,8 @@
 framebuffer_t *fb_os_init(int argc, char** argv)
 {
         framebuffer_t *newfb;
-int ploop;
-        fb_init("/dev/fb0", "800x600-70", 1);
+        int ploop;
+        fb_init("/dev/fb0", "800x600-70", 16, 1);
 
         newfb = calloc(1, sizeof(framebuffer_t));
 
@@ -517,6 +522,8 @@
         inputfd = open("/dev/input/event0", O_RDONLY);
         if (inputfd < 0) {
                 fprintf(stderr, "Unable to open /dev/input/event0 no keyboard\n");                
+        } else {
+                fcntl(0, F_SETFL, O_NONBLOCK);
         }
         return newfb;
 }




More information about the netsurf-commits mailing list