head 1.3; access; symbols pkgsrc-2026Q3:1.2.0.6 pkgsrc-2026Q3-base:1.2 pkgsrc-2026Q2:1.2.0.4 pkgsrc-2026Q2-base:1.2 pkgsrc-2026Q1:1.2.0.2 pkgsrc-2026Q1-base:1.2; locks; strict; comment @ * @; 1.3 date 2026.11.16.16.48.44; author adam; state dead; branches; next 1.2; commitid CqT7AQLgWClrRH3H; 1.2 date 2026.03.17.19.13.40; author tsutsui; state Exp; branches; next 1.1; commitid rpSfAeSY9b9NtmyG; 1.1 date 2026.03.13.10.37.25; author tsutsui; state Exp; branches; next ; commitid zthTDBjLQOWoMNxG; desc @@ 1.3 log @libhidapi: updated to 0.16.0 0.16.0 general: add hid_read_interrupt(), hid_is_read_interrupted(), and hid_read_clear_interrupt() for read interruption general: add hid_set_num_input_buffers() for configuring input report buffering FreeBSD: add a native hidraw backend libusb: implement error reporting, including hid_libusb_error() libusb: add configurable timeouts for writes, output reports, and feature reports libusb: handle input reports larger than a USB packet libusb: handle read-thread creation failure without hanging device opening hidraw: add support for BUS_VIRTUAL hidraw: populate release_number from HID_FIRMWARE_VERSION when supplied by the Linux kernel winapi: fix duplicate-symbol warnings in static CMake builds winapi: improve C99 and WIN32_LEAN_AND_MEAN compatibility winapi: add Visual Studio 2026 support macOS: fix compilation with newer Apple Clang NetBSD: improve root-hub discovery and iconv compatibility general: add HIDAPI_BUILD_AS_CXX for compiling the backends as C++ general: improve pkg-config integration general: expand automated tests and build coverage general: various other fixes and improvements @ text @$NetBSD: patch-netbsd_hid.c,v 1.2 2026/03/17 19:13:40 tsutsui Exp $ - don't assume roothub addr is always zero (see NetBSD PR/60073) - check iconv(3) arg type properly --- netbsd/hid.c.orig 2025-05-18 18:25:13.000000000 +0000 +++ netbsd/hid.c @@@@ -30,6 +30,10 @@@@ #include #include #include +#ifndef ICONV_CONST +#define ICONV_CONST +#endif + #include /* NetBSD */ @@@@ -724,6 +728,7 @@@@ struct hid_device_info HID_API_EXPORT * for (size_t i = 0; i < len; i++) { char devpath[USB_MAX_DEVNAMELEN]; int bus; + struct hid_device_info *prev_end; strlcpy(devpath, "/dev/", sizeof(devpath)); strlcat(devpath, arr[i], sizeof(devpath)); @@@@ -732,7 +737,17 @@@@ struct hid_device_info HID_API_EXPORT * if (bus == -1) continue; + /* + * ehci/ohci/uhci/dwctwo etc. use 'addr 1' for root hubs + * but xhci uses 'addr 0' on NetBSD. + * Check addr 0 (that would be unused on other than xhci) + * and then check addr 1 if there is no device at addr 0. + */ + prev_end = hed.end; enumerate_usb_devices(bus, 0, hid_enumerate_callback, &hed); + if (hed.end == prev_end) + enumerate_usb_devices(bus, 1, + hid_enumerate_callback, &hed); close(bus); } @@@@ -1087,7 +1102,7 @@@@ int HID_API_EXPORT_CALL hid_get_indexed_ struct usb_string_desc usd; usb_string_descriptor_t *str; iconv_t ic; - const char *src; + ICONV_CONST char *src; size_t srcleft; char *dst; size_t dstleft; @@@@ -1131,7 +1146,7 @@@@ int HID_API_EXPORT_CALL hid_get_indexed_ return -1; } - src = (const char *) str->bString; + src = (ICONV_CONST char *)str->bString; srcleft = str->bLength - 2; dst = (char *) string; dstleft = sizeof(wchar_t[maxlen]); @ 1.2 log @libhidapi: reduce diffs from ustream implementation. Tested with ch32fun and UIAPduino on NetBSD/i386 10.1 with both ohci and xhci. Also sync DESCR with the latest version. @ text @d1 1 a1 1 $NetBSD: patch-netbsd_hid.c,v 1.1 2026/03/13 10:37:25 tsutsui Exp $ @ 1.1 log @libhidapi: update to 0.15.0 pkgsrc changes: - add PLIST_VARS for libhidapi-netbsd (NetBSD HID native backend) - pull iconv(3) const check from libusb version - check both addr 0 and 1 on enumerating devices (see NetBSD PR/60073) Upstream changes: https://github.com/libusb/hidapi/releases/tag/hidapi-0.15.0 general: Add hid_send_output_report() (#677) general: Add hid_read_error() (#721) winapi: add hid_winapi_set_write_timeout (#700) winapi: improvements for hid_get_report_descriptor/hid_winapi_descriptor_reconstruct_pp_data (#707) hidraw: report only Top-Level Usage_page/Usage pairs as 'unique' devices (#601) macOS: add option to mimic 1.0.0 compatibility version (#709) NetBSD: UHID native backend implementation (#612) libusb: add abstraction for thread model, allow building using non-POSIX runtime libusb: enable support for Xbox 360 and Xbox One controllers (#572) general: various other fixes and improvements @ text @d1 1 a1 1 $NetBSD$ d27 1 a27 1 @@@@ -732,7 +737,13 @@@@ struct hid_device_info HID_API_EXPORT * d31 6 a36 2 - enumerate_usb_devices(bus, 0, hid_enumerate_callback, &hed); + /* ehci/ohci/uhci/dwctwo etc. use 'addr 1' for root hubs */ d38 1 a38 2 + enumerate_usb_devices(bus, 1, hid_enumerate_callback, &hed); + /* xhci uses 'addr 0' so check it if no device at addr 1 */ d40 1 a40 1 + enumerate_usb_devices(bus, 0, d45 1 a45 1 @@@@ -1087,7 +1098,7 @@@@ int HID_API_EXPORT_CALL hid_get_indexed_ d54 1 a54 1 @@@@ -1131,7 +1142,7 @@@@ int HID_API_EXPORT_CALL hid_get_indexed_ @