Logo Search packages:      
Sourcecode: pcsc-lite version File versions  Download package

RESPONSECODE IFDHCreateChannelByName ( DWORD  Lun,
LPSTR  DeviceName 
)

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.

Parameters:
[in]LunLogical Unit Number
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 asociate this XXXX with the underlying details of the particular reader.
[in]DeviceNameFilename to use by the driver.
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 reader.

  • libusb

For USB drivers using libusb http://libusb.sourceforge.net/ 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.

  • libudev

If pcscd is compiled with libudev support instead of libusb (default since pcsc-lite 1.6.8) the string will look like:

  printf("usb:%04x/%04x:libudev:%d:%s", idVendor, idProduct,
            bInterfaceNumber, devpath);

bInterfaceNumber is the number of the interface on the device. It is only usefull for devices with more than one CCID interface.

devpath is the filename of the device on the file system.

So it is something like: usb:08e6/3437:libudev:0:/dev/bus/usb/008/047 under GNU/Linux.

  • other

If the driver does not understand the :libusb: or :libudev: scheme or if a new scheme is used, the driver should ignore the part it does not understand instead of failing.

The driver shall recognize the usb:VID/PID part and, only if possible, the remaining of the DeviceName field.

It is the responsibility of the driver to correctly identify the reader.

Returns:
Error codes
Return values:
IFD_SUCCESSSuccessful (IFD_SUCCESS)
IFD_COMMUNICATION_ERRORError has occurred (IFD_COMMUNICATION_ERROR)
IFD_NO_SUCH_DEVICEThe reader is no more present (IFD_NO_SUCH_DEVICE)

Referenced by IFDOpenIFD().

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index