Frank Schaefer schrieb: > Matthew Dharm schrieb: > >> On Sat, Oct 17, 2009 at 11:34:07AM -0400, Alan Stern wrote: >> >> >>> On Sat, 17 Oct 2009, Oliver Neukum wrote: >>> >>> >>> >>>> Am Samstag, 17. Oktober 2009 15:14:28 schrieb Frank Schaefer: >>>> >>>> >>>>> I can think of multiple solutions for this, my first questions are: >>>>> Is there already a common solution for these devices in the kernel ? >>>>> How widespread is this bad habit of device-design ? So far, the only >>>>> devices I know are >>>>> >>>>> >>>> This is usually handled by the modeswitch tool outside the kernel. >>>> >>>> >>> Alternatively, you may be able to force the device to switch modes by >>> running the "eject" program on it. >>> >>> There is mode-switching code in the kernel for a few devices. The >>> current trend is to move this out of the kernel and let user programs >>> be responsible for it. >>> >>> >> If you go with the current trend, then you probably will want to write some >> UDEV rules to recognize these devices and issue the mode-changing command >> (either modeswitch or eject). >> >> Matt >> >> > Thanks for your replies, I really didn't know that there are so many > devices showing this behavior. > > On Windows, AVM does the fast-eject for its devices with a small > filter-driver avmeject.sys. > I will try to find out the "magic sequence" needed for the mode-switch > with a USB-logger. > > Regards, > Frank > I finally found the "magic" sequence. In the meantime I've been thinking a lot (too much ?) about HOW and WHERE to do the mode-switching. The mailing-list-archieves were really inspiring, maybe you remember the discussion about Tejun Heos' patches in april 2008. The conclusion was that there is no clearly preferable way to do this and that compromises are inevitable. The attached patch adds the mode-switching-procedure to the WLAN-driver (ar9170usb) and disables the storage device in the usb-storage-driver. I really think the mode-switching should be done in the kernel and not in user-space for reasons of usability. Doing it in the driver means putting the code for these device together in a single place. It also doesn't "pollute" the driver with much code (adds a single usb_bulk_msg()). Another benfit is that it binds the mode-switching to the driver. If the driver is blacklisted/not used, there will be no mode-switching. If there would be a way to keep the usb-storage-driver enabled as "fallback-driver" it would be an almost perfect solution... Regards, Frank
Attachment:
0001-ar9170usb-add-mode-switching-for-AVM-Fritz-WLAN-USB.patch
Description: application/mbox