Obj: Line discipline

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

 



Hansen Martin wrote :
> I am making a module that have to register a Line discipline. But i cant
> fugure out what to name it(what number do it get). When i look at the files
> mentiond below, i can't see how to introduce a new line discipline witout
> changing the kernel itself.
> [snip]
 
Hi,

(Please don't pay attention to my horrible english :)

Hoping it will help you, here is a part of a driver I'm currently
writting. I register a line discipline by doing this :

--*-- BEGIN --*--

static const int    N_SRIP        = 14; /* SRIP Line Discipline Number
*/
/*UGLY HACK : because this is the PPP associated number*/
 
static struct tty_ldisc srip_ldisc;
int status;

memset(&srip_ldisc, 0, sizeof(srip_ldisc));
srip_ldisc.magic        = TTY_LDISC_MAGIC;
srip_ldisc.name         = "srip";
srip_ldisc.flags        = 0;
srip_ldisc.open         = srip_tty_open;
srip_ldisc.close        = srip_tty_close;
srip_ldisc.read         = NULL;
srip_ldisc.write        = NULL;
srip_ldisc.ioctl        = srip_tty_ioctl;
srip_ldisc.poll         = NULL;
srip_ldisc.receive_buf  = srip_tty_receive;
srip_ldisc.receive_room = srip_tty_room;
srip_ldisc.write_wakeup = srip_tty_wakeup;
 
if ((status = tty_register_ldisc(N_SRIP, &srip_ldisc)))
        printk(KERN_ERR "srip : error registering line discipline:
%d\n", status);
else
        printk(KERN_INFO "srip : line discipline registered\n");
return status;

--*-- END --*--

where "srip_tty_*" are functions.

Regards,

--
Francis
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[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