#include <PCSC/ifdhandler.h>
RESPONSECODE IFDHCreateChannelByName(DWORD Lun,
LPSTR deviceName);
| Lun | IN | Logical Unit Number |
| DeviceName | IN | String device path |
This function is required to open a communications channel to the port listed by DeviceName.
Once the channel is opened the reader must be in a state in which it is possible to query IFDHICCPresence() for card status.
Use this for multiple card slots or multiple readers. 0xXXXXYYYY - XXXX multiple readers, YYYY multiple slots. The resource manager will set these automatically. By default the resource manager loads a new instance of the driver so if your reader does not have more than one smart card slot then ignore the Lun in all the functions.
PC/SC supports the loading of multiple readers through one instance of the driver in which XXXX is important. XXXX identifies the unique reader in which the driver communicates to. The driver should set up an array of structures that associate this XXXX with the underlying details of the particular reader.
For drivers configured by /etc/reader.conf this is the value of the field DEVICENAME.
For USB drivers the DeviceName must start with usb:VID/PID. VID is the Vendor ID and PID is the Product ID. Both are a 4-digits hex number.
Typically the string is generated by:
printf("usb:%04x/%04x", idVendor, idProduct);
The DeviceName string may also contain a more specialised identification string. This additional information is used to differentiate between two identical readers connected at the same time. In this case the driver can't differentiate the two readers using VID and PID and must use some additional information identifying the USB port used by each readers.
For USB drivers using libusb3 for USB abstraction the DeviceName the string may be generated by:
printf("usb:%04x/%04x:libusb:%s:%s",
idVendor, idProduct,
bus->dirname, dev->filename)
So it is something like: usb:08e6/3437:libusb:001:042 under GNU/Linux.
It is the responsibility of the driver to correctly identify the reader.
| IFD_SUCCESS | Successful |
| IFD_COMMUNICATION_ERROR | Error has occurred |
| IFD_NO_SUCH_DEVICE | The reader is no more present |
Ludovic Rousseau 2008-01-18