[Pcsclite-muscle] Support for file-descriptor based devices in pcsclite

Ludovic Rousseau ludovic.rousseau at gmail.com
Wed Jun 8 08:29:44 PDT 2022


Hello Viktor,

Any progress? :-)

Le jeu. 26 mai 2022 à 11:24, Wiktor Kwapisiewicz <wiktor at metacode.biz> a écrit :
>
> Hi,
>
> On 26.05.2022 11:13, Ludovic Rousseau wrote:
> > Sorry for the delay. Your email was in my spam folder (gmail).
>
> No worries, great to hear back from you!
>
> >> I did compile several small examples using libusb and
> >> libusb_wrap_sys_device and they worked fine with my tokens (Yubikeys).
> >> Now my question is whether support for
> >> LIBUSB_OPTION_WEAK_AUTHORITY/libusb_wrap_sys_device is something that
> >> could be considered for inclusion in pcsclite or is this out of scope?
> >
> > Yes, I could consider something like that.
> >
> > In fact I already have 2 issues opened for pcsc-lite and CCID with this idea.
> > "Open the device in pcscd and give the file descriptor to the driver"
> > https://salsa.debian.org/rousseau/PCSC/-/issues/20
> >
> > "Use libusb_wrap_sys_device() and avoid rescanning the USB bus"
> > https://salsa.debian.org/rousseau/CCID/-/issues/11
>
> Oh, I must've missed that issue tracker. I'll read them thoroughly.
>
> > This scheme could also be used on a "normal" computer and not only for Android.
>
> That'd be great for development too.
>
> > I am waiting for your first patches.
> > Good idea.
>
> Thanks for the ack! It may take some time as I'm not familiar with the
> codebase but I hope I can ping this mailing list in case I have
> questions/problems.

I propose to add a new function in the IFD Handler API.
https://pcsclite.apdu.fr/api/group__IFDHandler.html

Something like:
IFDHCreateChannelByFd(DWORD Lun, int FileDescriptor)

Then you can use libusb_get_device() to get a libusb device structure
from the file descriptor.
I expect some code refactoring in CCID src/ccid_usb.c to avoid
duplicating a large part of OpenUSBByName()

Bye

-- 
 Dr. Ludovic Rousseau



More information about the pcsclite-muscle mailing list