aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
12 daysMerge "Upgrade libusb to 2a138c6f12988c42eaa9dd663581faa700c44abe" into mainHEADmastermainTreehugger Robot
12 daysUpgrade libusb to 2a138c6f12988c42eaa9dd663581faa700c44abeFabien Sanglard
This project was upgraded with external_updater. Usage: tools/external_updater/updater.sh update external/libusb For more info, check https://cs.android.com/android/platform/superproject/+/main:tools/external_updater/README.md Test: TreeHugger Change-Id: I7d00a9849a85bffe05ae89030db1c59424059fea
14 daysConsistent use of C-style comment markersTormod Volden
Except for the Windows, Emscripten, and Haiku backends we use C-style comments markers and not double-slash. Get rid of a few inconsistent // instances. Note the doxygen code examples have // comments because they are inside proper /* */ comments. Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
14 dayswindows: Downgrade get_guid DeviceInterfaceGUID message to debug levelTormod Volden
Ideally it should be a warning only for composite devices but it is difficult to discern that case. The message is too invasive and confusing for the non-composite case, so make it debug instead. Follow-up of commit f9ae36b Closes #1394 Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
14 daysCosmetic cleanup of SuperSpeedPlus commentsFabien Sanglard
- Fix typos. - Use SuperSpeedPlus naming consistently. - Remove C++ style comment in favor of C style. Fixup of commit f00f06e9 References #1499 Closes #1502
2024-05-26xusb: Only retrieve BOS descriptor for bcdUSB 0x0201 or higherTormod Volden
The "Binary device Object Store" (BOS) descriptor was introduced with bcdUSB revision 0x0201. References #1492 Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
2024-05-26linux: ioctl() request number is unsigned longTormod Volden
The type mismatch was caught by building with -Wconversion. References #1497 Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
2024-05-26linux: Fix type of open() flags argumentTormod Volden
The second argument to open() is an int carrying flags (including "access modes"). A third, optional argument has type mode_t, carrying "file mode bits" for file permissions. Also rename the variable to access_mode to make it more clear. The type mismatch was caught by building with -Wconversion. References #1497 Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
2024-05-26SuperSpeedPlus: Fix typo mantisa -> mantissa in struct fieldFabien Sanglard
Fixup of commit f00f06e9 Closes #1499
2024-05-21Merge "Upgrade libusb to fef78a96e37936f16c10c43c9a220683f7c2ff74" into mainTreehugger Robot
2024-05-21Upgrade libusb to fef78a96e37936f16c10c43c9a220683f7c2ff74Fabien Sanglard
This project was upgraded with external_updater. Usage: tools/external_updater/updater.sh update external/libusb For more info, check https://cs.android.com/android/platform/superproject/+/main:tools/external_updater/README.md Test: TreeHugger Change-Id: I52801e891e1a773c5963d80eeda6673f144557e6
2024-05-07windows: Restore behaviour of skipping malformed device GUIDsFrancis Hart
Previously when getting the device list, a malformed device GUID would be explicitly ignored and skipped, allowing the operation to complete. A recent change to winusb_get_device_list() in commit fdab67b accidentally changed this behaviour, so this scenario instead caused an early exit with error code LIBUSB_ERROR_NO_MEM. Closes #1475
2024-05-07Add API support for LIBUSB_SPEED_SUPER_PLUS_X2 20Gbps USB 3.2 gen 2x2Harry Mallon
Implement detection on darwin and linux_usbfs, and report it in xusb. Closes #1477
2024-05-07Add support for SuperSpeed+ Capability DescriptorsFabien Sanglard
See specs in USB 3.1 specs in section: 9.6.2.5 SuperSpeedPlus USB Device Capability Closes #1428 Fixes #1429
2024-04-20darwin: Cleanup of usbi_backend structureSean McBride
No real change. - rearrange elements to be initialized in the same order as they appear in the struct declaration - explicitly set values to NULL so that global searches for things like `wrap_sys_device` easily reveal that the function is NULL on Darwin Closes #1439
2024-04-20Increase usbi_get_tid() size from int to longSean McBride
This function has different implementations on every OS, but for some, like macOS, it was truncating from 64 to 32 bit by casting to int. So increase its size from int to long. (The function is currently only used for debug output.) Closes #1423
2024-04-20haiku: Use gcc atomic builtins to fix buildAdrien Destugues
Fixes #1387 Closes #1482
2024-04-04darwin: Suppress false positive warning with an assertSean McBride
The clang static analyzer doesn't see that the pointer will always be non-NULL if the return value is success. Just assert this fact so that it can see this, and then it won't warn: Access to field 'can_enumerate' results in a dereference of a null pointer (loaded from variable 'cached_device') References #1414
2024-04-04darwin: Fix clang static analyzer warning about a variable that's never readSean McBride
Reformulate the loop in a way that the variable is read. References #1414
2024-04-04xcode: Enable several additional warnings in the Xcode projectSean McBride
These don't generate any warnings anymore (with Xcode 15). References #1414
2024-04-04darwin: Correct interpretation of COM-style Release() return valueSean McBride
Found thanks to a warning about implicit sign conversion. The return value is the new reference count, not an IOReturn error code. I'm not sure if this is copy paste, and the new ref count is unimportant, so I just preserved the existing behaviour (but adjusted the log message). The change only impacts debug logs anyway. References #1414
2024-04-04Fix most warnings about implicit sign conversionSean McBride
- Sometimes just change a type to match where it's coming from - Sometimes add an explicit cast (but only if it's guaranteed correct, like a previous check that a signed value is positive before casting to unsigned) - For libusb_bulk_transfer() add an assert to be certain that the signed return value is never negative. Update API documentation to underline this fact. Add similar assert in usbi_handle_transfer_completion(). - darwin: For parsing OS version, change scanf to use %u instead of %i - xusb: Add additional range checks before casting - xusb: Reverse some backwards count and size arguments to calloc, not that it really matters Closes #1414
2024-04-04xusb: Avoid warning about implicit switch fallthroughSean McBride
References #1414
2024-03-14emscripten: Remove superfluous capabilityTormod Volden
This is a common capability, not per backend. Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
2024-03-14hotplug_exit: Mutex protection of context device list while cleaning itSylvain Fasel
This prevents concurrent access to the list by the event background thread, which could still be processing a previous hotplug event and having to modify the list. Fixes #1366 Fixes #1445 Closes #1452 References #1406
2024-03-08Merge "Add sanglardf to OWNERS" into mainTreehugger Robot
2024-03-08Add sanglardf to OWNERSFabien Sanglard
Test: NA Bug: NA Change-Id: Idb99926a50e262a6cfdf19637827ff17f81b8ef5
2024-02-26hotplug_exit: Remove parents recursivelySylvain Fasel
Remove all parents with a single child remaining in parent tree. This ensures that no parents of the direct parent of the device being considered are left in the list, when appearing before their child(ren) in the processing order of the context device list cleaning. References #1452 References #1406
2024-02-26Add clang-tidy config fileSean McBride
All checks are enabled except for those that cause any warning. This is a starting point, some of the currently-suppressed warnings can be fixed hereafter. Closes #1434
2024-02-14sunos: Fix typos breaking buildTormod Volden
Fixup of commit 66e63d6 Fixes #1465 Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
2024-02-09Merge "Upgrade libusb to v1.0.27" into main am: 9e9370211cTreehugger Robot
Original change: https://android-review.googlesource.com/c/platform/external/libusb/+/2954501 Change-Id: I2b079c8109b34320d54c36a52f2eef69359455da Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-09Merge "Upgrade libusb to v1.0.27" into mainTreehugger Robot
2024-02-09Upgrade libusb to v1.0.27Shaju Mathew
This project was upgraded with external_updater. Usage: tools/external_updater/updater.sh update libusb For more info, check https://cs.android.com/android/platform/superproject/+/main:tools/external_updater/README.md Test: TreeHugger Change-Id: Ifb65673bd9d1a8653475e1396110447114685d4a
2024-01-31libusb 1.0.27Tormod Volden
Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
2024-01-31configure.ac: Bump libtool library versionTormod Volden
Programs using the previous version may use the new version as drop-in replacement, but programs using the new version may use APIs not present in the previous one. Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
2024-01-31examples/hotplugtest: Tone down message about failed openTormod Volden
References #1425 Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
2024-01-31configure.ac: Do not build umockdev if --enable-debug-log is usedTormod Volden
umockdev relies on the per-context log callbacks to do its checks properly, and these are not called if ENABLE_DEBUG_LOGGING is defined (configure --enable-debug-log). Fixes #1449 Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
2024-01-28libusb 1.0.27-rc2Tormod Volden
Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
2024-01-27docs: Add more references in libusb_option sectionTormod Volden
Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
2024-01-27core: Allow setting global log callback after first libusb_init()Lars Kanis
When setting LIBUSB_OPTION_LOG_CB before the first libusb_init(), the global callback is set. However, after the first libusb_init() there is a default context, and setting LIBUSB_OPTION_LOG_CB would only set this default context, and not the global callback. There would be no way to set the global callback through libusb_set_option(). Change this so that the global log callback is set in addition to the default context (when libusb_set_option is called with NULL context). Closes #1397
2024-01-27core: Don't overwrite the log callback on every global libusb_set_option()Lars Kanis
But set it only on option LIBUSB_OPTION_LOG_CB. Otherwise the following second call resets the callback to the default one: libusb_set_option(NULL, LIBUSB_OPTION_LOG_CB, cb_func); libusb_set_option(NULL, LIBUSB_OPTION_LOG_LEVEL, LIBUSB_LOG_LEVEL_DEBUG); References #1397
2024-01-20docs: Prefer use of libusb_init_context() over old libusb_init()Sean McBride
- Replace some uses of the soft-deprecated libusb_init() and libusb_set_debug() with their updates. - Updated various comments to favour use of the new functions. - Notably remove \deprecated doxygen statement, since it causes -Wdocumentation compiler warnings. - Notably update the xusb example to pass debug options to libusb_init_context() instead of setting environment variable. - Also improve comments related to LIBUSB_API_VERSION and LIBUSBX_API_VERSION. Closes #1408 [Tormod: Fix Doxygen formatting and references] Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
2024-01-20xcode: Add files from other backends into the Xcode projectSean McBride
They aren't included in any target, so they are never compiled. But having them in the project allows doing global searches that also look in these files. Closes #1421
2024-01-20xcode: Move some options from Xcode project to xcconfig fileSean McBride
project.pbxproj is not so human-readable, and xcconfig files are preferable because you can add comments about the build settings. References #1421
2024-01-20Correct some spelling and add codespell config fileSean McBride
In one case, renamed a variable from `larg` which codespell thought was a typo for `large`. Closes #1411
2024-01-19darwin: locationID is 32-bit, not 64-bitSean McBride
Also zero-initialize locationID since otherwise it could be used uninitialized. Also change the return variable to bool, matching what the function actually returns. Fortunately, this only affected log messages. Closes #1412 [Tormod: Use PRIx32 for printing the 32-bit locationID] Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
2024-01-19Replace all http://libusb.info/ with httpsSean McBride
The libusb.info website, like most sites these days, auto-redirects to the https version anyway. Also replaced a couple of other http links to https, after verifying that they autoredirect to https. Note this changes the "describe" field in the version info returned by libusb_get_version(). This field is only there for ABI compatibility and contains the website URL. Closes #1407
2024-01-19Document backend functions that already lock dev_handle->lockSean McBride
Closes #1410
2024-01-19Fix docs about backend functions that lock itransfer->lockSean McBride
In 2013, commit 858b794c added a comment saying "This function gets called with the flying_transfers_lock locked". That appears to have changed with 138b661f. Commit 88778414 improved some stale comments, but missed these. It is clear in the code that the comment is no longer true. The function is *not* called with flying_transfers_lock locked, but it does lock itransfer->lock. References #1410
2024-01-19io: Change remove_from_flying_list() to not lock flying_transfers_lock itselfSean McBride
This is now symmetric with add_to_flying_list(), which was already requiring that *callers* lock flying_transfers_lock. Updated the only 2 callers. This also makes the code correspond better to the big comment about locking made in 138b661f. Also documented at the top of several functions when they require that flying_transfers_lock already be held. Verified by code review that it's actually the case. This should not change any behaviour at all. References #1410