lib: fixed TranslateErrcode behaviour and API assumptions
commit6f2929fcee3247275a54170514b9f61a28797267
authorChris Frey <cdfrey@foursquare.net>
Fri, 11 Nov 2011 01:42:46 +0000 (10 20:42 -0500)
committerChris Frey <cdfrey@foursquare.net>
Fri, 11 Nov 2011 01:48:06 +0000 (10 20:48 -0500)
tree8ee80a54a9fd01b0258d4c307f60e1503fb2271e
parent29a96c61c7b149894cf1f5c968ffeabef599cf7d
lib: fixed TranslateErrcode behaviour and API assumptions

Since it is not possible to directly translate every libusb error code
into a system error code, and since we go to pains to keep track of
the low level error code, there should be no need to hack in a fake
system error code if the API is correct.

Therefore, this patch changes the usb wrapper Init() call to return
true/false for success, instead of an error code, and allows the user
to pass in a pointer if he really needs to know the low level libusb
error code.

Exceptions (Usb::Error(int, msg)) still maintain the libusb/system error
code split, and still return 0 if unable to translate properly.
src/common.cc
src/usbwrap.h
src/usbwrap_libusb.cc
src/usbwrap_libusb_1_0.cc