585 Commits

Author SHA1 Message Date
nastys a3ce129931 Add Sixaxis init for Monterey 2023-01-06 23:01:42 +01:00
Jake 65efb66eed Implement hid_write_control, so we can use HidD_SetOutputReport on win, all others are just a wrapper until tested 2023-01-06 23:01:42 +01:00
Ihor Dutchak c3a6150d88 CI checks for CMake package files (#485)
Add build steps to check different flavours of the CMake package builds.
hidapi-0.13.0
2023-01-02 15:22:01 +02:00
vaaronna 987fd0ac03 Add support for HID over SPI (#486)
This adds (or more accurately completes, since it was already started) support for HID over SPI devices.
Handling is almost identical to HID over I2C.
2022-12-20 19:16:23 +02:00
Jef Driesen 663f1a707d Link gcc helpers statically on MinGW (#488)
When compiling a 32bit dll with the mingw-w64 compiler, some 64bit
integer arithmetic operations are implemented using functions from
libgcc (e.g. __udivdi3 and __umoddi3 from libgcc_s_dw2-1.dll). This
unexpected dependency is inconvenient for applications.

The run-time dependency can be avoid by linking statically.
2022-12-12 20:27:20 +02:00
Stefan Sichler 397344931d Fix CMake export files (#484)
Fixes: #482, #483
2022-11-22 03:36:02 +02:00
CanDursun 2b70208fea Fix typos in README (#479) 2022-11-04 14:01:41 +02:00
endolith bb792a1f7e Add hid_exit() to test.c when handle not found (#471) 2022-10-21 17:31:48 +03:00
endolith 1312cc3bf5 README: prevent segmentation fault and mixture of printf/wprintf (#470)
And a few other improvements.
2022-10-21 13:09:14 +03:00
Steven Michalske f2e2b5b4d4 macOS: Error reporting/hid_error implementation (#314) 2022-10-14 13:25:42 +03:00
Matt Silva 5ce9051e2f libusb: stop read_thread from looping indefinitely (#457)
- When `libusb_submit_transfer` in `read_thread` fails, `read_callback` never gets called and never sets `transfer_loop_finished` to true, causing `read_thread` to loop indefinitely;

- Do not attempt to run a read loop if the initial `libusb_submit_transfer` fails fixes the issue;

Fixes: #456
2022-09-28 17:08:27 +03:00
Ihor Dutchak 4e63d6dfc3 Introduce HID_API_MAX_REPORT_DESCRIPTOR_SIZE (#452)
- first step is to use HID_API_MAX_REPORT_DESCRIPTOR_SIZE internally;
- port a few improvements from get-descriptor branch early;

Resolves: #384
2022-09-15 13:05:56 +03:00
Mykola f45df3be33 Add configure~ to .gitignore (#459) 2022-09-15 13:01:29 +03:00
Dimitriy Ryazantcev 0f2cf886e5 RFC: Add HID bus type in hid_device_info (#308) 2022-09-10 19:18:09 +03:00
Ihor Dutchak ceb41e0abe CI: more CMake build checks (#450)
Check CMake build on:
- Alpine
- Archlinux
- Fedora/mingw64
- FreeBSD
2022-09-10 16:56:05 +03:00
Ihor Dutchak 8224a4cb56 CI: add OpenBSD compilation check (#449)
NOTES, as described in #31:
- it is still hard to use HIDAPI on OpenBSD since it is hard to use LIBUSB with HID devices;
- there is a name colision with `hid_init` from `usbhid` OpenBSD library;
2022-09-10 16:54:19 +03:00
Ihor Dutchak 8068574ee1 Add meson.build as a wrapper over CMake (#410)
- not an independent build system, but a wrapper over CMake;
- may be used as a standalone Meson build or as a subproject;
2022-09-10 16:52:46 +03:00
Ian Douglas Scott dbd1681831 linux: Open files with O_CLOEXEC to not leak fds to child processes (#446)
Motivation described here: https://github.com/libusb/hidapi/pull/446
2022-08-21 21:40:39 +03:00
Adrian Granados 15a7114cee Fixes "parameter not found" warning in documentation (#445) 2022-08-16 17:42:09 +03:00
Ihor Dutchak ea38f6538f libusb: fix HID Report descriptor request (#444)
- pass the actual HID Report descriptor size (from HID descriptor);
- interface_num has to be wIndex, and not as part of wValue for LIBUSB_DT_REPORT request;
2022-08-16 16:29:10 +03:00
Ihor Dutchak 779346241b libusb: fix enumerating device path w/o root access (#442) 2022-08-15 12:47:27 +03:00
Ihor Dutchak c3ae3d0b58 Run hidtest for no more than 10 seconds when no hid_read data (#440)
Avoid infinite reading from the device if the device doesn't send any interrupt reports.
Otherwise hidtest has to be stopped by Ctrl+C interruption, which doesn't give a chance to close the device properly,
as a result this has negative side-effects when using LIBUSB backed.
2022-08-14 12:33:15 +03:00
Ihor Dutchak 597160da3c Reattach kernel driver when failed to claim interface (#441)
Potential execution path may happen if kernel driver successfully detached,
but libusb failed to claim the requested interface.

Otherwise the device remains with detached kernel driver.
2022-08-14 12:31:59 +03:00
Ihor Dutchak 5e299f4736 v0.13.0 for new API function (#439) 2022-08-13 19:43:44 +03:00
Julian Waller 5c9f147a07 Add hid_get_device_info (#432)
- new API function: `struct hid_device_info * hid_get_device_info(hid_device *dev);` to get `hid_device_info` after the device already opened;
- reused existing implementation on Windows and macOS from enumeration routines to have the implementation;
- refactored libusb implementation to have a shared routine for `hid_enumerate` and `hid_get_device_info`;
- refactored hidraw implementation to have a shared routine for `hid_enumerate` and `hid_get_device_info`;

Resolves: #431
Closes: #164
Closes: #163
2022-08-13 19:01:57 +03:00
Ihor Dutchak eaa5c7c6f1 hid_error improvements (#428)
- make the behaviour of methods which set hid_error more consistent;
- make the documentation and the implementation of hid_error consistent and safe;
- windows: add global error implementation;

Co-authored-by: Julian Waller <git@julusian.co.uk>
2022-06-22 01:34:39 +03:00
Ihor Dutchak 81dd62dd10 Ensure Iconv is found when provided via CFLAGS/LDFLAGS (#430)
- by default find_file/find_library doesn't respect CFLAGS/LDFLAGS, and FindIconv fails to find Iconv;
- by explicitly trying to link against `-liconv` - we're checking if library is available in such way;
- additionally: if Iconv is detected as BUILT_IN, no need to explicitly depend on `Iconv::Iconv`;
2022-06-22 01:30:45 +03:00
Ihor Dutchak 59e84ca74f podspec: include darwin-specific header (#412) 2022-05-31 14:58:01 +03:00
Ihor Dutchak ace1e9a2dc Fix Cygwin Appveyor build (#423)
- run Cygwin on a newer environment;
- keep MSVC running on VS 2015, just to cover automated testing of it;

Fixes: #419
2022-05-31 13:16:03 +03:00
Ihor Dutchak 7610829409 v0.12.0 Release hidapi-0.12.0 2022-05-25 15:52:59 +03:00
MeeSong 844e4682a9 Fix: memory write out of bounds. (#418) 2022-05-25 15:49:47 +03:00
Ihor Dutchak 93285f5246 windows: Add .rc (#415)
- Add resource file for DLL;
hidapi-0.12.0-rc2
2022-05-11 17:47:38 +03:00
Ihor Dutchak 52fa87300b Windows build artifacts with Github Actions (#414)
- a straight-forward build matrix for Appveyor;
- MSBuild builds with Github Actions;
- Visual Studio 2022 support for `.sln` (toolset v143);
- gather Windows build artifacts with Github actions;
2022-05-08 19:59:39 +03:00
Ihor Dutchak 51196845d4 Prepare RC2 2022-05-08 15:00:10 +03:00
Ihor Dutchak e0f44a5887 Make a note about VERSION 2022-05-08 14:59:17 +03:00
Ihor Dutchak c95795ab5c Fix hidtest build
- fix including platform-specific includes when HIDAPI is a CMake subdirectory;
- check libusb and winapi platform-specific headers with hidtest;
2022-05-05 14:53:17 +03:00
Ihor Dutchak 52c728acf4 Use propper type for mach_port_t default param
- enable compilation warnings as errors for CI to catch such issues in the future;
- fix Mingw strict compilation warnings;
2022-05-05 14:53:17 +03:00
Ihor Dutchak 2aeb0688fa Don't use deprecated kIOMasterPortDefault (#406)
`kIOMasterPortDefault` is deprecated since macOS 12.0.
One alternative is to use named constant `kIOMainPortDefault` which is not available before macOS 12.0.

Both named constants are just an alias for `NULL`, so it is simpler to use it directly instead.

Fixes: #377
hidapi-0.12.0-rc1
2022-05-02 14:48:12 +03:00
Ihor Dutchak cd95af8d70 libusb: cmake: Proper dependency on Iconv (#405)
- explicitly add Iconv as a dependent library;
- check if iconv requires pointer-to-const as input (introduce ICONV_CONST check);
- NetBSD CI (has external Iconv library implementation that uses all of the above);
2022-05-02 14:18:03 +03:00
Ihor Dutchak 874b29c8e7 Fix find_package(hidapi) warnings (#404)
- FindPkgConfig.cmake warns it is not called by find_package;
- CMake package `config` file and `exports` file names should not match,
otherwise it gets included recursively by GLOB expression;
2022-05-02 14:09:16 +03:00
Jacob Shaffer 08563a0249 add better windows error handling (#388) 2022-05-02 14:08:44 +03:00
Ihor Dutchak 68bcbfcafa README: explicit statement on single source build (#370) 2022-05-02 14:05:05 +03:00
SNEHAL 536bad201e libusb: Fix double free of buffer pointer in hid_close() (#395)
Make buffer pointer NULL, once it is freed.

In hid_close() buffer pointer is freed and next to that the libusb_free_transfer function is called which checks for if the LIBUSB_TRANSFER_FREE_BUFFER flag is set and the buffer pointer is not NULL. when this condition evaluates true, it
tries to free memory for a buffer which is already free and a crash occurs.

Even though the described behavior should not happen as per libusb documentation, it has been observed with some version(s) of libusb.
2022-04-23 15:54:26 +03:00
Ihor Dutchak bca404520f Fire v0.12.0 (#398)
- add convenient macros to check HIDAPI version in runtime;
- mark in which version all recent HIAPI API functions where added;
2022-04-23 15:50:41 +03:00
Ihor Dutchak 05f0588220 darwin: add option to open device in non-exclusive mode (#397)
Resolves: #27
Resolves: #344
2022-04-23 14:16:42 +03:00
Ihor Dutchak 75aafc3ac9 CI: check for new headers installation 2022-02-25 11:45:27 +02:00
Ihor Dutchak 97887cf2eb Upgrade build script for Windows Server 2022 2022-02-25 11:45:27 +02:00
Frederik Seiffert 1ce31c3594 macos: Add Mac-specific API to get device Location ID (#378) 2022-02-25 10:54:28 +02:00
Frederik Seiffert 2cfd63ac41 windows: Add Windows-specific API to get device container ID (#379) 2022-02-25 10:53:00 +02:00
Frederik Seiffert e08ddcee5f macOS: Fix build warnings (#374) 2022-02-05 17:24:20 +02:00