|
From: Adam K. <akr...@ro...> - 2007-06-11 15:38:23
|
On Mon, Jun 11, 2007 at 03:47:31PM +0100, Dave Higton wrote: > > -----Original Message----- > > From: lib...@li... > > [mailto:lib...@li...] On > > Behalf Of Adam Kropelin > > Sent: 2007 June 11 15:43 > > To: lib...@li... > > Subject: Re: [Libusb-win32-devel] Everything but > > usb_bulk_read works... > > > > On Mon, Jun 11, 2007 at 03:23:38PM +0100, Dave Higton wrote: > > > > > > Error 22 is an invalid parameter. Input endpoint addresses > > > have to have the top bit set - this is incompatible with the > > > Linux version. > > > > It's not incompatible at all. Not setting that bit is a bug on any > > platform. It just so happens that Linux lets you get away with it. > > It depends on your POV. When you talk to somebody, do you refer to > endpoint 0x81 or endpoint 1? I refer to 1, and I bet you do too. > Linux has explicit code to set the top bit so that either is equally > valid. There is an argument to made for the API to be forgiving; you're performing a read, so obviously you must have meant to provide an input endpoint address. Since you didn't, the library will fix it up for you. That type of API makes me uncomfortable; I don't like an API that thinks it knows more about what I want to do than me...but some people like to program that way. There's also an argument to be made for consistency; not every API call can easily do such a fixup for you. See usb_resetep(), for example. That one is even explicitly documented. Personally I prefer consistency and exactness: Supply the actual endpoint address, as specified in bEndpointAddress. Since we have to do that for some API calls already, its best to do it for all of them. --Adam |