From: Paul Fulghum <paulkf@microgate.com>
To: Thomas Stewart <thomas@stewarts.org.uk>
Cc: Linux Kernel list <linux-kernel@vger.kernel.org>
Subject: Re: belkin usb serial converter (mct_u232), break not working
Date: Wed, 20 Oct 2004 21:37:58 -0500 [thread overview]
Message-ID: <1098326278.6017.19.camel@at2.pipehead.org> (raw)
In-Reply-To: <200410210004.13214.thomas@stewarts.org.uk>
On Wed, 2004-10-20 at 18:04, Thomas Stewart wrote:
> porttest.c:
> #include <sys/fcntl.h>
> #include <sys/ioctl.h>
> main(int argc, char ** argv) {
> int r, fd = open(argv[1], O_RDWR|O_NOCTTY);
> r=ioctl(fd, TCSBRKP, 20);
> printf("%d\n", r);
> close(fd);
> }
>
> $ ./porttest /dev/ttyS0
> 0
> $ ./porttest /dev/ttyUSB0
> 0
OK, this is a kernel problem with send_break() in tty_io.c
Original:
static int send_break(struct tty_struct *tty, int duration)
{
set_current_state(TASK_INTERRUPTIBLE);
tty->driver->break_ctl(tty, -1);
if (!signal_pending(current))
schedule_timeout(duration);
tty->driver->break_ctl(tty, 0);
if (signal_pending(current))
return -EINTR;
return 0;
}
The USB serial driver break_ctl() sends a URB which does
a sleep and wakeup changing the task state back to TASK_RUNNING.
Because of this, schedule_timeout() above gets short circuited
and the break condition is not maintained long enough.
The normal serial driver break_ctl() leaves the task state
as TASK_INTERRUPTIBLE so you get the proper delay.
Thomas: try the patch below and let me know the results.
--
Paul Fulghum
paulkf@microgate.com
--- linux-2.6.8/drivers/char/tty_io.c 2004-08-14 00:37:15.000000000 -0500
+++ b/drivers/char/tty_io.c 2004-10-20 21:31:55.000000000 -0500
@@ -1703,11 +1703,11 @@ static int tiocsetd(struct tty_struct *t
static int send_break(struct tty_struct *tty, int duration)
{
- set_current_state(TASK_INTERRUPTIBLE);
-
tty->driver->break_ctl(tty, -1);
- if (!signal_pending(current))
+ if (!signal_pending(current)) {
+ set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(duration);
+ }
tty->driver->break_ctl(tty, 0);
if (signal_pending(current))
return -EINTR;
next prev parent reply other threads:[~2004-10-21 2:45 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-20 18:46 belkin usb serial converter (mct_u232), break not working Thomas Stewart
2004-10-20 20:48 ` Paul Fulghum
2004-10-20 21:22 ` Paul Fulghum
2004-10-20 22:08 ` Thomas Stewart
2004-10-20 22:15 ` Paul Fulghum
2004-10-20 22:21 ` Paul Fulghum
2004-10-20 22:27 ` Paul Fulghum
2004-10-20 23:04 ` Thomas Stewart
2004-10-21 2:37 ` Paul Fulghum [this message]
2004-10-21 10:06 ` Thomas Stewart
2004-10-21 12:41 ` Paul Fulghum
2004-10-21 19:44 ` Paul Fulghum
2004-11-04 18:20 ` Thomas Stewart
2004-11-04 19:21 ` Paul Fulghum
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=1098326278.6017.19.camel@at2.pipehead.org \
--to=paulkf@microgate.com \
--cc=linux-kernel@vger.kernel.org \
--cc=thomas@stewarts.org.uk \
/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