Commit graph

14 commits

Author SHA1 Message Date
Ludovic Rousseau
8392ff2213 lsusb example: make print_devs() static
lsusb.c:26: warning: no previous prototype for ‘print_devs’
2009-11-21 17:12:17 +00:00
Daniel Drake
1df713d622 Introduce contexts to the API
Suggested by David Zeuthen. This allows multiple libraries in the same
process to independently use libusb without interfering.
2008-06-26 22:42:59 -05:00
Daniel Drake
fe4adcc99e Rework configuration handling
libusb no longer caches descriptors in libusb_device but backends are
intended to be able to provide copies from memory. In the common linux
case we can use sysfs.
2008-05-09 19:33:33 +01:00
Daniel Drake
5741bfe01a libusb_get_device_list() can return negative error code 2008-05-09 14:36:14 +01:00
Daniel Drake
5878daa85e Fix libusb_get_device_list return value
It was documented to return the list length, but was returning 0.
2008-05-04 00:51:59 +01:00
Daniel Drake
3675e978fb Expose bus number and device address 2008-05-02 12:28:31 +01:00
Daniel Drake
d9b2ce2894 Constify some return data
Make it clear that apps should not mess with these structures
2008-04-01 23:30:49 +01:00
Daniel Drake
9e89d1aa82 Rename descriptor-getting functions
Based on feedback from Tim Roberts
2008-03-09 16:27:42 +00:00
Daniel Drake
f3fdf44791 Persistent libusb_device storage
Devices are now assigned a session ID (currently busnum:devaddr) which
is used to distinguish unique devices.

Now multiple callers of libusb_get_device_list will get the same
libusb_device structure instances.
2008-03-08 12:58:29 +00:00
Daniel Drake
9cfdb494fc 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.
2008-03-06 23:25:20 +00:00
Daniel Drake
637a8d7ff8 Remove timers and signalfd
Instead of timers, add a mechanism for informing the parent app when the
next timeout is due to happen, so that it can call us at that time.

As we no longer use signals, signalfd has also been removed.
2008-01-30 13:19:10 +00:00
Daniel Drake
dbb3fd871e API renaming: remove fpi and usb_ stuff
fpi changed to usbi.

We should not expose structures with prefix "usb_" in the public
namespace as it is quite likely there will be some conflict somewhere.
Instead, using "libusb_" should be safer.
2008-01-04 00:54:57 +00:00
Daniel Drake
e9364d7215 Rename to libusb-1.0
I've taken over the libusb project, and what was previously known as fpusb
will eventually be released as libusb-1.0.
2008-01-04 00:40:49 +00:00
Daniel Drake
852bba4754 Initial commit
Basic library structure which supports enumerating detected USB devices
2007-12-02 22:54:59 +00:00