linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* About changing Line Discipline  from Kernel
@ 2012-02-22  7:05 Mayank Rana
  2012-02-22  8:22 ` Søren holm
  2012-02-22  9:34 ` Alan Cox
  0 siblings, 2 replies; 3+ messages in thread
From: Mayank Rana @ 2012-02-22  7:05 UTC (permalink / raw)
  To: linux-serial

Hi ,

I have few queries related to using Line Discipline.

1. I understand that line discipline can be changed from user space 
application by opening the device and doing ioctl with required Line 
Discipline ID. Is it possible to do the same from kernel module who 
would be communicating with that line discipline ?

2. Is it way to set default line discipline for particular tty device
to required Line Discipline instead of N_TTY one ?

Appreciate your help on this.

Regards,
_-_Mayank Rana_-_
-- 
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: About changing Line Discipline  from Kernel
  2012-02-22  7:05 About changing Line Discipline from Kernel Mayank Rana
@ 2012-02-22  8:22 ` Søren holm
  2012-02-22  9:34 ` Alan Cox
  1 sibling, 0 replies; 3+ messages in thread
From: Søren holm @ 2012-02-22  8:22 UTC (permalink / raw)
  To: Mayank Rana; +Cc: linux-serial

Onsdag den 22. februar 2012 12:35:16 skrev Mayank Rana:
> 
> I have few queries related to using Line Discipline.
> 
> 1. I understand that line discipline can be changed from user space
> application by opening the device and doing ioctl with required Line
> Discipline ID. Is it possible to do the same from kernel module who
> would be communicating with that line discipline ?
> 
> 2. Is it way to set default line discipline for particular tty device
> to required Line Discipline instead of N_TTY one ?
> 
> Appreciate your help on this.

I've earlier done something like this :


        /* Attach line discipline to the uctrl tty */
        set_fs(get_ds());
        ret = put_user(N_PS3D, &ldiscNum);
        if (ret != 0) {
                PSDEBUG(debuglevel, "Leaving, EFAULT\n");
                return -EFAULT;
        } else {
                set_fs(KERNEL_DS);
                ret = uctrl_file->f_op->unlocked_ioctl(uctrl_file, TIOCSETD, (unsigned long)&ldiscNum);

                /*
                 * Decrement use count since setting the line descipline triggers a call to 'n_ps3d_tty_open'
                 * which increments the use count making it impossible to only the module without --force
                 */
                module_put(THIS_MODULE);

                if (ret < 0) {
                        PSKERR(debuglevel, "failed with n_tty_ioctl()\n");
                        return -EFAULT;
                }
        }
        set_fs(old_fs);



-- 
Søren Holm
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: About changing Line Discipline  from Kernel
  2012-02-22  7:05 About changing Line Discipline from Kernel Mayank Rana
  2012-02-22  8:22 ` Søren holm
@ 2012-02-22  9:34 ` Alan Cox
  1 sibling, 0 replies; 3+ messages in thread
From: Alan Cox @ 2012-02-22  9:34 UTC (permalink / raw)
  To: Mayank Rana; +Cc: linux-serial

> 1. I understand that line discipline can be changed from user space 
> application by opening the device and doing ioctl with required Line 
> Discipline ID. Is it possible to do the same from kernel module who 
> would be communicating with that line discipline ?

Not currently. You need something to hold the tty open anyway if you do
this.

> 2. Is it way to set default line discipline for particular tty device
> to required Line Discipline instead of N_TTY one ?

No. All tty devices start in N_TTY and return to N_TTY when closed.
That's a design assumption in the ldisc handling and in in the tty setup
and teardown code paths.

There is no API/ABI reason for the assumption so if someone did the work
they could remove that assumption.

Alan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-02-22  9:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-22  7:05 About changing Line Discipline from Kernel Mayank Rana
2012-02-22  8:22 ` Søren holm
2012-02-22  9:34 ` Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).