Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

tty line discipline

56 views
Skip to first unread message

Rabih ElMasri

unread,
Oct 19, 2005, 8:00:09 AM10/19/05
to
hi,

I am trying to assign a new line discipline to ttyS0 from within the
kernel-space. During the initialization of my module I do the
following:

fp=filp_open(dev,O_RDWR | O_NOCTTY,0);
tty=fp->private_data; //the tty_struct

then I initialize the fields of the new line discipline (ldisc). and
assign it to the tty_struct:

tty->ldisc=ldisc;

It works fine the first time I insert the module, but gets problems
with tty->count if I insert it again.

I tried to call the tty_ioctl function of tty_io.c (with flag
TIOCSETD) using the corresponding field in the file structure
(fp->f_op->ioctl(..)), but it seems to expect a call from user-space,
and returns -EFAULT due to the get_user macro.

I would really appreciate it if someone can tell me how to deal with
this problem.

Regards,
Rabih
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majo...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Arjan van de Ven

unread,
Oct 19, 2005, 8:10:24 AM10/19/05
to
On Wed, 2005-10-19 at 13:55 +0200, Rabih ElMasri wrote:
> hi,
>
> I am trying to assign a new line discipline to ttyS0 from within the
> kernel-space.

why? You don't describe what you want to solve, only how you want to do
it... it might be entirely the wrong solution for a simple problem..


> During the initialization of my module I do the
> following:

you forgot to attach the full source of your module or point to URL with
that. That is basically rule nr 1 when posting about problems with
out-of-kernel modules; how else are people supposed to help you?

Rabih ElMasri

unread,
Oct 19, 2005, 11:01:35 AM10/19/05
to
Thank you Arjan for the remarks. I want to establish communication
between a host and a controller. The controller is connected to the
serial port ttyS0. I want to be able to specify how the driver
receives and sends the data. I thought this would require a line
discipline because a driver for ttyS0 already exists. Please correct
me if I was wrong.

Previously, I used to initialize the module and register the line
discipline to N_MOUSE. Then I would run a C-file from user space with
the code:

i=N_MOUSE;
ioctl(fd,TIOCSETD,&i);

This would assign the line discipline to ttyS0 successfully. Now, I
want to establish communication directly from kernel space.

As can be seen from the attached source file, the only fields from the
tty_ldisc structure that I'm using are receive_buf (tl_tty_receive)
and write_wakeup(tl_tty_wakeup).

If the problem is still unclear please tell me.

tl.c
0 new messages