From: Michal Simek <monstr@monstr.eu>
To: Peter Korsgaard <jacmet@sunsite.dk>
Cc: linux-serial@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: Uartlite - ulite_transmit
Date: Thu, 20 Jan 2011 09:04:25 +0100 [thread overview]
Message-ID: <4D37EC89.2080802@monstr.eu> (raw)
In-Reply-To: <87oc7cgbi1.fsf@macbook.be.48ers.dk>
Hi Peter,
> Hi,
>
> >> The problem is the uart_flush_buffer() call we see after uart_open() in
> >> 4. If doesn't seem to come from serial_core (only called from uart_close
> >> / uart_hangup), so presumably it comes from the TTY core or
> >> userspace. Could you add a bit more debug to figure out where exactly it
> >> comes from?
>
> Michal> Last week I have also implemented simple ioctl function for
> Michal> uartlite - just printk to see what happen. Look at the second
> Michal> log below.
>
> Michal> uart_open(0) called
> Michal> ulite_ioctl 5401 bff76a18
> Michal> n_tty_ioctl
> Michal> ulite_ioctl 540b 2
> Michal> n_tty_ioctl
> Michal> n_tty_ioctl_helper TCFLSH
> Michal> tty_perform_flush TCIOFLUSH
> Michal> tty_perform_flush TCOFLUSH
> Michal> tty_driver_flush_buffer
> Michal> uart_flush_buffer(0) called
>
> So your userspace is calling tcflush, and serial_core responds by
> flushing (dropping) the buffer. That seems like expected behaviour to
> me.
>
> This is presumably from the busybox getty applet, which does:
>
> static void termios_init(struct termios *tp, int speed, struct options *op)
> {
> speed_t ispeed, ospeed;
> /*
> * Initial termios settings: 8-bit characters, raw-mode, blocking i/o.
> * Special characters are set after we have read the login name; all
> * reads will be done in raw mode anyway. Errors will be dealt with
> * later on.
> */
> /* flush input and output queues, important for modems! */
> tcflush(0, TCIOFLUSH);
>
> You could change that to a tcdrain() if that's not what you want.
>
Great that's work. Just for the record it is tcdrain(STDOUT_FILENO);
Patch against busybox 1.14.3 version is below. Maybe worth to added it
mainline busybox.
Thanks for your big help.
Michal
diff --git
a/software/petalinux-dist/user/busybox/busybox-1.14.3/loginutils/getty.c
b/software/petalinux-dist/user/busybox/busybo
index 24a182f..4c99e92 100644
--- a/software/petalinux-dist/user/busybox/busybox-1.14.3/loginutils/getty.c
+++ b/software/petalinux-dist/user/busybox/busybox-1.14.3/loginutils/getty.c
@@ -279,6 +279,8 @@ static void termios_init(struct termios *tp, int
speed, struct options *op)
* later on.
*/
#ifdef __linux__
+ /* wait until all output written to the stdout has been
transmitted */
+ tcdrain(STDOUT_FILENO);
/* flush input and output queues, important for modems! */
ioctl(0, TCFLSH, TCIOFLUSH); /* tcflush(0, TCIOFLUSH)? - same */
#endif
--
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian
next prev parent reply other threads:[~2011-01-20 8:04 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <4D2465E0.2000707@monstr.eu>
2011-01-05 12:39 ` Uartlite - ulite_transmit Michal Simek
2011-01-06 7:56 ` Peter Korsgaard
2011-01-06 8:29 ` Michal Simek
2011-01-06 9:02 ` Peter Korsgaard
2011-01-06 9:10 ` Michal Simek
2011-01-06 9:49 ` Peter Korsgaard
2011-01-07 7:48 ` Michal Simek
2011-01-07 9:06 ` Michal Simek
[not found] ` <4D2D78F3.2040903@monstr.eu>
[not found] ` <87aaj6zays.fsf@macbook.be.48ers.dk>
[not found] ` <4D2D8113.1020504@monstr.eu>
[not found] ` <8739oyza2n.fsf@macbook.be.48ers.dk>
2011-01-16 9:08 ` Michal Simek
2011-01-16 21:02 ` Peter Korsgaard
2011-01-17 6:35 ` Michal Simek
2011-01-17 15:17 ` Michal Simek
2011-01-19 15:27 ` Peter Korsgaard
2011-01-20 8:04 ` Michal Simek [this message]
2011-01-20 8:06 ` Peter Korsgaard
2011-01-20 8:08 ` Michal Simek
2011-01-12 9:40 ` Peter Korsgaard
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=4D37EC89.2080802@monstr.eu \
--to=monstr@monstr.eu \
--cc=jacmet@sunsite.dk \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.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).