unbit / foohid

OSX IOKit driver for implementing virtual HID devices (joypads, keyboards, mices, ...) from userspace
MIT License
265 stars 36 forks source link

Emulating USB device for SmartCardServices #14

Open frankmorgner opened 7 years ago

frankmorgner commented 7 years ago

I'm looking for a way to tell SmartCardServices(7) to load a virtual smart card reader driver. For example, /usr/local/libexec/SmartCardServices/drivers/ifd-ccid.bundle/Contents/Info.plist tells the service to load the CCID driver when a specific USB device has been recognized.

I've successfully installed the kernel extension and compiled virtual_mouse on macOS 10.12. The program works as expected, by randomly moving the position of the mouse pointer. Unfortunately, the mouse with its vendor id/product id is not recognized by SmartCardServices. I noticed that listing the system's USB devices (ioreg -p IOUSB -l -w 0) doesn't list the virtual device, either.

Do you think emulating a USB device so that the system service detects it would be possible with foohid?

unbit commented 7 years ago

Hi, HID protocol works at a different layer in respect to USB. Honestly i do not know if there is a HID standard for smartcards :(

frankmorgner commented 7 years ago

Yes, HID is not for smart cards (there is USB CCID for that). But to trigger SmartCardServices it's possible to use any physical USB device, only the vendor and product IDs need to be listed in the driver's Info.plist. For example, I've already successfully configured my driver to be started when connecting a smartphone via USB. The type of device didn't matter (mass storage in case of the phone), only the vendor and product IDs of the phone needed to match the driver's Info.plist.

So again, the question whether you know why a virtual foohid device is not listed with ioreg -p IOUSB -l -w 0)?

unbit commented 7 years ago

Because it is not a usb device or host. It register itself in the HID framework not the USB one