Best way to do kernel only ldisc without user-space ldisc attaching?
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