diff -r d1acc2a527af emu/Linux-fb/LICENSE--- /dev/null Thu Jan 01 00:00:00 1970 +0000+++ b/emu/Linux-fb/LICENSE Mon Oct 10 09:04:29 2011 +0300@@ -0,0 +1,26 @@+Copyright (c) 2005, 2006. 2008, 2011 Alexander Sychev. All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are+met:++ * Redistributions of source code must retain the above copyright+notice, this list of conditions and the following disclaimer.+ * Redistributions in binary form must reproduce the above+copyright notice, this list of conditions and the following disclaimer+in the documentation and/or other materials provided with the+distribution.+ * The name of authora may not be used to endorse or promote products derived from+this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.diff -r d1acc2a527af emu/Linux-fb/devapm.c--- /dev/null Thu Jan 01 00:00:00 1970 +0000+++ b/emu/Linux-fb/devapm.c Mon Oct 10 09:04:29 2011 +0300@@ -0,0 +1,231 @@+/******************************************************+*+* Adanced power management (APM) support for Inferno OS+*+* Author: Alexander Sychev <santucco@gmail.com>+*+*******************************************************/++#include "dat.h"+#include "fns.h"+#include "../port/error.h"++#include <unistd.h>+#include <linux/apm_bios.h>+#include "fb.h"+#include <stdio.h>++enum{+ Qdir,+ Qapm,+};++static+Dirtab apmtab[]={+ ".", {Qdir, 0, QTDIR}, 0, 0555, /* entry for "." must be first if devgen used */+ "apm", {Qapm, 0}, 0, 0666,+};+++static Lock apmlock;+static int apmfd = -1;+static Lock proclock;+static int procfd = -1;++int apm_dev_init()+{+ int result;+ lock(&apmlock);+ result = ((apmfd == -1) && ((apmfd = open("/dev/apm_bios", O_WRONLY)) < 0)) ? 1 : 0;+ unlock(&apmlock);+ if(apmfd == -1)+ fprint(2, "can't open /dev/apm_bios: %s\n", strerror(errno)); + return result;+}++int apm_proc_init()+{+ int result;+ lock(&proclock);+ result = ((procfd == -1) && ((procfd = open("/proc/apm", O_RDONLY))< 0)) ? 1 : 0;+ unlock(&proclock);+ if(procfd == -1)+ fprint(2, "can't open /proc/apm: %s\n", strerror(errno)); + return result;+}++int apm_dev_close()+{+ int result;+ lock(&apmlock);+ result = ((apmfd == -1) || close(apmfd)) ? 1 : 0;+ apmfd = -1;+ unlock(&apmlock);+ return result;+}++int apm_proc_close()+{+ int result;+ lock(&proclock);+ result = ((procfd == -1) || close(procfd)) ? 1 : 0;+ procfd = -1;+ unlock(&proclock);+ return result;+}+++void apm_suspend()+{+ int result;+ if(apm_dev_init())+ return;+ sync();+ lock(&apmlock);+ result = ioctl(apmfd, APM_IOC_SUSPEND, 0);+ unlock(&apmlock);+ if(result)+ error(Eio);+}++int apm_blank(int vesastt)+{+ int result;+ static int currvesastt = -1;++ if (currvesastt == vesastt)+ return 0; + lock(&apmlock);+ result = fb_blank(vesastt);+ unlock(&apmlock);+ if(result)+ error(Eio);+ else+ currvesastt = vesastt;+ return result;+}++static Chan*+apmattach(char* spec)+{+ if(apm_dev_init() || apm_proc_init())+ error(Enoattach);+ return devattach('S', spec);+}++static Walkqid*+apmwalk(Chan *c, Chan *nc, char **name, int nname)+{+ return devwalk(c, nc, name, nname, apmtab, nelem(apmtab), devgen);+}++static int+apmstat(Chan* c, uchar *db, int n)+{+ return devstat(c, db, n, apmtab, nelem(apmtab), devgen);+}++static Chan*+apmopen(Chan* c, int omode)+{+ apm_proc_init();+ return devopen(c, omode, apmtab, nelem(apmtab), devgen); +}++static void+apmclose(Chan* c)+{+ USED(c);+ apm_proc_close();+}++static long+apmread(Chan* c, void* a, long n, vlong offset)+{+ USED(offset);+ switch((ulong)c->qid.path) {+ case Qdir:+ return devdirread(c, a, n, apmtab, nelem(apmtab), devgen);+ case Qapm: {+ char buffer[100] = {0};+ char driver_version[10] = {0};+ int version_major = 0;+ int version_minor = 0;+ int flags = 0;+ int line_status = 0;+ int battery_status = 0;+ int battery_flags = 0;+ int battery_percentage = 0;+ int battery_time = 0;+ char units[10] = {0};+ if(read(procfd, buffer, sizeof(buffer)) < 0)+ error(Eio);+ sscanf(buffer, "%s %d.%d %x %x %x %x %d%% %d %s\n",+ driver_version,+ &version_major,+ &version_minor,+ &flags,+ &line_status,+ &battery_status,+ &battery_flags,+ &battery_percentage,+ &battery_time,+ units);+ int result = sprint(buffer, "%s %d%% %d min ", + ((battery_status) ? "online" : "offline"),+ (((battery_percentage >= 0) && (battery_percentage <= 100)) ? battery_percentage : 0),+ (strncmp(units, "min", sizeof("min")) ? (battery_time / 60) : battery_time));+ return readstr(offset, a, n, buffer);+ }+ default:+ n=0;+ break;+ }+ return n;+}+++static long+apmwrite(Chan* c, void* a, long n, vlong offset)+{+ char buffer[128] = {0};+ USED(a);+ USED(offset);+ switch((ulong)c->qid.path) {+ case Qapm:+ if(n > sizeof(buffer))+ n = sizeof(buffer)- 1;+ strncpy(buffer, a, n);+ if(strncmp(buffer, "suspend", sizeof("suspend")) == 0) {+ apm_suspend();+ return n;+ }else if(strncmp(buffer, "blank", sizeof("blank")) == 0) {+ apm_blank(FB_BLANK);+ return n;+ }+ error(Ebadctl);+ break;+ default:+ error(Ebadusefd);+ }+ return n;+}++Dev apmdevtab = { /* defaults in dev.c */+ 'S',+ "apm",++ devinit, /* devinit */+ apmattach,+ apmwalk,+ apmstat,+ apmopen,+ devcreate, /* devcreate */+ apmclose,+ apmread,+ devbread, /* devbread */+ apmwrite,+ devbwrite, /* devbwrite */+ devremove, /* devremove */+ devwstat, /* devwstat */+};diff -r d1acc2a527af emu/Linux-fb/emu-fb--- /dev/null Thu Jan 01 00:00:00 1970 +0000+++ b/emu/Linux-fb/emu-fb Mon Oct 10 09:04:29 2011 +0300@@ -0,0 +1,107 @@+dev+ root+ cons+ env+ mnt+ pipe+ prog+ prof+ srv+ dup+ ssl+ cap+ fs+ cmd cmd+ indir++ draw+ pointer+ snarf++ ip ipif-posix ipaux+ eia+# audio audio+ mem+ apm+lib+ interp+ tk+ freetype+ math+ draw screen++ memlayer+ memdraw+ keyring+ sec+ mp++ 9++link+ input+mod+ sys+ draw++ tk+ math+ srv srv+ keyring+ loader+ freetype++port+ alloc+ cache+ chan+ dev+ devtab+ dial+ dis+ discall+ env+ error+ errstr+ exception+ exportfs+ inferno+ latin1+ main+ parse+ pgrp+ print+ proc+ qio+ random+ sysfile+ uqid++code++init+ emuinit++root+ /dev /+ /fd /+ /prog /+ /net /+ /net.alt /+ /chan /+ /nvfs /+ /env /+# /chan+# /dev+# /dis+# /env+# /n+# /net+# /nvfs /+# /prog+# /icons+# /osinit.dis+# /dis/emuinit.dis+# /dis/lib/auth.dis+# /dis/lib/ssl.dis+# /n/local /diff -r d1acc2a527af emu/Linux-fb/fb.c--- /dev/null Thu Jan 01 00:00:00 1970 +0000+++ b/emu/Linux-fb/fb.c Mon Oct 10 09:04:29 2011 +0300@@ -0,0 +1,826 @@+/******************************************************+*+* Linux frame buffer device support for Inferno OS+*+* Copyright (c) 2005, 2006, 2008, 2011 Alexander Sychev. +* All rights reserved.+* Use of this source code is governed by a BSD-style+* license that can be found in the LICENSE file.+*+*******************************************************/+#include "dat.h"+#include "fns.h"+#include <draw.h>++#include <errno.h>+#include <sys/mman.h>+#include <sys/types.h>+#include <sys/stat.h>+#include <sys/vt.h>+#include <sys/ioctl.h>+#include <fcntl.h>+#include <string.h>+#include <linux/fb.h>+#include <sys/vt.h>+#include <sys/kd.h>+#include <stdlib.h>+#include <signal.h>+#include <stdio.h>+#include <termios.h>++#include "fb.h"++static int fbfd = -1;+static int fbsize = 0;+static struct fb_var_screeninfo origvsi;+static struct fb_var_screeninfo curvsi;+static struct fb_cmap origcmap;+static struct fb_cmap curcmap;+static int tty0 = -1;+int tty = -1;+static int old_stdin = -1;+static unsigned short prevtty = -1;+static unsigned short activetty = -1;+static unsigned short oldfb = -1;+static int oldtermmode = KD_TEXT;+static struct vt_mode oldvtmode;+struct termios oldtermattr;+static int vt_init();+static void vt_deinit();++static int enum_modes(int xres, int yres);+static int get_params(int* x, int* y, int* bpp, unsigned long* channel);+static int set_cmap();++uint suspend = 0;++int fb_init(int* xres, int* yres, int* bpp, unsigned long* channel)+{+ unsigned char* res = 0;+ int size = 0;+ struct fb_fix_screeninfo fsi;++ char* fbdev = getenv("FRAMEBUFFER");++ if( !fbdev || !*fbdev )+ fbdev = "/dev/fb0";+ + fbfd = open(fbdev, O_RDWR);++ if(fbfd < 0){+ fprint(2, "framebuffer: cannot open a file %s: %s\n", fbdev, strerror(errno));+ return 0;+ }+++ if(ioctl(fbfd, FBIOGET_FSCREENINFO, &fsi)){+ fprint(2, "framebuffer: cannot get fixed screen info: %s\n", strerror(errno));+ return -1;+ }++ fbsize = fsi.smem_len;++ if(ioctl(fbfd, FBIOBLANK, 0)){+ close(fbfd);+ fprint(2, "framebuffer: cannot blank the framebuffer: %s\n", strerror(errno));+ return 0;+ }++ if(ioctl(fbfd, FBIOGET_VSCREENINFO, &origvsi)){+ close(fbfd);+ fprint(2, "framebuffer: cannot get the variable screen info: %s\n", strerror(errno));+ return 0;+ }++ curvsi = origvsi;+ curvsi.activate = FB_ACTIVATE_NOW;+ if(ioctl(fbfd, FBIOPUT_VSCREENINFO, &curvsi)){+ fprint(2, "framebuffer: cannot put the new variable screen info: %s\n", strerror(errno));+ return 0;+ }++ if(vt_init()){+ close(fbfd);+ return 0;+ }+#if defined(OLD_KBD_SUPPORT) + kbdinit(); +#endif++ if(!get_params(xres, yres, bpp, channel)) {+ fb_deinit();+ return 0;+ }+ memset(&origcmap, 0, sizeof(origcmap));+ memset(&curcmap, 0, sizeof(curcmap));+ if(!set_cmap()){+ fb_deinit();+ return 0;+ }+Lines 1–500 of 2519. Load more
diff -r d1acc2a527af emu/Linux-fb/LICENSE --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/emu/Linux-fb/LICENSE Mon Oct 10 09:04:29 2011 +0300 @@ -0,0 +1,26 @@ +Copyright (c) 2005, 2006. 2008, 2011 Alexander Sychev. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * The name of authora may not be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff -r d1acc2a527af emu/Linux-fb/devapm.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/emu/Linux-fb/devapm.c Mon Oct 10 09:04:29 2011 +0300 @@ -0,0 +1,231 @@ +/****************************************************** +* +* Adanced power management (APM) support for Inferno OS +* +* Author: Alexander Sychev <santucco@gmail.com> +* +*******************************************************/ + +#include "dat.h" +#include "fns.h" +#include "../port/error.h" + +#include <unistd.h> +#include <linux/apm_bios.h> +#include "fb.h" +#include <stdio.h> + +enum{ + Qdir, + Qapm, +}; + +static +Dirtab apmtab[]={ + ".", {Qdir, 0, QTDIR}, 0, 0555, /* entry for "." must be first if devgen used */ + "apm", {Qapm, 0}, 0, 0666, +}; + + +static Lock apmlock; +static int apmfd = -1; +static Lock proclock; +static int procfd = -1; + +int apm_dev_init() +{ + int result; + lock(&apmlock); + result = ((apmfd == -1) && ((apmfd = open("/dev/apm_bios", O_WRONLY)) < 0)) ? 1 : 0; + unlock(&apmlock); + if(apmfd == -1) + fprint(2, "can't open /dev/apm_bios: %s\n", strerror(errno)); + return result; +} + +int apm_proc_init() +{ + int result; + lock(&proclock); + result = ((procfd == -1) && ((procfd = open("/proc/apm", O_RDONLY))< 0)) ? 1 : 0; + unlock(&proclock); + if(procfd == -1) + fprint(2, "can't open /proc/apm: %s\n", strerror(errno)); + return result; +} + +int apm_dev_close() +{ + int result; + lock(&apmlock); + result = ((apmfd == -1) || close(apmfd)) ? 1 : 0; + apmfd = -1; + unlock(&apmlock); + return result; +} + +int apm_proc_close() +{ + int result; + lock(&proclock); + result = ((procfd == -1) || close(procfd)) ? 1 : 0; + procfd = -1; + unlock(&proclock); + return result; +} + + +void apm_suspend() +{ + int result; + if(apm_dev_init()) + return; + sync(); + lock(&apmlock); + result = ioctl(apmfd, APM_IOC_SUSPEND, 0); + unlock(&apmlock); + if(result) + error(Eio); +} + +int apm_blank(int vesastt) +{ + int result; + static int currvesastt = -1; + + if (currvesastt == vesastt) + return 0; + lock(&apmlock); + result = fb_blank(vesastt); + unlock(&apmlock); + if(result) + error(Eio); + else + currvesastt = vesastt; + return result; +} + +static Chan* +apmattach(char* spec) +{ + if(apm_dev_init() || apm_proc_init()) + error(Enoattach); + return devattach('S', spec); +} + +static Walkqid* +apmwalk(Chan *c, Chan *nc, char **name, int nname) +{ + return devwalk(c, nc, name, nname, apmtab, nelem(apmtab), devgen); +} + +static int +apmstat(Chan* c, uchar *db, int n) +{ + return devstat(c, db, n, apmtab, nelem(apmtab), devgen); +} + +static Chan* +apmopen(Chan* c, int omode) +{ + apm_proc_init(); + return devopen(c, omode, apmtab, nelem(apmtab), devgen); +} + +static void +apmclose(Chan* c) +{ + USED(c); + apm_proc_close(); +} + +static long +apmread(Chan* c, void* a, long n, vlong offset) +{ + USED(offset); + switch((ulong)c->qid.path) { + case Qdir: + return devdirread(c, a, n, apmtab, nelem(apmtab), devgen); + case Qapm: { + char buffer[100] = {0}; + char driver_version[10] = {0}; + int version_major = 0; + int version_minor = 0; + int flags = 0; + int line_status = 0; + int battery_status = 0; + int battery_flags = 0; + int battery_percentage = 0; + int battery_time = 0; + char units[10] = {0}; + if(read(procfd, buffer, sizeof(buffer)) < 0) + error(Eio); + sscanf(buffer, "%s %d.%d %x %x %x %x %d%% %d %s\n", + driver_version, + &version_major, + &version_minor, + &flags, + &line_status, + &battery_status, + &battery_flags, + &battery_percentage, + &battery_time, + units); + int result = sprint(buffer, "%s %d%% %d min ", + ((battery_status) ? "online" : "offline"), + (((battery_percentage >= 0) && (battery_percentage <= 100)) ? battery_percentage : 0), + (strncmp(units, "min", sizeof("min")) ? (battery_time / 60) : battery_time)); + return readstr(offset, a, n, buffer); + } + default: + n=0; + break; + } + return n; +} + + +static long +apmwrite(Chan* c, void* a, long n, vlong offset) +{ + char buffer[128] = {0}; + USED(a); + USED(offset); + switch((ulong)c->qid.path) { + case Qapm: + if(n > sizeof(buffer)) + n = sizeof(buffer)- 1; + strncpy(buffer, a, n); + if(strncmp(buffer, "suspend", sizeof("suspend")) == 0) { + apm_suspend(); + return n; + }else if(strncmp(buffer, "blank", sizeof("blank")) == 0) { + apm_blank(FB_BLANK); + return n; + } + error(Ebadctl); + break; + default: + error(Ebadusefd); + } + return n; +} + +Dev apmdevtab = { /* defaults in dev.c */ + 'S', + "apm", + + devinit, /* devinit */ + apmattach, + apmwalk, + apmstat, + apmopen, + devcreate, /* devcreate */ + apmclose, + apmread, + devbread, /* devbread */ + apmwrite, + devbwrite, /* devbwrite */ + devremove, /* devremove */ + devwstat, /* devwstat */ +}; diff -r d1acc2a527af emu/Linux-fb/emu-fb --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/emu/Linux-fb/emu-fb Mon Oct 10 09:04:29 2011 +0300 @@ -0,0 +1,107 @@ +dev + root + cons + env + mnt + pipe + prog + prof + srv + dup + ssl + cap + fs + cmd cmd + indir + + draw + pointer + snarf + + ip ipif-posix ipaux + eia +# audio audio + mem + apm +lib + interp + tk + freetype + math + draw screen + + memlayer + memdraw + keyring + sec + mp + + 9 + +link + input +mod + sys + draw + + tk + math + srv srv + keyring + loader + freetype + +port + alloc + cache + chan + dev + devtab + dial + dis + discall + env + error + errstr + exception + exportfs + inferno + latin1 + main + parse + pgrp + print + proc + qio + random + sysfile + uqid + +code + +init + emuinit + +root + /dev / + /fd / + /prog / + /net / + /net.alt / + /chan / + /nvfs / + /env / +# /chan +# /dev +# /dis +# /env +# /n +# /net +# /nvfs / +# /prog +# /icons +# /osinit.dis +# /dis/emuinit.dis +# /dis/lib/auth.dis +# /dis/lib/ssl.dis +# /n/local / diff -r d1acc2a527af emu/Linux-fb/fb.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/emu/Linux-fb/fb.c Mon Oct 10 09:04:29 2011 +0300 @@ -0,0 +1,826 @@ +/****************************************************** +* +* Linux frame buffer device support for Inferno OS +* +* Copyright (c) 2005, 2006, 2008, 2011 Alexander Sychev. +* All rights reserved. +* Use of this source code is governed by a BSD-style +* license that can be found in the LICENSE file. +* +*******************************************************/ +#include "dat.h" +#include "fns.h" +#include <draw.h> + +#include <errno.h> +#include <sys/mman.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <sys/vt.h> +#include <sys/ioctl.h> +#include <fcntl.h> +#include <string.h> +#include <linux/fb.h> +#include <sys/vt.h> +#include <sys/kd.h> +#include <stdlib.h> +#include <signal.h> +#include <stdio.h> +#include <termios.h> + +#include "fb.h" + +static int fbfd = -1; +static int fbsize = 0; +static struct fb_var_screeninfo origvsi; +static struct fb_var_screeninfo curvsi; +static struct fb_cmap origcmap; +static struct fb_cmap curcmap; +static int tty0 = -1; +int tty = -1; +static int old_stdin = -1; +static unsigned short prevtty = -1; +static unsigned short activetty = -1; +static unsigned short oldfb = -1; +static int oldtermmode = KD_TEXT; +static struct vt_mode oldvtmode; +struct termios oldtermattr; +static int vt_init(); +static void vt_deinit(); + +static int enum_modes(int xres, int yres); +static int get_params(int* x, int* y, int* bpp, unsigned long* channel); +static int set_cmap(); + +uint suspend = 0; + +int fb_init(int* xres, int* yres, int* bpp, unsigned long* channel) +{ + unsigned char* res = 0; + int size = 0; + struct fb_fix_screeninfo fsi; + + char* fbdev = getenv("FRAMEBUFFER"); + + if( !fbdev || !*fbdev ) + fbdev = "/dev/fb0"; + + fbfd = open(fbdev, O_RDWR); + + if(fbfd < 0){ + fprint(2, "framebuffer: cannot open a file %s: %s\n", fbdev, strerror(errno)); + return 0; + } + + + if(ioctl(fbfd, FBIOGET_FSCREENINFO, &fsi)){ + fprint(2, "framebuffer: cannot get fixed screen info: %s\n", strerror(errno)); + return -1; + } + + fbsize = fsi.smem_len; + + if(ioctl(fbfd, FBIOBLANK, 0)){ + close(fbfd); + fprint(2, "framebuffer: cannot blank the framebuffer: %s\n", strerror(errno)); + return 0; + } + + if(ioctl(fbfd, FBIOGET_VSCREENINFO, &origvsi)){ + close(fbfd); + fprint(2, "framebuffer: cannot get the variable screen info: %s\n", strerror(errno)); + return 0; + } + + curvsi = origvsi; + curvsi.activate = FB_ACTIVATE_NOW; + if(ioctl(fbfd, FBIOPUT_VSCREENINFO, &curvsi)){ + fprint(2, "framebuffer: cannot put the new variable screen info: %s\n", strerror(errno)); + return 0; + } + + if(vt_init()){ + close(fbfd); + return 0; + } +#if defined(OLD_KBD_SUPPORT) + kbdinit(); +#endif + + if(!get_params(xres, yres, bpp, channel)) { + fb_deinit(); + return 0; + } + memset(&origcmap, 0, sizeof(origcmap)); + memset(&curcmap, 0, sizeof(curcmap)); + if(!set_cmap()){ + fb_deinit(); + return 0; + } +