Re: usb_{bulk,interrupt}_transfer() and PCATCH

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Jacob Meuser
Date: Sunday, December 12, 2010 - 6:02 am

On Sat, Dec 11, 2010 at 08:56:38PM +0000, Jacob Meuser wrote:

I looked at all users of libusb.  none deal with usb_{bulk,interrupt}_read
(the libusb "frontend") quitting with EINTR.  none set SA_RESTART.

usbd_{bulk,intr}_transfer() (in the usb(4) stack) do not obey
SA_RESTART.  neither do the ugen(4) ends of those functions.

usbd_transfer() does not catch signals.  in fact.  the only other
thing in the usb stack that does catch signals is usbread(), which
is an interface to read messages from the usb event queue.  the
event queue is stored in software.  it doesn't handle tsleep()
returning ERESTART either, btw.

figuring out an absolute max timeout seems fairly straight-forward.
timeouts are specified in miliseconds.  the usb frame rate is 1000 Hz.
an empty frame signals the end of a transfer.  timeout = bytes,
basically.

now, usbd_intr_transfer() may be a different story.  that will block
(if not set or non-blocking io) until there is data to read.  most
users of this in libusb do set a timeout though.  some also restart
the read if they get ETIMEDOUT.

I think, catching signals is wrong.  at least, it's not expected by
most of it's users and not even handled correctly in the kernel.

further, by not setting a timeout, it leaves the user to figure out
that something is wrong.




-- 
jakemsr@sdf.lonestar.org
SDF Public Access UNIX System - http://sdf.lonestar.org
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
usb_{bulk,interrupt}_transfer() and PCATCH, Jacob Meuser, (Tue Dec 7, 11:07 pm)
Re: usb_{bulk,interrupt}_transfer() and PCATCH, Paul Irofti, (Thu Dec 9, 8:09 am)
Re: usb_{bulk,interrupt}_transfer() and PCATCH, Antoine Jacoutot, (Sat Dec 11, 7:08 am)
Re: usb_{bulk,interrupt}_transfer() and PCATCH, Mark Kettenis, (Sat Dec 11, 12:14 pm)
Re: usb_{bulk,interrupt}_transfer() and PCATCH, Jacob Meuser, (Sat Dec 11, 1:35 pm)
Re: usb_{bulk,interrupt}_transfer() and PCATCH, Jacob Meuser, (Sat Dec 11, 1:56 pm)
Re: usb_{bulk,interrupt}_transfer() and PCATCH, Jacob Meuser, (Sun Dec 12, 6:02 am)
Re: usb_{bulk,interrupt}_transfer() and PCATCH, Jacob Meuser, (Mon Dec 13, 6:32 pm)
Re: usb_{bulk,interrupt}_transfer() and PCATCH, Jacob Meuser, (Fri Dec 17, 3:56 pm)