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

Wiktor Kwapisiewicz wiktor at metacode.biz
Thu May 19 04:56:48 PDT 2022


I'm trying to use pcsclite on Android (via Termux) and found out that 
the Android OS exposes USB devices via file descriptors (instead of 
regular files). It seems libusb can interact via these devices using two 
functions introduced in 2018 [0]:

     libusb_set_option(NULL, LIBUSB_OPTION_WEAK_AUTHORITY);
     // ...
     libusb_wrap_sys_device(context, (intptr_t) fd, &handle);

Example from [1]. The option name is also called 
LIBUSB_OPTION_NO_DEVICE_DISCOVERY in newer versions of libusb [2].

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?

The use-case I have in mind is using SSH and signing commits on Android 
phones. I'm already using pcsc-lite through openpgp-card crate for SSH 
and commit signing on my desktop and it works very well and I'm trying 
to replicate the setup on my tablet/phone.

Thank you for your time and have a nice day!

Kind regards,

[0]: https://sourceforge.net/p/libusb/mailman/message/36486446/

[1]: https://wiki.termux.com/wiki/Termux-usb

[2]: https://libusb.sourceforge.io/api-1.0/group__libusb__lib.html

[3]: https://crates.io/crates/openpgp-card

More information about the pcsclite-muscle mailing list