Rework device discovery API
authorDaniel Drake <dsd@gentoo.org>
Thu, 6 Mar 2008 23:25:20 +0000 (23:25 +0000)
committerDaniel Drake <dsd@gentoo.org>
Thu, 6 Mar 2008 23:25:20 +0000 (23:25 +0000)
commit9cfdb494fccac53a4277da7c8b6d15f1a72a4959
treea6aa93d20fe9768534074b8c5792999bf45f9add
parent77cea822788e024c848c7f554915f771a2dc1e0f
Rework device discovery API

libusb_find_devices and libusb_get_devices are no more

libusb_get_device_list obtains a list of libusb_device structures for all
known devices in the system.

Each libusb_device now has a reference count, defaulting to 1 on
instantiation. The reference count of 1 refers to the fact that it is
present in the list in this scenario.

Opening a device adds a pointer to the libusb_device structure in the
handle, so that also adds a reference. Closing the device removes that
reference.

The function to free the device list can optionally unref all the devices
inside.

In future we will make the libusb_device instances all "global" so that if
the app calls get_device_list twice it actually gets the same libusb_device
structure references back. This way we can start to track disconnects, and
we can investigate adding a unique "session ID" to each libusb_device, an
identifier guaranteed to be unique to that device until reboot.
TODO
examples/dpfp.c
examples/lsusb.c
libusb/core.c
libusb/libusb.h
libusb/libusbi.h