Index: lib/libusb/libusb.h =================================================================== --- lib/libusb/libusb.h +++ lib/libusb/libusb.h @@ -54,6 +54,7 @@ LIBUSB_CLASS_AUDIO = 1, LIBUSB_CLASS_COMM = 2, LIBUSB_CLASS_HID = 3, + LIBUSB_CLASS_PHYSICAL = 5, LIBUSB_CLASS_PTP = 6, LIBUSB_CLASS_IMAGE = 6, LIBUSB_CLASS_PRINTER = 7, @@ -70,6 +71,13 @@ LIBUSB_CLASS_VENDOR_SPEC = 0xff, }; +/* + * XXX Temporary hack to keep ports happy for the time being. This will be + * reverted in due time, when such macro checks are instead replaced with + * the appropriate __FreeBSD_version checks. + */ +#define LIBUSB_CLASS_PHYSICAL LIBUSB_CLASS_PHYSICAL + enum libusb_descriptor_type { LIBUSB_DT_DEVICE = 0x01, LIBUSB_DT_CONFIG = 0x02, @@ -178,6 +186,21 @@ LIBUSB_BT_CONTAINER_ID = 4, }; +enum libusb_capability { + /* libusb supports libusb_has_capability(). */ + LIBUSB_CAP_HAS_CAPABILITY = 0, + /* Hotplug support is available. */ + LIBUSB_CAP_HAS_HOTPLUG, + /* Can access HID devices without requiring user intervention. */ + LIBUSB_CAP_HAS_HID_ACCESS, + + /* + * Supports detaching of the default USB driver with + * libusb_detach_kernel(). + */ + LIBUSB_CAP_SUPPORTS_DETACH_KERNEL_DRIVER, +}; + enum libusb_error { LIBUSB_SUCCESS = 0, LIBUSB_ERROR_IO = -1, @@ -450,6 +473,7 @@ const char *libusb_error_name(int code); int libusb_init(libusb_context ** context); void libusb_exit(struct libusb_context *ctx); +int libusb_has_capability(uint32_t capability); /* Device handling and enumeration */ Index: lib/libusb/libusb10.c =================================================================== --- lib/libusb/libusb10.c +++ lib/libusb/libusb10.c @@ -1716,3 +1716,18 @@ return ("LIBUSB_ERROR_UNKNOWN"); } } + +int +libusb_has_capability(uint32_t capability) +{ + + switch (capability) { + case LIBUSB_CAP_HAS_CAPABILITY: + case LIBUSB_CAP_HAS_HOTPLUG: + case LIBUSB_CAP_HAS_HID_ACCESS: + case LIBUSB_CAP_SUPPORTS_DETACH_KERNEL_DRIVER: + return (1); + default: + return (0); + } +}