From: Aivils S. <Aiv...@un...> - 2002-04-12 07:28:50
|
Hi Here is dumb console driver created by me for X. Dumb console create VT and then do nothig. All work do linuxconsole vt-manager. You can configure dumb with kernel command line "dumbcon=x", where x is number of dumb consoles. Every console is binded with /dev/tty's depended from MAX _NR_USER_CONSOLES. Sample: file vt_kern.h #define MAX_NR_USER_CONSOLES 4 VGA configured, DUMB cofigured, command line "dumbcon=2" . Result /dev/tty1 VGA /dev/tty2 VGA /dev/tty3 VGA /dev/tty4 VGA /dev/tty5 DUMB 0 /dev/tty6 DUMB 0 /dev/tty7 DUMB 0 /dev/tty8 DUMB 0 /dev/tty9 DUMB 1 /dev/tty10 DUMB 1 /dev/tty11 DUMB 1 /dev/tty12 DUMB 1 Now You can run first X with parameter vt4 $ X0 :0 vt4 second $ X1 :1 vt8 third $ X2 :2 vt12 X0, X1, X2 are symbolic links to /usr/X11R6/bin/XFree86. Of course any X server have separate config file( parameter -xf86config file). This are tested by me with xdm, triple graphic login succesfully run. Edit /etc/X11/xdm/Xservers . Seems kdm, gdm don't like multiple X or wrong configuration on my end. X patch is necessary. Q: Why linuxconsole vt-manager is better as separate keyboard driver for X. A: Linuxconsole project already have tons of keyboard drivers. All You can add to X via /dev/tty. Files: Makefile patch forgotten in home. --- vt.c Tue Mar 26 13:01:05 2002 +++ vt.c.changed Fri Apr 12 09:31:22 2002 @@ -1606,12 +1606,15 @@ #if defined (CONFIG_PROM_CONSOLE) prom_con_init(); #endif #if defined (CONFIG_FRAMEBUFFER_CONSOLE) fb_console_init(); #endif +#if defined (CONFIG_DUMB_CONSOLE) + dumb_console_init(); +#endif kbd_init(); console_map_init(); vcs_init(); return 0; } START OF dumbcon.c /* * linux/drivers/video/dumbcon.c -- A dummy console driver * * To be used for X * */ #include <linux/module.h> #include <linux/types.h> #include <linux/kdev_t.h> #include <linux/slab.h> #include <linux/tty.h> #include <linux/vt_kern.h> #include <linux/init.h> /* * Dumb console driver */ #if defined(__arm__) #define DUMMY_COLUMNS ORIG_VIDEO_COLS #define DUMMY_ROWS ORIG_VIDEO_LINES #else #define DUMMY_COLUMNS 80 #define DUMMY_ROWS 25 #endif #define MAX_DUMB_CONSOLES 8 static unsigned long dumb_num __initdata = 0; /* disabled by default */ MODULE_PARM(dumb_num, "n"); static const char *dumbcon_startup(struct vt_struct *vt, int init) { struct vc_data *vc; vc = (struct vc_data *) kmalloc(sizeof(struct vc_data), GFP_KERNEL); vt->default_mode = vc; vc->display_fg = vt; vt->default_mode->vc_can_do_color = 0; vt->default_mode->vc_cols = DUMMY_COLUMNS; vt->default_mode->vc_rows = DUMMY_ROWS; return "dumb device"; } static void dumbcon_init(struct vc_data *vc) { vc->vc_can_do_color = vc->display_fg->default_mode->vc_can_do_color = 0; vc->vc_cols = vc->display_fg->default_mode->vc_cols; vc->vc_rows = vc->display_fg->default_mode->vc_rows; } static int dumbcon_dummy(void) { return 0; } #define DUMMY (void *)dumbcon_dummy /* * The console `switch' structure for the dummy console * * Most of the operations are dummies. */ const struct consw dumb_con = { con_startup: dumbcon_startup, con_init: dumbcon_init, con_deinit: DUMMY, con_clear: DUMMY, con_putc: DUMMY, con_putcs: DUMMY, con_cursor: DUMMY, con_scroll_region: DUMMY, con_bmove: DUMMY, con_blank: DUMMY, con_font_op: DUMMY, con_resize: DUMMY, con_set_palette: DUMMY, con_scroll: DUMMY, }; int dumb_init(void) { const char *display_desc = NULL; struct vt_struct *vt; vt = (struct vt_struct *) kmalloc(sizeof(struct vt_struct),GFP_KERNEL); if (!vt) return 1; memset(vt, 0, sizeof(struct vt_struct)); vt->kmalloced = 1; vt->vt_sw = &dumb_con; display_desc = vt_map_display(vt, 1); if (!display_desc) return -ENODEV; printk("Console: %s %s %dx%d\n", vt->default_mode->vc_can_do_color ? "colour" : "mono", display_desc, vt->default_mode->vc_cols, vt->default_mode->vc_rows); return 0; } int __init dumb_console_init(void) { unsigned long i; for(i=0; i<dumb_num && i<MAX_DUMB_CONSOLES; i++ ) { if(dumb_init()) return 1; } return 0; } int __init dumbcon_setup(char *options) { if (!options || !*options) return 0; dumb_num = simple_strtoul(options, 0, 0); return 0; } __setup("dumbcon=", dumbcon_setup); #ifdef MODULE void __exit dumb_module_exit(void) { /* release_vt(&vga_vt); */ } module_init(dumb_console_init); module_exit(dumb_module_exit); MODULE_LICENSE("GPL"); #endif EOF dumbcon.c Regards Aivils Stoss |