summaryrefslogtreecommitdiff
path: root/libusb/libusbi.h
Commit message (Collapse)AuthorAgeFilesLines
* renamed windows_compat to poll_windowsPete Batard2010-03-021-2/+2
|
* includes simplification and cleanup (core)Pete Batard2010-02-241-1/+0
|
* merge abstraction for POSIX Threads and integration changes (Michael Plante, ↵r169Pete Batard2010-02-241-41/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Peter Stuge) v1.0.6 release Darwin: support multiple calls to libusb_init Credit to Orin Eman for finding this bug. Darwin: use logging functions Use usbi_warn, usbi_err, and usbi_info instead of _usbi_log. Darwin: fix memory leak in process_device Credit to Mike Colagrosso for finding this bug. Add internal abstraction for POSIX Threads This prepares for a Windows backend without dependency on pthreads-w32. pthread_* is renamed to usbi_* and PTHREAD_* to USBI_*. A usbi_mutex_static_t and usbi_mutex_static_lock() and _unlock() are introduced for statically initialized mutexes, since they may be implemented using other types when pthreads mutexes aren't used. Move -pthread from libusb/Makefile.am to host-specific AM_CFLAGS in configure.ac. AM_CFLAGS is already used in Makefile.am. (Numerous merge conflicts resolved by Michael Plante) misc fixes to pthreads abstraction * windows_compat.h should not be directly included (use libusbi.h) * windows_usb.c still had some references to pthread_mutex_[un]lock Add libusb_strerror() to get short error message in English from enum (Merge conflicts resolved by Michael Plante) Better cleanup on errors, stricter types and some good casts Avoid various memory leaks in error code paths and remove warnings. Also add usbi_cond_destroy in os/threads_posix.h because it's used for cleanup now. (Merge conflicts resolved by Michael Plante) Rename all interface parameters to usb_interface or interface_number (Merge conflicts resolved by Michael Plante) Add type parameter to the list_for_each_entry() and _safe() macros (Merge conflicts resolved by Michael Plante) VA_ARGS workaround for logging with MSVC6 (Merge conflicts resolved by Michael Plante) Fix context memory leak in libusb_init() * Now holds default_context_lock for duration of libusb_init * Doesn't allocate it if not needed Fix the last MSVC /W3 warning removal of pthreads from MSVC and mingw * removed pthread*.lib from linking in msvc6 (2005/8 not yet edited) * added threads_windows.[ch] to all project files in msvc6 * added usbi_cond_signal to both threading versions, unused * added native windows threading code, now used removed redundant time.h includes removed pthread-win32 informational solution files updated MSVC 2005/2008 for thread abstraction fixed DDK build fixed cygwin's use of POSIX threads fixed dpfp/dpfp_threaded for MinGW compatibility config_msvc.h -> msvc/config.h pthread abstraction for DLL project files fixed bad reference to thread_windows in 2005 DLL vcproj cygwin ifdef is not required in threads_windows.h - removed fixed residuals from previous patches moved thread source detection into autotool scripts
* r131: fixed various /W4 warnings for MSVC (core files)r131Pete Batard2010-02-011-1/+1
|
* r80: workaround for interface macro redefinition on Windows (removes the ↵Pete Batard2010-01-151-3/+3
| | | | need for #undef interface in end user sources)
* Fix CR/LF inconsistenciesPete Batard2010-01-141-3/+3
|
* svn r59: - MSVC6 fixes for variadic log macros (Michael Plante)Pete Batard2010-01-141-2/+43
|
* svn r54: - fixes missing config_msvc.hPete Batard2010-01-141-18/+22
|
* svn r29:Pete Batard2010-01-141-3/+4
| | | | | - "poll we can believe in" (requires superficial modifications to core files) - move the "interface" fix into windows_compat.h
* svn r4: revert back to using interface for variable names as in master branchPete Batard2010-01-141-6/+6
|
* mirror libusb-winusb git branch from 2009.12.03 part 2 - core filesPete Batard2010-01-141-6/+11
|
* Use timerfd for timeout handlingDaniel Drake2009-11-071-3/+20
| | | | | | | | | | | | Use a new file descriptor from the timerfd system calls to handle timeouts. On supported systems, this means that there is less hassle figuring out when the poll() timeout should be, since libusb_get_next_timeout() will always return 0 and the timeout events will be triggered as regular activity on the file descriptor set. Add API function libusb_pollfds_handle_timeouts() to detect whether you're on a platform with the timing headache, and flesh out the surrounding documentation.
* Transfer lockingDaniel Drake2009-11-061-0/+13
| | | | | | | | | | | | At least on Linux, there were some possible races that could occur if a transfer is cancelled from one thread while another thread is handling an event for that transfer, or for if a transfer completes while it is still being submitted from another thread, etc. On the global level, transfers could be submitted and cancelled at the same time. Fix those issues with transfer-level locks.
* Darwin backendNathan Hjelm2009-02-161-0/+1
|
* Abstract clock reading into OS layerNathan Hjelm2009-02-161-0/+15
| | | | | | This will differ on Linux and Darwin, at least. [dsd: minor style tweaks]
* Pause event handling while opening and closing devicesDaniel Drake2008-11-211-2/+12
| | | | | | | | | | | | | | | Ludovic Rousseau found that crashes often occur if you close a device while another thread is doing event handling. Fix this by adding an internal control pipe, which the close routines use to interrupt the event handler and obtain the event handling lock, ensuring that no other thread is handling events while the device is closed. After the close completes, it signals all the event handlers to start up again using the usual mechanism. Also modified libusb_open() to do a similar thing, so that event handlers are interrupted in order to realise that a new poll fd has appeared.
* Add libusb_attach_kernel_driver()Bastien Nocera2008-11-031-0/+17
| | | | | | Add support for re-attaching a driver to a device under Linux. [dsd: fixed handling of return value, and added LIBUSB_ERROR_BUSY case]
* Allow user data pointer to be passed through pollfd notification APIDaniel Drake2008-06-261-0/+1
|
* Introduce contexts to the APIDaniel Drake2008-06-261-18/+70
| | | | | Suggested by David Zeuthen. This allows multiple libraries in the same process to independently use libusb without interfering.
* Refine libusb_set_configuration() semanticsDaniel Drake2008-05-291-0/+19
| | | | | | | | | | | | | Applications will generally want to set a configuration before claiming interfaces. The problem is that the interface may already be set, and someone else may have claimed an interface (meaning that all calls to set_configuration will fail, even if it's for the same configuration). There are now 2 options: 1. Use the new libusb_get_configuration() to determine active configuration before calling libusb_set_configuration() 2. Or just call libusb_set_configuration() as usual, which will do nothing if that configuration is already active.
* Fix endianness with descriptor handlingDaniel Drake2008-05-161-4/+18
| | | | | Alan Stern pointed out that usbfs gives host-endian data, but sysfs gives bus-endian.
* Backend documentation for porting effortsDaniel Drake2008-05-131-6/+341
| | | | Hopefully comprehensive enough for people to get started.
* Handle hot-unpluggingDaniel Drake2008-05-111-2/+4
| | | | | This involved moving from select() to poll() because there is no way to distinguish usbfs's POLLERR condition with select().
* Endianness of control setup packetsDaniel Drake2008-05-111-12/+0
| | | | | | | | Document behaviour where host-endian and bus-endian (little) should be used respectively. Also remove packed attribute from libusb_control_setup as all fields are naturally aligned.
* Linux: fix caching of active configuration for non-sysfsDaniel Drake2008-05-101-0/+2
|
* Fetch configurations by index (not value)Daniel Drake2008-05-101-2/+3
| | | | Otherwise there is no way to know which values to look for.
* Rework configuration handlingDaniel Drake2008-05-091-11/+6
| | | | | | 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.
* move descriptor parsing into main libraryDaniel Drake2008-05-051-0/+8
| | | | | OS modules now provide functionality for fetching device/config descriptors
* add functionality for querying and detaching kernel driverDaniel Drake2008-05-041-0/+6
|
* implement libusb_reset_device()Daniel Drake2008-05-041-0/+1
|
* Add functionality to clear endpoint halt conditionsDaniel Drake2008-05-041-0/+2
|
* Add libusb_set_configuration()Daniel Drake2008-05-031-0/+2
|
* Allow multiple interfaces to be claimedDaniel Drake2008-05-021-0/+4
|
* Expose bus number and device addressDaniel Drake2008-05-021-0/+3
|
* Fix descriptor handling memory leaksDaniel Drake2008-04-291-0/+1
|
* Remove libusb_cancel_transfer_syncDaniel Drake2008-04-291-2/+1
| | | | | This wasn't a particularly nice API. Cancellation should be handled by the completion handler.
* libusb_device mutex protectionDaniel Drake2008-04-181-1/+5
|
* mutex protection for device and handle listsDaniel Drake2008-04-181-0/+2
|
* Linux: fire multiple URBs at once for split transfersDaniel Drake2008-04-111-0/+2
| | | | | | | | | | | This results in a significant performance increase for bulk transfers larger than 16kb, and fixes a bug where data would be spliced and mixed between two simultaneously submitted transfers to the same endpoint. It also allows isochronous transfers larger than 16kb to be submitted. This commit also improves cancellation - the library now understands what is going on.
* Isochronous endpoint I/ODaniel Drake2008-03-301-5/+32
| | | | | | | | | Due to variable-sized structures, this involved changing allocation mechanism. All transfers must now be allocated and freed through libusb. A synchronous function is missing, and I could do with writing a few more helper functions to simplify things.
* Support for changing altsettingDaniel Drake2008-03-231-0/+3
| | | | Will probably be suject to later consideration w.r.t. claiming of endpoints
* Fix get_device_list for realloc caseVasily Khoruzhick2008-03-151-1/+1
| | | | | | | get_device_list can modify pointer passed to it with realloc, but this case wasn't handled and caused crash on my machine. Fixed Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
* Beginnings of cross-platform abstractionDaniel Drake2008-03-131-8/+77
| | | | This also includes a libusb_get_pollfds API change
* Rename descriptor-getting functionsDaniel Drake2008-03-091-1/+1
| | | | Based on feedback from Tim Roberts
* Rename libusb_dev_handle to libusb_device_handleDaniel Drake2008-03-091-1/+1
|
* Separate transfer allocation and submissionDaniel Drake2008-03-091-15/+5
| | | | | | | | | | Leads to some hefty API changes. Now we're much more similar to the Linux kernel model. Problems with dealing with asynchronous control transfers are passed on to the user, basically you must allocate a buffer, start with the setup, and put the data after. This won't make much sense until documented (soon...)
* Rework URB API namingDaniel Drake2008-03-081-7/+7
| | | | | | | Now refer to everything as "transfers" as consistent with the USB spec libusb_transfer is now a kind of transfer handle. To reduce confusion with libusb_bulk_transfer and libusb_control_transfer, those have been renamed to libusb_{control,bulk}_transfer_request.
* Add fallback on /proc/bus/usbDaniel Drake2008-03-081-1/+0
| | | | | /dev/bus/usb is a relatively new thing probably not present on every system
* Persistent libusb_device storageDaniel Drake2008-03-081-0/+2
| | | | | | | | 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.
* Rework device discovery APIDaniel Drake2008-03-061-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | 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.