Messages in this thread | | | Date | Thu, 10 Apr 2003 05:49:54 +0530 | From | Bijoy Thomas <> | Subject | Console Drivers Rebooting |
| |
Hi guys!!!
This is my first mail to ts list and i'm eagerly awaiting a reply. I was goin thru the printk source and found out that pritk was calling the write method of struct console 's present on a list pointed to by console_drivers. So I thot of adding my own console driver like this....
#define MODULE #define __KERNEL__ #include<linux/module.h> #include<linux/kernel.h> #include<linux/console.h> #include<linux/sched.h>
void my_write(struct console *co,const char *buf,unsigned count) { struct tty_struct *my_tty; my_tty = current->tty; if(my_tty != NULL) { ((my_tty->driver).write)(my_tty,0,buf,strlen(buf)); } }
struct console my_console = { name:"MYCON", write:my_write, flags:CON_ENABLED, index:-1, };
int init_module() { register_console(&my_console); return 0; }
void cleanup_module() { }
When I insmoded the module (in run level 3) it worked fine. While it was still inserted i typed 'startx' and when i pressed 'Enter' ,the machine instantly rebooted!!! I tried this again and it happened. With MYCON registered ,if I issue the startx command ,the machine reboots. Also if MYCON is registered and I shutdown using 'init 0' again the reboot happens.Can anyone explain??
bye Bijoy Jacob Thomas
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |