On 06/09/12 11:07, Hans de Goede wrote: > Hi, > > On 09/06/2012 04:35 AM, Orin Eman wrote: >> On Wed, Sep 5, 2012 at 5:00 PM, Pete Batard <p...@akeo.ie >> <mailto:p...@akeo.ie>> wrote: >> >> This is #26: https://github.com/libusbx/__libusbx/issues/26 >> <https://github.com/libusbx/libusbx/issues/26>, but doesn't include BOS/EP >> Companion. >> >> Note that the proposed patch fixes libusb_config_descriptor to use >> bMaxPower, as it is labelled in the specs, rather than MaxPower => this can >> break the compilation of existing applications. >> >> Now, the way I see it is: >> - Not many people use are likely to use the MaxPower attribute in their >> apps >> - We're not breaking linking to the library >> - The few people who use MaxPower should easily be able to figure out >> why they get a compilation error and fix it >> => I'd like to push for this change as I see it low impact, despite >> affecting the API. But I'm ready to hear good arguments against the MaxPower >> -> bMaxPower change. >> >> I also took the opportunity to update the copyright in our most public >> header, as we might as well promote libusbx there. >> >> >> >> >> I don't think you should break existing code until libusbx 2.0. I think you >> should add: >> >> #define MaxPower bMaxPower > That was my initial thought to, but MaxPower is too generic of a name to > define IMHO, I would > expect that to cause more problems then it fixes. As said few apps are > expected to use > MaxPower, and fixing those who do is easy, and they will only break at > compilation > time. So I'm with Pete here and suggest to just do the rename, with a clear > warning about > it in the ChangeLog and NEWS files.
Would it be possible to add some sort of #define into libusb.h to determine what value to use? For example the charging code in the 'Barry' project (http://repo.or.cz/w/barry.git/blob/HEAD:/tools/bcharge.cc#l182) would change from: dev->config[0].MaxPower < 250 to #ifdef LIBUSBX_USB_3_0_DESCRIPTOR_SUPPORT dev->config[0].bMaxPower < 250 #else dev->config[0].MaxPower < 250 #endif The define to use could even just be based on on version number if that was available as a #define. Without this it'd be necessary for any project wanting to query the MaxPower would have a set of limited choices: 1) Mandate that only libusbx version >= 1.0.x and not libusb is supported 2) Mandate that only libusb and not libusbx is supported 3) Add configure tests for if libusb, libusbx < 1.0.x or libusbx >= 1.0.x is around (which isn't possible for projects which don't use configure, such as Visual Studios based Windows projects) None of which are seem very desirable (to the people who develop the projects using the library). It's a shame that C doesn't support anonymous unions like C++. Regards, Toby ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ libusbx-devel mailing list libusbx-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libusbx-devel