On Thu, 29 Nov 2007, Chris Frey wrote:
> Hi folks,
>
> Recent Blackberry devices are a rather unique breed, since they provide
> multiple product ID's in one device, and a vendor-specific method
> to change between them.
>
> The usual way to perform this change is to connect to the device,
> send some vendor specific control messages, and then do a
> usb_set_configuration(). For Classic devices, this causes the
> device to reset itself. For Pearl devices, it waits for the host
> to call usb_reset().
>
> The problem is that the new 8830 devices will reset on
> usb_set_configuration(), and a usb_reset() call will just undo the
> intended mode change and go back to the state it was in when you
> first plugged it in.
>
> This causes the following race conditions between Barry and usb_storage
> on most Linux systems:
>
> - plug in the 8830
> - usb_storage sees a Mass Storage interface, and connects with it
> - udev sees the device and runs bcharge at the same time
> - bcharge connects and sends the vendor specific control messages
> - bcharge calls usb_set_configuration() and nothing happens
> since usb_storage has an interface claimed
> - normally this is ok, for the Pearl, and bcharge calls
> usb_reset(), which sets the mode and everyone is happy...
>
> But...
>
> - for the 8830, usb_reset() goes back to the start, the mode is
> not changed, and there is no way to change it while
> usb_storage has Mass Storage claimed, since the mode
> change occurs on usb_set_configuration().
>
> Questions:
>
> - is there a safe way to delay usb_storage, perhaps from udev,
> so that when Barry is installed the mode is changed
> before usb_storage looks for a drive?
No.
> - is there a better way to handle this? perhaps force usb_storage
> to release the interface somehow, since this only happens
> when the device is first plugged in?
Yes. The bcharge program can unbind usb-storage from the mass-storage
interface, if needed. The libusb call is
usb_detach_kernel_driver_np(). Or it can be accomplished through
usbfs directly (USBDEVFS_DISCONNECT ioctl), or through sysfs.
Note that there's no point in doing this if Barry decides that it
doesn't need to change the device's mode.
Alan Stern
-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going
mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
linux-usb-devel@xxxxxxxxxxxxxxxxxxxxx
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
[Home]
[Video for Linux]
[Photo]
[Yosemite Forum]
[Yosemite Photos]
[Video Projectors]
[PDAs]
[Hacking TiVo]
[Linux Kernel]
[Linux SCSI]
[XFree86]
[Devices]
[Big List of Linux Books]
[Free Dating]