From: "Søren holm" <sgh@sgh.dk>
To: Mayank Rana <mrana@codeaurora.org>
Cc: linux-serial@vger.kernel.org
Subject: Re: About changing Line Discipline from Kernel
Date: Wed, 22 Feb 2012 09:22:36 +0100 [thread overview]
Message-ID: <1454871.D1ceTDIupK@koontz> (raw)
In-Reply-To: <4F4493AC.5010405@codeaurora.org>
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
next prev parent reply other threads:[~2012-02-22 8:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-22 7:05 About changing Line Discipline from Kernel Mayank Rana
2012-02-22 8:22 ` Søren holm [this message]
2012-02-22 9:34 ` Alan Cox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1454871.D1ceTDIupK@koontz \
--to=sgh@sgh.dk \
--cc=linux-serial@vger.kernel.org \
--cc=mrana@codeaurora.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).