On Sun, 8 May 2005, David Brownell wrote: > > > } else if (gadget_is_omap (gadget)) { > > > device_desc.bcdDevice = __constant_cpu_to_le16 (0x0208); > > > } else if (gadget_is_lh7a40x(gadget)) { > > > device_desc.bcdDevice = __constant_cpu_to_le16 (0x0209); > > > ... > > > } else if (gadget_is_at91(gadget)) { > > > device_desc.bcdDevice = __constant_cpu_to_le16 (0x0213); > > > > This section of code strikes me as an excellent candidate for a library > > routine, since it's reused practically verbatim in a number of gadget > > drivers. > > Yes and no. There'd still need to be code like that to detect > cases like controllers that can't handle particular protocol > features ... for example, altsettings and multiple interfaces, > without both of which CDC Ethernet can't be supported. (All > CDC devices, including ACM, need at least multiple interfaces. > Unless you prefer to ignore the standards, like Belcarra.) > > The Ethernet driver also refuses to run with drivers it doesn't > recognize, to prevent using the CDC subset with controllers > that are functional enough to support CDC Ethernet. That logic > isn't wholly amenable to a library function; but for now, it's > the only gadget driver with that sort of issue.
g_file_storage also has its own special check for controllers that can't halt bulk endpoints (right now I think SuperH is the only one). All these things are of course special-case considerations, of one sort of another. It's best just to leave them as they are. > But in general I agree: it'd make sense to have something > simple, even an inline in "gadget.h", return the 0..99 number > that our current convention associates with a given controller. That was pretty much what I had in mind too. While it wouldn't make a noticeable difference to the object code, it sure would simplify maintenance of the source. Alan Stern ------------------------------------------------------- This SF.Net email is sponsored by: NEC IT Guy Games. Get your fingers limbered up and give it your best shot. 4 great events, 4 opportunities to win big! Highest score wins.NEC IT Guy Games. Play to win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20 _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel