Commit Graph

625 Commits

Author SHA1 Message Date
Ihor Dutchak d3013f0af3 Weekly runs for Coverity Scan (#565) hidapi-0.14.0 2023-05-22 13:50:06 +03:00
Ihor Dutchak 24e0a874ec Add Coverity check to README (#564) 2023-05-22 13:34:57 +03:00
Ihor Dutchak ca8373a5b7 Fix "Use after free" (#559)
Fixes: #542
2023-05-22 13:08:48 +03:00
Ihor Dutchak 435650a8fb Fix "Out-of-bounds write" (#560)
Fixes: #541
2023-05-22 13:08:36 +03:00
Ihor Dutchak 1798adabb2 Fix "Explicit null dereferenced" (#561)
Fixes: #549
2023-05-22 13:08:19 +03:00
Ihor Dutchak b595f3b063 Correct type (int) for printf width specifier (#562)
Fixes: #550
2023-05-22 13:08:01 +03:00
Ihor Dutchak 8a4618a4db Document Coverity/Checks before release step (#558) 2023-05-21 11:02:55 +03:00
Ihor Dutchak 60fd395a4a Multi-platform Coverity build (#557) 2023-05-20 22:04:30 +03:00
Vitaly Samoylik 6e3dd5774a Return from hid_open_path early in case if hid_init fails to avoid crash (#555)
Fixes: #547
2023-05-15 13:25:22 +03:00
JoergAtGithub 5f5072f99e Fixed second occurence of CID1530054 (#554) 2023-05-15 00:43:06 +03:00
Ihor Dutchak 5fa9ec83b2 Windows scans with Coverity (#553) 2023-05-14 23:46:17 +03:00
JoergAtGithub f5c821e36f Fix Coverity issues CID1530052, CID1530054, CID1530055 (#552) 2023-05-14 23:43:44 +03:00
Ihor Dutchak f0211fb752 Linux scans with Coverity (#548) 2023-05-14 00:26:12 +03:00
Ihor Dutchak 6f145cef32 macOS scans with Coverity (#546) 2023-05-13 23:55:58 +03:00
Ihor Dutchak 62ba4f2ad3 Add stub for Checks workflow 2023-05-12 22:40:38 +03:00
Ihor Dutchak b516e97048 macOS: fallback to parent entry kUSBInterfaceNumber prop
In macOS 13.3 the kUSBInterfaceNumber is no longer one of the properties
of the IOHIDDevice (even if its transport is USB).

In case if kUSBInterfaceNumber property (for USB Interface number)
is not available as an IOHIDDevice property - find the value for that property
in one of the Parent IORegistry Entries.
2023-05-05 12:11:18 +03:00
Ihor Dutchak 80a206aee5 macos: (try) get USB interface only if bus_type is USB 2023-05-05 12:11:18 +03:00
Ihor Dutchak 9b44cd70d5 hidtest: print Bus Name 2023-05-05 12:11:18 +03:00
Ihor Dutchak 45a4ba5b38 ci: Docker build for Alpine (#537)
Use GithubActions Docker build for Alpine builds.
To avoid using `builds.sr.ht`.
Closes: #476
2023-05-01 13:22:19 +03:00
Ihor Dutchak 4acef346c2 ci: Docker build for Archlinux (#536)
Use GithubActions Docker build for Archlinux builds.
To avoid using `builds.sr.ht`.
Related: #476
2023-05-01 13:10:32 +03:00
Ihor Dutchak df12234504 ci: Docker build for Fedora/Mingw (#535)
Use GithubActions Docker build for Fedora/Mingw builds.
To avoid using `builds.sr.ht`.
Related: #476
2023-05-01 12:56:27 +03:00
Oleh Yudin 8588168980 Fix API definitions for clang/gcc flag -Wstrict-prototypes (#533) 2023-04-26 18:28:51 +03:00
Juuso Alasuutari 9f185ec510 libusb: fix crash in hid_enumerate() caused by a stale device handle (#526)
When hid_enumerate() iterates over the device list, it's possible
that libusb_open() fails. If this occurs on the next round after
a successful libusb_open() call, create_device_info_for_device()
is passed the previous iteration's already closed device handle.

Fix the crash by setting the handle to NULL after libusb_close().
2023-04-10 23:24:12 +03:00
Rafał Duszyński c1b9d2ad98 Properly handle the close of run loop on macOS (#522)
- as per documentation `kCFRunLoopRunStopped` should be handled once the runloop is closed via `CFRunLoopStop`;
- if it is not handled - a race condition/crash may happen on the latest macOS when a device gets disconnected while being open;
2023-04-09 20:01:34 +03:00
Ryan Schmidt ad4a9721cb Fix typos in comments (#523) 2023-04-06 17:57:04 +03:00
Brendan e65402ff46 Automate doxygen builds (#521)
- updated the doxyfile using doxygen -u
- include hidtest/test.c as a doc'd example
- use a brief doxygen/main_page.md file as the generated site's main page
- strip absolute paths from doxygen output (which now displays as relative paths to repo root)
- add CI to build the docs and save as a CI artifact and rewrite the contents of the gh-pages branch for deployment (for master builds)
- add some missing docstrings and excluded undocumented "helper macros" to satisfy warnings output in doxygen's build log
2023-04-05 12:41:14 +03:00
Ihor Dutchak f81d485fc9 Initial Doxygen CI (fix folder) 2023-04-04 23:36:10 +03:00
Ihor Dutchak 8d31895479 Initial Doxygen CI 2023-04-04 23:25:09 +03:00
Dimitriy Ryazantcev bd6be4d83b windows: try to get USB device serial number if not provided by HidD_GetSerialNumberString (#464)
This is efficient for Xbox Common Controller class (XUSB) devices like Xbox 360 or Xbox One controllers that are missing serial number via usual HID API.
2023-03-14 00:50:57 +02:00
Ihor Dutchak 7eedb61eee doc: Shared+Static build for CMake (#517)
* doc: Shared+Static build for CMake

Document the recommended way to build both Shared and Static libraries of HIDAPI using CMake.

Closes: #424
2023-03-13 12:42:33 +02:00
Ihor Dutchak fc3eed3845 windows: Have a separate definition flag for export (#515)
On some compilers an empty definition (e.g. -DHID_API_EXPORT)
means the same as `=1` (i.e. -DHID_API_EXPORT=1), but the HID_API_EXPORT macro should be
empty in static library build case.

Having a separate compiler definition flag solves that issue.
2023-03-13 12:11:37 +02:00
Dimitriy Ryazantcev e6caff3db3 windows: Get Bluetooth device Model Number String instead of Device Name into product string (#500)
Use `Device Name` only if `Model Number String` is not available. This should better match what we have in  `USB_DEVICE_DESCRIPTOR.iProduct`

See [Bluetooth Device Information Service](https://www.bluetooth.com/specifications/specs/device-information-service-1-1/) spec for more info.
2023-03-12 22:29:34 +02:00
Ihor Dutchak 19f71a5017 hid_get_report_descriptor: bump version to 0.14.0 (#516) 2023-03-12 16:48:48 +02: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
Ozkan Sezer 88a0f029b7 mac: replace sprintf uses with snprintf (#511)
Reference issue: https://github.com/libusb/hidapi/pull/509
2023-02-22 17:16:03 +02:00
Ihor Dutchak 438d06568d windows: don't mark with dllexport in static build (#507)
Don't mark API functions with __declspec(dllexport) when building a static library on Windows.
Enforced by CMake builds.
For other builds a compile definition is available.

Related: #480
2023-02-22 02:05:47 +02:00
Ihor Dutchak eecbe74bb1 macOS: silence sprintf deprecation (#509) 2023-02-19 17:38:04 +02:00
Ihor Dutchak 4ebce6b505 Bump version to 0.13.1 hidapi-0.13.1 2023-01-09 13:31:33 +02:00
Jonas Malaco 64b778b0dd hidraw: fix number of bytes to copy from uevent in parse_uevent_info (#497)
Commit 5c9f147a07 (#432) replaced a call to strdup with an explicit
memcpy to a buffer on the stack.

However, it incorrectly used the buffer size, instead of the clamped
uevent length, as the argument to memcpy, resulting in reads past the
end of uevent:

Fix this by using uevent_len as the argument to memcpy.

Calling strndupa was considered but abandoned, as it is not standard.

Fixes: 5c9f147a07 (#432)
Fixes: 4779d63d8760
2023-01-09 13:29:52 +02:00
Ihor Dutchak fa8b961c6e Upgrade checkout and file-existence-action actions (#494)
The old versions are deprecated due to usage of Node.js 12.
2023-01-06 00:59:25 +02:00
JoergAtGithub c1b78dd9b1 Fix typo in GitHub workflow (#495) 2023-01-06 00:58:38 +02:00
Ihor Dutchak bc6997dcd3 Describe the Release process in details 2023-01-05 17:16:21 +02: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