* Best way to do kernel only ldisc without user-space ldisc attaching?
@ 2010-04-13 8:56 Florian Fainelli
0 siblings, 0 replies; only message in thread
From: Florian Fainelli @ 2010-04-13 8:56 UTC (permalink / raw)
To: linux-kernel; +Cc: alan, gregkh
Hello,
I have a line discpline driver for a custom protocol over an UART. This driver
implements the following callbacks: open/close, receive_buf/write_wakeup.
So far, I have an ugly hack, which opens the /dev/tty<N> in the kernel, and
directly uses the f_op and unlocked_ioctl functions to do the ldisc number to
TTY device binding:
[snip]
struct file *f;
filp_open("/dev/ttyS1", 0, 0);
f->f_op->unlocked_ioctl(f, TCFLSH, 0x2);
memset(&tio, 0, sizeof(tio));
tio.c_cflag = my_flags;
tio.c_iflag = IGNPAR | ICRNL;
f->f_op->unlocked_ioctl(f, TCSETS, (long unsigned int)&tio);
f->f_op->unlocked_ioctl(f, TIOCSETD, (long unsigned int)&ldisc_nr);
set_fs(oldfs);
[snip]
This prevents me from rmmoding the module. However, I would like to avoid an
user-space program from having to bind the TTY device to the ldisc number if
possible.
Thank you very much for your answer.
--
Florian
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-04-13 8:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-13 8:56 Best way to do kernel only ldisc without user-space ldisc attaching? Florian Fainelli
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox