aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* fix build on linuxcm-11.0kenshin2018-06-181-3/+5
| | | | Change-Id: If8bcf74c828302b4f9bb90b1641579c5fd046c44
* fixes for building windowscm-11.0-XNPH44S-bacon-5fa8c79c0bcm-11.0-XNPH33R-bacon-3628510d76cm-11.0-XNPH30O-bacon-4f280f505acm-11.0-XNPH25R-bacon-d22b777afacm-11.0-XNPH22R-bacon-03d77315eacm-11.0-XNPH05Q-tomato-9828f8e9cccm-11.0-XNPH05Q-bacon-5229c4ef56cm-10.2.1cm-10.2.0cm-10.2-M1staging/cm-12.0-cafstable/cm-11.0-XNG3Cstable/cm-11.0-XNG2Sstable/cm-11.0-XNF9Xstable/cm-11.0-XNF8Ystable/cm-11.0stable/cm-10.2shipping/cm-11.0cm-10.2Koushik Dutta2013-08-142-19/+22
| | | | Change-Id: I4c26d86e57c6373c23a9908104f11119dfc467da
* Fixes for libusbx on AOSP.Koushik Dutta2013-08-143-1/+221
|
* Windows: Fix a cast warning when compiling for x64 in VSPete Batard2013-08-133-4/+4
| | | | * Also fixes and closes #129 again
* Windows: Fix VS2010 project filesPete Batard2013-08-122-2/+2
| | | | * Closes #129
* Android: Add examples and stress testsToby Gray2013-08-116-51/+250
|
* Android: Add formal Android supportToby Gray2013-08-117-27/+216
| | | | * Also fix an issue with LIBUSB_LOG_LEVEL_NONE
* Core: Add compile time option to use native OS logging facilityToby Gray2013-08-094-11/+56
| | | | | | | | | | * This change makes it easier to debug issues in UI applications which don't necessarily have a console connected to stderr. * Outputting to the debugger shouldn't occur in normal situations so this change has to be explicitly enabled by a build-time config flag. * Uses OutputDebugString() on Windows platforms or the syslog facility on other OSes, if available. * Also align the report of configure defaults to autotool's.
* linux: ensure the netlink socket is correctly opened with older Linux kernelsNathan Hjelm2013-08-072-7/+31
| | | | | | It is possible for the extra socket flags (available from 2.6.27 on) to be defined but not available. Check for this case and set the flags correctly on the netlink socket.
* Core: Fix potential segfault caused by using freed memoryChris Dickens2013-08-071-1/+2
| | | | | | | | When a transfer is submitted, the device is referenced in libusb_submit_transfer() and unreferenced in usbi_handle_transfer_completion(). This transfer could potentially be freed by any user callback, or is freed by libusb if LIBUSB_TRANSFER_FREE_TRANSFER is set in the flags. The call to unreference the device uses this potentially freed memory. Reading the device handle beforehand will prevent this disaster.
* Windows: Fix race between windows_clock_gettime_threaded() and ↵Simon Haggett2013-08-082-2/+13
| | | | | | | | | | | | | | windows_clock_gettime() * When the timer thread is created in windows_init(), it performs an initialisation phase in which it uses QueryPerformanceFrequency() to determine if there is a high resolution timer available, and sets hires_frequency and hires_ticks_to_ps appropriately. However, since windows_init() does not wait for this initialisation phase to complete, windows_clock_gettime() can be called before hires_frequency and hires_ticks_to_ps have been updated. This can result in windows_clock_gettime() temporarily returning real-time clock values even though the platform supports a monotonic clock. * See http://sourceforge.net/mailarchive/forum.php?thread_name=1373620013-3574-1-git-send-email-simon.haggett%40realvnc.com&forum_name=libusbx-devel
* WinCE: Fix race between wince_clock_gettime_threaded() and wince_clock_gettime()Simon Haggett2013-08-082-2/+13
| | | | | | | | | | | | * When the timer thread is created in wince_init(), it performs an initialisation phase in which it uses QueryPerformanceFrequency() to determine if there is a high resolution timer available, and sets hires_frequency and hires_ticks_to_ps appropriately. However, since wince_init() does not wait for this initialisation phase to complete, wince_clock_gettime() can be called before hires_frequency and hires_ticks_to_ps have been updated. This can result in wince_clock_gettime() temporarily returning real-time clock values even though the platform supports a monotonic clock. * See http://sourceforge.net/mailarchive/forum.php?thread_name=1373619997-3535-1-git-send-email-simon.haggett%40realvnc.com&forum_name=libusbx-devel
* Windows: fd_to_winfd() shouldn't treat fd 0 as invalidSimon Haggett2013-08-081-1/+1
| | | | | | | | | * fd_to_winfd() currently returns INVALID_WINFD if fd is 0, but usbi_create_fd() can legally assign an fd number of 0 if poll_fd[0] is not already occupied. * Transfers which are assigned an fd number of 0 for their event handle are then unable to have their event handle retrieved later on. See http://libusbx.1081486.n5.nabble.com/Libusbx-devel-PATCH-1-1-Windows-fd-to-winfd-shouldn-t-treat-fd-0-as-invalid-tt1535.html
* README: Add OS X specific notesSean McBride2013-08-022-1/+13
| | | | | Xcode 4.3 do not provide autotools anymore. libusbx now provides a Xcode project to ease build Mac OS X.
* Core: correctly check usbi_read() returned valueChris Dickens2013-08-022-3/+3
| | | | | | | | | For messages received on the hotplug pipe, the message was read via usbi_read() (ssize_t) and compared against the size of the message struct (size_t). usbi_read() returns -1 on an error condition, so some systems can cast the ssize_t to size_t for the comparison, making it equal to SIZE_MAX and causing the error check condition to incorrectly evaluate to false.
* Core: defensive programmingSean McBride2013-08-022-3/+5
| | | | | | | | | | | | | | Defensively set return-by-reference value to -1 in error condition NB: The comments do not match the implementation. Comments: "[return] the index of the configuration matching a specific bConfigurationValue in the idx output parameter, or -1 if the config was not found" There is a code path where idx is never touched. Perhaps clients of the function are careful to only read idx if the return value is success, but also setting idx to -1 is much safer.
* darwin: fix clang warnings about explicit conversionhjelmn2013-07-302-4/+4
| | | | | | There shouldn't be any problems with any supported version of OSX in converting a UInt64 to an unsigned long. They should be the same size but even if they are not the session should still be unique.
* fixed link errors by adding missing files to Xcode projectSean McBride2013-07-302-1/+17
|
* made some globals static to fix warningsSean McBride2013-07-304-10/+10
|
* fixed some clang -Wdocumentation warnings from bad doxygen markupSean McBride2013-07-303-4/+4
|
* fixed compiler warning about possible uninitialized use by zero initializingSean McBride2013-07-302-2/+3
|
* make targets for examples depend on library target. Generate library named ↵Sean McBride2013-07-308-52/+288
| | | | | | | libusb-1.0.0.dylib not libusbx.dylib. Added several xcconfig files to make source control and documentation easier. Reorganised a few files' positions within the project. Disable strict aliasing since libusbx breaks strict aliasing rules anyway. Set project format as 3.1-compatible. Conflicts: Xcode/libusbx.xcodeproj/project.pbxproj
* Xcode: build for 32 and 64 bitsLudovic Rousseau2013-07-302-1/+3
|
* Xcode: remove implicit/default configurationLudovic Rousseau2013-07-302-20/+1
|
* Add minimal config.h for XcodeLudovic Rousseau2013-07-302-1/+29
| | | | | | Xcode do not use ./configure so the config.h file needs to be generated by hand. This config.h is the minimal file for libusbx built using Xcode.
* Adapt Xcode project to the new pathsLudovic Rousseau2013-07-302-3/+5
|
* Move Xcode project in Xcode/ directoryLudovic Rousseau2013-07-302-1/+1
| | | | | This is to use Xcode special config.h file in a independent directory. The same is already done for MS Visual C with msvc/ directory.
* Xcode projectLudovic Rousseau2013-07-302-1/+789
|
* linux_netlink: Remove use of pthread_cancelHans de Goede2013-07-302-15/+45
| | | | | | | | | Using pthread_cancel() presents the opportunity for deadlock, so use a control pipe to cause the event thread to gracefully exit. Inspired on the identical patch for linux_udev from Chris Dickens. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* linux_netlink: close netlink socket on init errorHans de Goede2013-07-302-1/+3
| | | | Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* hotplug: Remove use of pthread_cancel from linux_udevChris Dickens2013-07-302-16/+49
| | | | | | | Using pthread_cancel() presents the opportunity for deadlock, so use a control pipe to cause the event thread to gracefully exit. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* linux: Use a separate lock to serialize start/stop vs hotplug eventsHans de Goede2013-07-302-8/+18
| | | | | | | | | | | | | | | Using one lock for this is a bad idea, as we should not be holding any locks used by the hotplug thread when trying to stop otherwise the stop function may wait indefinetely in pthread_join, while the event-thread is waiting for the lock the caller of the stop function holds. Using 2 separate locks for this should fix this deadlock, which has been reported here: https://bugzilla.redhat.com/show_bug.cgi?id=985484 Many thanks to Chris Dickens for figuring out the cause of this deadlock! CC: Chris Dickens <christopher.a.dickens@gmail.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* work around Linux systems that don't provide SOCK_CLOEXEC or SOCK_NONBLOCKhjelmn2013-07-302-2/+17
| | | | | | | | These options were added in 2.6.27 and are not available on all kernels that support netlink. Set these options using fcntl when SOCK_CLOEXEC and SOCK_NONBLOCK are not available. Closes #124.
* fix warnings in linux_get_device_addresshjelmn2013-07-302-9/+17
| | | | | | | | | | Warnings: os/linux_usbfs.c: In function 'linux_get_device_address': os/linux_usbfs.c:620: warning: comparison is always false due to limited range of data type os/linux_usbfs.c:624: warning: comparison is always false due to limited range of data type os/linux_usbfs.c:628: warning: comparison is always false due to limited range of data type os/linux_usbfs.c:628: warning: comparison is always false due to limited range of data type
* include stdlib.h for free and realloc in libusbi.hhjelmn2013-07-302-1/+3
| | | | References #124.
* Silence automake 1.14 warningNathan Hjelm2013-07-302-1/+3
| | | | | | | | | | | | | | | | | | | | The warning is: libusb/Makefile.am:57: warning: source file 'os/threads_windows.c' is in a subdirectory, libusb/Makefile.am:57: but option 'subdir-objects' is disabled automake: warning: possible forward-incompatibility. automake: At least a source file is in a subdirectory, but the 'subdir-objects' automake: automake option hasn't been enabled. For now, the corresponding output automake: object file(s) will be placed in the top-level directory. However, automake: this behaviour will change in future Automake versions: they will automake: unconditionally cause object files to be placed in the same subdirectory automake: of the corresponding sources. automake: You are advised to start using 'subdir-objects' option throughout your automake: project, to avoid future incompatibilities. Fixed by setting the subdir-objects option. Closes #125.
* Add checks for headers needed by linux/netlink.hNathan Hjelm2013-07-303-6/+27
| | | | | | | | These headers are required by netlink.h. I am not sure how this worked at all. It certainly doesn't work with older versions of Linux 2.6. References #124.
* keep a reference to the device for each active transfer and let the backend ↵Nathan Hjelm2013-07-303-13/+5
| | | | | | | | | | | handle cancelling active transfers when a device is disconnected This commit should fix issues with active transfers when a device is disconnected. The backend is responsible for making sure the completion callbacks are made, not the hotplug code. This should fix a number of issues including duplicate callbacks and segmentation faults. References #124.
* hotplug: Pass explicit context to callbacksFlorian Albrechtskirchinger2013-07-232-3/+2
| | | | | | * Instead of passing NULL for the context to hotplug callbacks, if the context happens to be the default context, always pass the explicit context pointer.
* Prepare for 1.0.16 final releaseHans de Goede2013-07-113-3/+3
| | | | Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* Prepare for 1.0.16-rc3 releaseHans de Goede2013-07-063-3/+4
| | | | Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* Documentation: add an Using an event handling thread sectionHans de Goede2013-07-052-4/+63
| | | | Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* Documentation: explain the 2 main viable event handling approachesHans de Goede2013-07-052-34/+31
| | | | | | | | | | | | | | | | Stop pretending that having a separate event handling thread is a bad thing, specifically delete the "[this] option is not very nice either, but may be the nicest option available to you if the "proper" approach can not be applied to your application", which suggests that using poll integration into a main loop is the one and only "proper" approach. Instead clearly document there are 2 viable approaches, using a separate thread, or poll integration into a main loop. Also stop claiming that libusb does not use threads internally, as with the new hotplug support this is no longer true. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* hotplug: Wakeup libusb_handle_events on libusb_hotplug_deregister_callbackHans de Goede2013-07-052-1/+10
| | | | | | | | | | | | | | | | This serves 2 purposes: 1) We use lazy free-ing of the callback structure, for it to be actually free-ed usbi_hotplug_match() needs to be called. This ensures this actually happens (rather then waiting for a hotplug event to arrive, and not freeing the callback as long as no such event arrives). 2) It causes libusb_handle_events to return to its caller on a call to libusb_hotplug_deregister_callback, which is very useful for apps which use a thread to do their apps (hotplug) event handling, otherwise that thread will hang when the app tries to stop until some event happens. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* hotplug: Give the usbi_hotplug_match* functions a context parameterHans de Goede2013-07-054-11/+11
| | | | | | | So that the device parameter can be NULL, in combination with a 0 events parameter, to be used to force lazy deregistration. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* Doc: update hotplug, topology and descriptor documentationPete Batard2013-07-045-16/+36
| | | | | * Also fix some typos * Closes #95
* Prepare for 1.0.16-rc2 releaseHans de Goede2013-07-014-3/+6
| | | | Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* Core: Use fputs(3) instead of fprintf(3)Tim Roberts2013-06-302-2/+2
| | | | This is a micro-optimisation, but it should make the code easier to understand.
* Core: Fix writing of log lines a single fprintf callPete Batard2013-06-303-19/+15
| | | | | | | * fb4c208c33788068bbca67bdd6d11127b5be5a26 broke cygwin compilation due to __GCC__ not being defined * The actual issue is that __GNUC__ rather than __GCC__ should have been used all along * Also fixes gettimeofday() usage for MinGW/Cygwin * Also increase log buffer size to 1K, fix a broken fprintf in core.c and sort whitespaces
* Core: Make writing of log lines a single fprintf call.Toby Gray2013-06-273-8/+45
| | | | | | | | | | | | Prior to this change a single line of logging performing several fprintf. This change gets all the data for a line to be logged in a single fprintf call. This reduced the chances of writes from another thread getting intermixed with a log line. It also makes it easier to change where logs are output to in the future. Signed-off-by: Hans de Goede <hdegoede@redhat.com>