[Pcsclite-muscle] ccid_usb.c error handling

Ludovic Rousseau ludovic.rousseau at gmail.com
Tue Nov 4 09:26:43 UTC 2014


2014-10-26 20:07 GMT+01:00 Hendrik <hendrik.donner at gmx.de>:
> 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.

Fixed in revision 7023.
http://lists.alioth.debian.org/pipermail/pcsclite-cvs-commit/2014-November/006578.html

Thanks

-- 
 Dr. Ludovic Rousseau



More information about the Pcsclite-muscle mailing list