[U-Boot-Users] PXA27x usbtty start up sequence
Bryan O'Donoghue
bodonoghue at codehermit.ie
Mon May 21 01:11:58 CEST 2007
On Mon, 21 May 2007 00:23:42 +0200
Rodolfo Giometti <giometti at enneenne.com> wrote:
> The problem is that the defice __is__ into configured state (USB
> cable is connected and /dev/ttyUSB0 is running) but nobody has
> opened the serial line (no minicom/kermit running).
>
> So, I suppose, the above modification is useless...
No, no, unless I'm *really* forgetting my USB enumeration behavior,
a device shouldn't go into the configured state unless and until
the host does a SET_CONFIGURATION, so the modification would be right
since without the USB cable connected the device should be in the
DEFAULT state, not the CONFIGURED state.
usb_20.pdf page - 240 Figure 9.1 see ?
> Mmm... I see... I supposed to get no control request once device is
> connected...
>
> Currently I use a timeout of 2ms but I suppose I should decrease it,
> shouldn't I? :-o
Possibly... I don't think I'd take issue with the specific timeout
but, you *can* get a control request at *any* time... including 50% of
the way through a DATA IN transfer to the host... there's nothing in
the USB specification which precludes control requests on EP0 at
*any* time...
You'd probably "get away" with it if you limited your hardware to
functioning only with g_serial but, where would be the fun in doing
just g_serial ?
> Ok, what do you suggest to do? I'm a bit confused... :)
Possibly the simple solution is
#1: Fix it so SET_CONFIGURATION is the only thing to move the device
into the configured state.
#2: Either you or I should write a patch then which looks like this.
/* Not tested */
static void __usbtty_puts (const char *str, int len)
{
int maxlen = usbtty_output.totalsize;
int space, n;
/* break str into chunks < buffer size, if needed */
while (len > 0
&& device_instance->device_state == STATE_CONFIGURED) {
usbtty_poll ();
space = maxlen - usbtty_output.size;
/* Empty buffer here, if needed, to ensure space... */
if (space) {
write_buffer (&usbtty_output);
n = MIN (space, MIN (len, maxlen));
buf_push (&usbtty_output, str, n);
str += n;
len -= n;
}
}
}
I think... that *should* work.
Happy Monday.
Bryan
More information about the U-Boot
mailing list