[Pcsclite-muscle] ccid_usb.c error handling

Hendrik hendrik.donner
Sun Oct 26 12:07:18 PDT 2014


On 10/26/2014 06:05 PM, Ludovic Rousseau wrote:
> 2014-10-24 22:57 GMT+02:00 Hendrik <hendrik.donner at gmx.de>:
>> Hello,
> 
> Hello,
> 
>> i wondered about the error handling in the ReadUSB()/WriteUSB()
>> functions in ccid_usb.c.
>>
>> After the call to libusb_bulk_transfer errno is checked and
>> strerror(errno) printed to the log, resulting in confusing logs because
>> the return value of libusb_bulk_transfer might indicate an error but
>> strerror(errno) returns 'Success'.
>>
>> The libusb 1.0 API documentation does not mention that errno is set by
>> libusb_bulk_transfer, so don't use it.
>>
>> The attached patch should clean that up and is compile tested.
> 
> Thanks for the patch.
> 
> The problem is that libusb_strerror() has been introduced in "recent"
> version of libusb (libusb 1.0.16 from 2013-07-11).
> So compiling the driver with "old" Linux distributions (like Debian
> stable using libusb 1.0.11) will be problematic.
> 
> The solution would be to use #ifdef in the code. I will try to think
> about the problem again.
> 
> Bye,
> 
Hello,

libusb_error_name() could be used as an alternative and should be
availble for Debian stable and its older version of libusb.

Best regards,
Hendrik



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.alioth.debian.org/pipermail/pcsclite-muscle/attachments/20141026/cbb2a90f/attachment.sig>



More information about the pcsclite-muscle mailing list