[fprint] Hotpluggable devices
Daniel Drake
dan at reactivated.net
Fri May 23 13:41:21 BST 2008
Bastien Nocera wrote:
> Heya,
>
> I'm thinking of the way we could handle hotpluggable devices in fprintd.
>
> - Make libfprint export an FDI file that tells us all the fingerprint
> reader devices it supports (adding an internal function giving us back a
> struct containing that)
Would be nice if we could generate it at compile time instead, but the
idea sounds OK. I think you mentioned this was a requirement during our
earlier discussions anyway, so that HAL knows which USB devices are
supported fingerprint readers.
> - Monitor hal inside fprintd, and get told when fingerprint devices are
> added/removed (graceful failure when removed and in use, make sure that
> libusb re-reads the full list of usb devices when
> libusb_get_device_list() is called)
Yes, libusb re-enumerates the buses. It should also handle disconnected
devices OK, but not sure how libfprint deals with that right now.
> - internally, IDs for devices should be gathered from their position on
> the usb bus, rather than just incrementing (that would mean the path to
> the devices would stay constant across runs, rather than being
> reordered). We'd need to modify libfprint to give that to us from
> libusb.
This is more tricky, since USB bus topology can completely change in a
flash. There have been some recent discussions on the libusb mailing
list about this
> - DeviceAdded/DeviceRemoved in the manager (path to the object in the
> signals)
>
> What do you think?
It sounds like it would work, but the correct solution would be to have
libusb provide the backing for this functionality. libusb would offer a
callback mechanism to inform library users when USB devices are
connected or disconnected. libfprint would bubble up this interface (for
recognised devices only) to library users like fprintd.
I'm planning this for libusb-1.1. I am planning to use HAL for device
notifications, and maybe offer some lightweight options for embedded
systems too. I hope that libusb-1.1 isn't too far off in the future -
1.0 is soon to enter beta, and 1.1 will be a fairly small incremental
release (only planned features right now are some internal cleanups and
device hotplug)
Is hotpluggable device notifications a high priority requirement? Right
now we do only get the device list at fprintd startup, but how about if
we obtained the device list in fprint_manager_get_devices()?
Daniel
More information about the fprint
mailing list