62 Commits

Author SHA1 Message Date
Ihor Dutchak
95e6b98ce9 Add hid_read_error (#721)
hid_read_error is a separate error function, that returns error status of hid_read/hid_read_timeout.
hid_read/hid_read_timeout is no longer changes internal buffer used by hid_error and it makes it safe to use hid_read/hid_read_timeout from a separa thread, concurently with other device functions.
2025-03-11 19:26:36 +02:00
Ihor Dutchak
c15392af9b winapi: add hid_winapi_set_write_timeout (#700)
Add API function to control hid_write timeout on WinAPI backend.

Resolves: #686
2024-10-03 14:00:43 +03:00
Ihor Dutchak
d101e5c7e4 macOS: fix hid_send_output_report implementation
- fix name of the function on macOS
- add compile-time check by the CI

Fixes: #683
2024-08-02 16:48:23 +03:00
Ihor Dutchak
76462bd767 Avoid CMake backward compatibility warning (#663)
Avoid a message:
```
Compatibility with CMake < 3.5 will be removed from a future version of CMake.

Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
```

Fixes: #642
2024-03-05 13:26:01 +02:00
Moritz 'Morty' Strübe
4168d87521 Fix the windows build by fixing printf related issues (#641)
- Fix printf/string-related issues
- CI: Turn on -Wformat-signedness for GNU-cc
- Windows: Assert that struct has the correct size
2023-11-17 13:59:40 +02:00
Ihor Dutchak
9b44cd70d5 hidtest: print Bus Name 2023-05-05 12:11:18 +03:00
Ihor Dutchak
26b5bb0ccf RFC: add hid_get_report_descriptor API function (#451)
- native implementations for hidraw/libusb/macOS;
- HID Report Descriptor reconstruction from HIDP_PREPARSED_DATA on Windows;
- unit-tests for some known devices for `hid_winapi_descriptor_reconstruct_pp_data`;
- support for ASAN builds (mainly to check the `hid_winapi_descriptor_reconstruct_pp_data`/its unit-tests;
2023-03-12 14:45:30 +02:00
Ihor Dutchak
c3a6150d88 CI checks for CMake package files (#485)
Add build steps to check different flavours of the CMake package builds.
2023-01-02 15:22:01 +02:00
endolith
bb792a1f7e Add hid_exit() to test.c when handle not found (#471) 2022-10-21 17:31:48 +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
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
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
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
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
f75adc3c91 Correct example including hidapi.h 2021-08-17 17:17:29 +03:00
Ihor Dutchak
f2bb972e7f add CMake build system 2021-07-03 20:38:58 +03:00
Ihor Dutchak
f6d0073fcd hidraw/libusb: fix -Wall -Wextra -pedantic -Werror compilation (#214)
- minor code-style fixes;
2020-11-24 13:39:27 +02: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
Tod E. Kurt
ca1a2d6efa macOS support for multiple usage/usage-pages (#125)
* macOS support for multiple usage/usage-pages
Update of @fengji2006 PR#65, second try

* apply requested changes and test

* handle possible nullptr
2019-12-05 10:53:44 -08:00
Ludovic Rousseau
c1b3078251 macOS: fix build of hidtest using autotools
Fix github issue #114
2019-11-05 14:00:44 +01:00
luz.paz
f01c4ede50 Misc. typo fixes
Found via `codespell -q 3`
2019-07-14 13:54:55 +02:00
Thomas Petazzoni
d98c408ed3 hidtest: don't use a C++ source file, since it's pure C
This allows to build the test program with toolchains that don't have
C++ support.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2019-06-25 15:09:11 +03:00
Benedikt Wildenhain
56e8c3939f hidtest: Remove "All Rights Reserved" from hidtest.cpp
The language may be confusing for this file, since the hidtest.cpp file
may be used by anyone for any reason.
2014-07-22 15:51:53 -04:00
Ludovic Rousseau
f74e0c64e8 hidtest: Use hid_init()
Use hid_init() in hidtest/hidtest.cpp
2012-11-26 13:34:54 -05:00
Alan Ott
6d50f8fa0f Add Autotools build system (automake, autconf)
This adds the familiar autotools build system and associated documentation
for Linux, FreeBSD, Mac, MinGW, and Cygwin.  The old Makefiles have been
kept, and where appropriate have been renamed Makefile-manual.

Thanks to Peter Stuge, Ludovic Rousseau, Xiaofan Chen, Alex Dupre, and
Segher Boessenkool for providing testing, review, and suggestions, and to
Ludovic Rousseau for providing patches which contributed to this commit.
2012-07-16 00:43:04 -04:00
Alan Ott
6a8ed4797d Add hid_exit() to example program. 2011-09-13 02:39:08 +08:00
Alan Ott
be33ec11a3 Call hid_close() at the end of testgui.cpp. 2011-09-13 02:19:46 +08:00
Alan Ott
eebf197414 Change interface to interface_number in hid_device_info struct.
Forgot to add to previous commit.
2011-01-18 23:05:58 -05:00
Alan Ott
a93cdfbeac Add the interface number to hid_device_info on Linux/libusb implementation.
The interface number is added to the hid_device_info struct. Since the
Linux/libusb implementation can't put the Usage and Usage Page in the
hid_device_info struct because it requires detaching the kernel driver, the
interface number is added instead so that users with composite HID devices
can differentiate between the interfaces on the device.
2011-01-18 22:52:06 -05:00
Alan Ott
0dd77c86be Add release_number to hidtest.
Added a printf() with the release number to the hidtest test program.
2011-01-18 21:33:53 -05:00
Alan Ott
09cb41aada Additional licenses. HIDAPI is now GPLv3, BSD, or the original license,
at the discretion of the user. This should provide maximum flexibility and
freedom.
2010-09-13 11:15:24 -04:00
Alan Ott
f53f5fb0f8 Changed hid_get_feature_report() to return the number of bytes actually read on Windows. This involved changing the implementation to use DeviceIoControl() rather than HidD_GetFeature().
Changed it on Mac as well to return the same. The Linux implementation already did this.
2010-08-14 14:12:43 -04:00
Alan Ott
65331407a7 Made the hid_error() return wchar_t* so we can get translated error messages. 2010-08-10 14:58:59 -04:00
Alan Ott
d2c01f9000 Updated .gitignore to include generated files on Unix. 2010-07-28 20:57:46 -04:00
Alan Ott
4b6cde335a Deleted generated files which are no longer needed. 2010-07-28 19:40:13 -04:00
Alan Ott
80ad44b7cf Moved Windows build files to windows/ 2010-07-28 19:38:45 -04:00
Alan Ott
3301d7a91e .gitignore to ignore generated files 2010-07-27 22:57:10 -04:00
Alan Ott
a06a7dc3f3 Brought the hidapi project into this solution. 2010-07-27 22:51:53 -04:00
Alan Ott
2097e314fc Modified the windows build to not require the DDK to build the DLL.
Also moved the windows hid.cpp file to windows/ from hidapi/. hidapi/ now
only contains the library header file.
2010-07-27 22:28:42 -04:00
Alan Ott
30b7a910c5 New Windows Binaries. 2010-07-25 23:20:49 -04:00
Alan Ott
f3380552ee Checking in latest built files for Windows. 2010-07-25 23:16:23 -04:00
Alan Ott
49e5aedc06 Converted the Windows implementation over to use the new interface. 2010-07-25 22:11:50 -04:00
Alan Ott
0e67d54581 Merge branch 'master' of github.com:signal11/hidapi 2010-07-25 20:56:27 -04:00
Alan Ott
f4aec028de Moved the \n so that NULL wide strings wouldn't mess up the stream. 2010-07-25 20:56:14 -04:00
Alan Ott
a0e06333c6 Updated for the new hidapi interface. 2010-07-25 20:52:05 -04:00
Alan Ott
d9b62de1cb Updated test program to match sources. 2010-07-10 22:03:26 -04:00
Alan Ott
23c43b0e84 Added some checking. 2010-07-10 22:01:43 -04:00
Alan Ott
7222c93ef9 Cleaned up main test program.
Removed wprintf() in favor of printf("%ls").
	Added a sleep in the main read loop for demonstration.
	memset-zero the buffer.
2010-07-10 21:52:33 -04:00
Alan Ott
32f9cb6c3c Added support for Set/Get Feature reports for Windows. 2010-07-05 16:35:42 -04:00
Alan Ott
96aca32ec8 Implemented the Manufacturer and Product strings in the hid_device struct on Windows. 2010-07-01 17:56:46 -04:00