On Tue, 22 Feb 2005, Glenn Maynard wrote:

> The system isn't hung.  (cat is hung, until the timeout completes.)  usb-
> storage/ub is timing out as a result of serial being read.  All I want
> is to be able to read the serial (and product and manufacturer strings)
> without risking interference with other communications with the device.

Okay, I understand your problem.

At present there's no way to do it in general.  If you restrict your
program to the period while usb-storage waits before scanning the devices
then things will work, as you've seen.  But there's no guarantee about how
long that period is; users can set it all the way down to 0.  And ub has
no such settling period.

This is really the devices' fault, since what you're doing is perfectly 
legal.  There's no good reason for them to get confused when a Get 
Descriptor request arrives in the middle of a SCSI I/O operation.  But 
they do, and we have to live with it.

Linux 2.4 has a semaphore mechanism in place to prevent this sort of
overlap of operations.  Nothing like it has been added to 2.6, partly
because it's not clear exactly how it should work.  There was a disastrous
attempt some time ago, quickly abandoned.

A less general solution that could suffice for your problem would be to
have the kernel store the Manufacturer, Product, and Serial strings (and
also the Configuration and Interface name strings) rather than query the
device every time those sysfs files are accessed.  This could be done
without much trouble.  Part of the reason it hasn't is that devices are
allowed to change those strings at any time -- although I'm not aware of
any which do.

Alan Stern



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to