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/
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?
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.