Some Linux experiments with the ACR38 smartcards reader

Trying to read smartcards using only libusb. For fun and learning.

Nom :

15 mars 2007

Digging the sources : bel-eid-fr-linux.tar.gz

It is time to have a look at the sources. First, the sources from the government : bel-eid-fr-linux.tar.gz

(the site also mentions 'PC/SC Lite v1.2'...)

Let see if it uses libusb


$ cd bel-eid-fr-linux
$ find . -exec grep usb_open \{} \; -a -print
$

no.
The code uses opendir("/proc/bus/usb") to find the 072f:9000 device in ./Etape_1/ACR38_LINUX_100706_P/src/driver/usblinux.c (via usbserial_linux.c)

in usbserial_linux.c, one finds :
- OpenUSB()
- ReadUSB()
- WriteUSB()
- CloseUSB()
they call functions defined in usblinux.c :
- open_linux_usb_dev() does the opendir() and open a file in /proc/bus/usb/...
- control_linux_usb_dev() does an ioctl(IOCTL_USB_CTL)
- bulk_linux_usb_dev() does an ioctl(IOCTL_USB_BULK) to implement reads/writes

OpenUSB() is used in ./Etape_1/ACR38_LINUX_100706_P/src/driver/AdmHndlr.c where one finds an
- Adm_Transmit() that does a WriteUSB() followed by a ReadUSB()
and a lot of dialog functions with the card reader. It is in this file that one will find the values to use to initialize the beast. :-)