From: Richard Miller <9fans@hamnavoe.com>
To: 9fans@9fans.net
Subject: Re: [9fans] usb serial on raspberry pi (again)
Date: Mon, 12 Dec 2016 20:33:40 +0000 [thread overview]
Message-ID: <b0502ab0b79df00107ccce55d5a4f0f7@hamnavoe.com> (raw)
In-Reply-To: <b7202f3ba185934eb9360d78a09f1386@quintile.net>
> I cannot get the usb serial interfaces we use to work. I have never managed to get
> usb serial adapters to work with the raspberry pi, though never had problems on x86 boxen.
> ...
>
> Text into the pi works fine, but outgoing text seems stalled until text is received,
> I can type ahead and when I receive data the queued outgoing data is sent.
Hi Steve -
I just had a look at this (as a bit of displacement activity from more
stressful tasks...). First of all I dug out an old silabs usbserial
adapter and quickly confirmed that I see the same symptoms as you.
(I had never thought of using a serial dongle on a pi, since the
uart gpio pins have always served my purposes - I always connect
to FPGAs or other microprocessors which are happy with 3.3V)
By watching changes in the file descriptor r/w count in the 'ps' output
for the usbd subprocess, I could see that the first byte of data was
being written to the usb ep, but the write was hanging in the kernel
till the next read completion. I noted that this particular dongle
uses the same ep number for both input and output, which is unusual
(and was never properly allowed for in the original design of plan 9 usb).
Next I looked in the bcm usb adapter driver (usbdwc.c) for possible
interference between reads and writes on the same ep number, and
the answer was glaringly obvious. Each ep has a single Epio structure,
shared by read and write sides, with a QLock in it. My failure of vision.
The fix isn't as obvious (to me) as the diagnosis. Maybe it's as simple
as having separate read and write QLocks. I need to study the code for
a while to assure myself that it's safe to do that. I wrote it so long
ago that I frankly can't recall why there's a lock at all.
You're welcome to have a look too and offer suggestions!
-- Richard
next prev parent reply other threads:[~2016-12-12 20:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-27 10:40 Steve Simon
2016-12-12 20:33 ` Richard Miller [this message]
2016-12-12 20:39 ` Richard Miller
2016-12-13 10:06 ` Gorka Guardiola
2016-12-14 10:44 Richard Miller
2016-12-15 11:15 ` Steve Simon
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=b0502ab0b79df00107ccce55d5a4f0f7@hamnavoe.com \
--to=9fans@hamnavoe.com \
--cc=9fans@9fans.net \
/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).