Console Drivers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi guys!!!
 
        This is my first mail to the list and i'm eagerly awaiting a reply. I was goin thru the printk source and found out that printk 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

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux