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.
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().
- 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;
- 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
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.
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.
- 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;
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
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
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.