[<prev] [next>] [day] [month] [year] [list]
Message-Id: <201004131056.19984.florian@openwrt.org>
Date: Tue, 13 Apr 2010 10:56:19 +0200
From: Florian Fainelli <florian@...nwrt.org>
To: linux-kernel@...r.kernel.org
Cc: alan@...rguk.ukuu.org.uk, gregkh@...e.de
Subject: 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists