Skip to content

Commit cd12e4e

Browse files
authored
Merge branch 'master' into use_hid_raw
2 parents c1ada62 + 9904cbe commit cd12e4e

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-7
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.15.0
1+
0.16.0

hidapi/hidapi.h

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
5353
@ingroup API
5454
*/
55-
#define HID_API_VERSION_MINOR 15
55+
#define HID_API_VERSION_MINOR 16
5656
/** @brief Static/compile-time patch version of the library.
5757
5858
@ingroup API
@@ -144,6 +144,13 @@ extern "C" {
144144
Specifications:
145145
https://www.microsoft.com/download/details.aspx?id=103325 */
146146
HID_API_BUS_SPI = 0x04,
147+
148+
/** Virtual device
149+
E.g.: https://elixir.bootlin.com/linux/v4.0/source/include/uapi/linux/input.h#L955
150+
151+
Since version 0.16.0, @ref HID_API_VERSION >= HID_API_MAKE_VERSION(0, 16, 0)
152+
*/
153+
HID_API_BUS_VIRTUAL = 0x05,
147154
} hid_bus_type;
148155

149156
/** hidapi info structure */
@@ -379,14 +386,10 @@ extern "C" {
379386
380387
This function is intended for logging/debugging purposes.
381388
382-
This function guarantees to never return NULL.
389+
This function guarantees to never return NULL for a valid @ref dev.
383390
If there was no error in the last call to hid_read/hid_read_error -
384391
the returned string clearly indicates that.
385392
386-
Any HIDAPI function that can explicitly indicate an execution failure
387-
(e.g. by an error code, or by returning NULL) - may set the error string,
388-
to be returned by this function.
389-
390393
Strings returned from hid_read_error() must not be freed by the user,
391394
i.e. owned by HIDAPI library.
392395
Device-specific error string may remain allocated at most until hid_close() is called.

linux/hid.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,7 @@ static struct hid_device_info * create_device_info_for_device(struct udev_device
683683
case BUS_I2C:
684684
case BUS_USB:
685685
case BUS_SPI:
686+
case BUS_VIRTUAL:
686687
break;
687688

688689
default:
@@ -779,6 +780,14 @@ static struct hid_device_info * create_device_info_for_device(struct udev_device
779780

780781
break;
781782

783+
case BUS_VIRTUAL:
784+
cur_dev->manufacturer_string = wcsdup(L"");
785+
cur_dev->product_string = utf8_to_wchar_t(product_name_utf8);
786+
787+
cur_dev->bus_type = HID_API_BUS_VIRTUAL;
788+
789+
break;
790+
782791
default:
783792
/* Unknown device type - this should never happen, as we
784793
* check for USB and Bluetooth devices above */

windows/hid.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,7 @@ static struct hid_device_info *hid_internal_get_device_info(const wchar_t *path,
804804
case HID_API_BUS_UNKNOWN:
805805
case HID_API_BUS_SPI:
806806
case HID_API_BUS_I2C:
807+
case HID_API_BUS_VIRTUAL:
807808
/* shut down -Wswitch */
808809
break;
809810
}

0 commit comments

Comments
 (0)