On Wed, May 03, 2006 at 11:04:19AM -0400, Alan Stern wrote: > On Tue, 2 May 2006, Glenn Maynard wrote: > > > > So, why won't we simply encode the knowledge about things which > > > are safe for ub in a monstrous if-if-if statement? I considered > > > this, but found it a) not safe enough, b) clumsy, c) redundant. > > > > I guess it seems more clumsy and redundant to me to do it by hand, > > maintaining several dozen extra flags, rather than a bit of code. > > But, I don't fully understand the interaction between libusual and > > unusual_devs, so I'm sure you're right. > > I wouldn't be just a _bit_ of code. The code would have to include all > the information that's in the table -- which means it would end up being > larger than the table is. Not to mention more error prone, because it > would mix up a lot of C stuff along with the table information, thus > making it more difficult to separate the general logic from the > device-specific flags.
I think all I was visualizing was eg: int get_us_type(const struct us_data *us) { // flags that don't indicate that a device won't work with UB: int permitted_flags = US_FL_FIX_CAPACITY; if((us->flags & ~permitted_flags) != 0) return USB_US_TYPE_STOR; if(us->unusual_dev->initFunction != NULL) return USB_US_TYPE_STOR; return 0; } used by usb_usual_check_type. Aside from the obvious problem that us_data is usb-storage's, not libusual's--would need a copy of us_unusual_dev_list[]-- this is also incorrect, since I don't fully understand the criteria for the flag. But that's the sort of thing I was thinking--not anything enormous. -- Glenn Maynard ------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel