2009/11/19 Ludovic Rousseau <ludovic.rouss...@gmail.com>:
> 2009/11/18 Martin Preuss <aquaman...@gmx.de>:
>> Right, but for the driver to understand a HAL-device name (e.g. name
>> containing ":libhal:" it needs to be able to map the given name to a specific
>> device (well, at least when there is more than one reader in the system).
>
> Exact. My CCID does that for the libusb scheme but not yet for the
> libhal scheme.

I thought a bit about this problem: pcscd finds a new device and needs
to tell the driver which device it is.

The "libusb:" scheme uses a device path name specific to libusb.

  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.

The bus->dirname and dev->filename are internals for libusb. Not very
portable outside of libusb.

With "libhal:" scheme it is even worse. The path name is something
like 
"usb:08e6/3437:libhal:/org/freedesktop/Hal/devices/usb_device_8e6_3437_noserial_if0".
My CCID driver only uses the interface number stored in the "_if0"
part at the end of the path name.

Why not "open" the device in pcscd and pass to the driver a handle to
the opened device? The handle could be a file descriptor or something
more complex like a "libusb_device *".

That way you can be sure that the device detected by pcscd is the one
used by the driver.
No need to rescan the USB bus to find it again.
No mixing problem if two identical devices are connected at the same time.

Do anybody you see a problem with that idea?

Thanks,

-- 
 Dr. Ludovic Rousseau
_______________________________________________
Muscle mailing list
Muscle@lists.musclecard.com
http://lists.drizzle.com/mailman/listinfo/muscle

Reply via email to