Commit Graph

515 Commits

Author SHA1 Message Date
Ihor Dutchak 1e8895d123 add libusb-specific hid_libusb_wrap_sys_device
Rationale: on Android one must use UsbManager, to access any
USB device. As a result, libraries like libusb can only use file descriptors
that are provided by UsbManager.
libusb has an API to use such file descriptors: hid_libusb_wrap_sys_device.
Having hid_libusb_wrap_sys_device currently is the only way to make hidapi
work on Android without root access and without custom Android builds.

Relevant info: https://github.com/libusb/libusb/pull/830/files
libusb_wrap_device-deprecated
2021-05-18 18:00:21 +03:00
Ihor Dutchak a323c29165 Merge remote-tracking branch 'origin/master' into cmake-support 2021-05-18 16:41:45 +03:00
Ihor Dutchak c7a2339b05 libusb: add support for potential Android JNI backend 2021-05-18 16:39:01 +03:00
Ihor Dutchak fe48fa0853 documentation refactoring 2021-05-18 03:16:10 +03:00
Ihor Dutchak 197ae97445 Merge remote-tracking branch 'origin/master' into cmake-support 2021-05-15 12:31:18 +03:00
Ihor Dutchak b72a367555 Switch builds.sr.ht from ~qbicz to ~z3ntu (#269) 2021-05-11 12:53:18 +03:00
MonkeybreadSoftware 6f0056e1ce Build workaround for kernels older than 2.6.39 (#260) 2021-05-05 11:51:16 +03:00
jeremyouellet b8837014ef Use Conditional PlatformToolset projects for VS (#261) 2021-05-05 11:48:34 +03:00
Ihor Dutchak 84d7d57b8a Fix MinGW build on Linux/Unix platforms
Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
2021-04-15 18:38:41 +03:00
Ihor Dutchak 11021c09c0 Merge branch 'master' into cmake-support 2021-04-10 16:19:57 +03:00
Ihor Dutchak 6a01f3b4a8 Switch to libusb/hidapi appveyor project for badge 2021-03-19 00:49:27 +02:00
Ihor Dutchak f1cd8085ed Explicitly check for trying to install 'EXCLUDE_FROM_ALL' hidapi 2021-03-14 11:11:11 +02:00
Ihor Dutchak 0ea5e9502f windows: cache write buffer allocated for small user buffers 2021-03-07 13:58:57 +02:00
Florin Popescu de08a4f3b8 Added support for MSYS2 2021-03-07 13:57:19 +02:00
Mariusz Jaskółka 3cd1742737 Windows: Fix devices enumeration (#235)
Based on
https://github.com/microsoft/Windows-driver-samples/blob/d40232638faaab19de557e70a3ee938da7a35295/hid/hclient/pnp.c#L32

Fixes wrong detection of the class of devices.

Fixes: #234
2021-01-30 15:20:01 +02:00
Ihor Dutchak 00fe9c0b25 Merge branch 'master' into cmake-support 2021-01-15 18:14:29 +02:00
Ihor Dutchak 81291b205b don't add (custom) build options, when a subdirectory of a bigger project
Closes: #227
2021-01-15 18:12:58 +02:00
Ihor Dutchak 633a5aea40 macos CI for CMake 2021-01-15 16:33:27 +02:00
Jan Palus d15d594a41 configure.ac: remove duplicate AC_CONFIG_MACRO_DIR (#226)
fixes build with autoconf 2.70
2021-01-15 15:32:14 +02:00
Ihor Dutchak c393b88dcf BUILD_HIDTEST->HIDAPI_BUILD_HIDTEST to have consistent custom prefix 2021-01-15 15:15:24 +02:00
Ihor Dutchak 8ae8ffb2cf optionally specify possible values for CMAKE_BUILD_TYPE
- only when it is one of the standard types, to allow custom ones as well;
2021-01-15 15:10:26 +02:00
Ihor Dutchak 4b8f8814c3 always use libhidapi-libusb.so for libusb backend
Historically, there was no libhidapi.so for libusb backend,
and no good reason not to be consistent with the existing build system.
Also, this will make it easier to enable libusb backend
for platforms like Windows/macOS, where native libhidapi.so already exist.
2021-01-15 14:18:48 +02:00
Ihor Dutchak 9f7f81d15c Update CMakeLists.txt
Co-authored-by: Be <be.0@gmx.com>
2021-01-15 01:36:42 +02:00
Ihor Dutchak ad7cc64ee1 Merge remote-tracking branch 'origin/master' into cmake-support 2020-12-27 13:26:49 +02:00
Mornix fb4135c7a8 Windows: ensure buffer passed to HidD_SetFeature is large enough (#224) 2020-12-24 08:13:54 +02:00
Ihor Dutchak 916fad56fe macOS: use GitHub action CI instead of Travis-CI (#223) 2020-12-13 23:01:46 +02:00
Ihor Dutchak 7b5333301d Update README.md 2020-12-12 21:21:53 +02:00
Pavol Rusnak fe724003c6 windows: make hid.c non-executable 2020-12-11 21:01:19 +02:00
Ihor Dutchak 0c0f3b8e11 don't search pkg-config libusb, if CMake target usb-1.0 exists 2020-12-11 20:31:26 +02:00
Ihor Dutchak 443ea8f2e4 Sync with v0.10.1 (master) 2020-11-26 22:51:45 +02:00
Ihor Dutchak f6d0073fcd hidraw/libusb: fix -Wall -Wextra -pedantic -Werror compilation (#214)
- minor code-style fixes;
hidapi-0.10.1
2020-11-24 13:39:27 +02:00
Jacob Alexander ffb50afd5f hidraw: Add support for HID over I2C and uhid devices (#166)
- uhid USB, Bluetooth (standard) and I2C now enumerating
  * USB uhid support was added by removing the udev USB endpoint check;
- HID over I2C was excluded before (likely because it didn't exist when
  hidraw was developed);
2020-11-23 21:53:04 +02:00
Ihor Dutchak d9471d4608 Version 0.10.1 2020-11-23 21:39:25 +02:00
Russell Taylor 9828cad691 Windows: fix strict typecast (#206) 2020-11-23 21:12:26 +02:00
Antonio Borneo 8caf8c8985 hidapi.h: fix API prototype for gcc flag -Wstrict-prototypes (#207) 2020-11-23 21:04:19 +02:00
Jonas Malaco ce606fac8f macOS: check if IOHIDManagerCopyDevices returned a NULL (#209)
Removes a possible cause for a segmentation fault observed in `CFSetGetCount`.

Related: #208 ("Segmentation fault on Mac OS Catalina").
Signed-off-by: Jonas Malaco <jonas@protocubo.io>
2020-11-23 21:03:03 +02:00
Jacob Alexander 48cacfa98b Usage Page and Usage on Linux with hidraw (#139)
NOTE: This commit does not handle composite HID descriptors
I am interested in adding support for composite descriptors though I still need to find a
device with a composite descriptor to test it correctly.

The implementation idea is similar, as in #125 for macOS.
2020-11-23 21:02:16 +02:00
Vitaly Samoylik 8ed36853ba Read podspec version from VERSION file (#205)
* Read podspec version from VERSION file
* Add AppKit dependency into podspec
2020-10-26 17:34:15 +02:00
Ihor Dutchak 302d1f2401 Fire v0.10.0 hidapi-0.10.0 2020-10-25 23:59:59 +02:00
Ihor Dutchak a11a5e71c8 explicitly install required packages for archlinux CI builds 2020-10-25 23:59:24 +02:00
Marc Zyngier ad985aeaf4 linux/hidraw: Don't consider open returning 0 as an error
The open systcall is allowed to return 0 as a valid file descriptor,
and considering it an error breaks environments where unnecessary
fds are closed before executing untrusted processes.

Fixes: #199

Signed-off-by: Marc Zyngier <maz@kernel.org>
2020-10-20 19:01:54 +03:00
Ihor Dutchak 3fe9b78d6d ignore .DS_Store files 2020-10-16 13:06:50 +03:00
Ihor Dutchak a731aae2a3 macOS: fix -Wall -Wextra -pedantic compilation warnings 2020-10-16 13:06:50 +03:00
Ihor Dutchak fd64175558 fix macOS build 2020-10-14 20:26:59 +03:00
Ihor Dutchak 7260981d09 Merge branch 'master' into cmake-support 2020-10-14 19:30:36 +03:00
Ihor Dutchak d2c3a9862e libusb: fix race condition on device close (#189)
Read callback may fire itself on its own even after its been
requested to stop and exactly before the calling code
waits for its completion in indefinite loop.

Explicitly preventing re-fireing the submission loop,
fixes the issue.

Fixes: #142.

Signed-off-by: Ihor Dutchak <ihor.youw@gmail.com>
2020-10-14 18:43:26 +03:00
Ihor Dutchak 2eb8af161f MSVC: fix /W4 /WX compilation (#191) 2020-10-14 18:42:27 +03:00
Ihor Dutchak 8f72236099 add hid_version/hid_version_str API (#192)
- API functions to get runtime version of the library;
- macros to get static/compile-time version of the library;
- VERSION file;
2020-10-14 18:41:08 +03:00
Ihor Dutchak fd53f39f25 macOS: enumerate device with primary usage/usage_page first (#193)
It improves backward compatibility with versions of hidapi, where
usage/usage_pairs didn't emit seaprate hid_devices_info.
2020-10-14 18:37:27 +03:00
Kevin Teynor b1a2628eea Windows: crash bugfix when trying to open device without a serial number (#194) 2020-10-14 18:36:12 +03:00