Skip to content

Commit 8271508

Browse files
authored
Merge branch 'master' into libusb_input_size
2 parents 470c9e9 + 9904cbe commit 8271508

File tree

6 files changed

+24
-11
lines changed

6 files changed

+24
-11
lines changed

.github/workflows/builds.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ jobs:
367367
with:
368368
path: hidapisrc
369369
- name: Install dependencies
370-
run: sudo dnf install -y autoconf automake libtool mingw64-gcc cmake ninja-build make
370+
run: sudo dnf install -y autoconf automake libtool gawk mingw64-gcc cmake ninja-build make
371371
- name: Configure CMake
372372
run: |
373373
rm -rf build install
@@ -485,7 +485,7 @@ jobs:
485485
cmake \
486486
-B build/shared_test \
487487
-S hidapisrc/hidtest \
488-
-Dhidapi_ROOT=install/shared-cmake \
488+
-Dhidapi_ROOT=$(pwd)/install/shared-cmake \
489489
-DCMAKE_INSTALL_PREFIX=install/shared_test \
490490
"-DCMAKE_C_FLAGS=${GNU_COMPILE_FLAGS}"
491491
cd build/shared_test
@@ -495,7 +495,7 @@ jobs:
495495
cmake \
496496
-B build/static_test \
497497
-S hidapisrc/hidtest \
498-
-Dhidapi_ROOT=install/static-cmake \
498+
-Dhidapi_ROOT=$(pwd)/install/static-cmake \
499499
-DCMAKE_INSTALL_PREFIX=install/static_test \
500500
"-DCMAKE_C_FLAGS=${GNU_COMPILE_FLAGS}"
501501
cd build/static_test

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
| `Linux/macOS/Windows (master)` | [![GitHub Builds](https://github.com/libusb/hidapi/actions/workflows/builds.yml/badge.svg?branch=master)](https://github.com/libusb/hidapi/actions/workflows/builds.yml?query=branch%3Amaster) |
66
| `Windows (master)` | [![Build status](https://ci.appveyor.com/api/projects/status/xfmr5fo8w0re8ded/branch/master?svg=true)](https://ci.appveyor.com/project/libusb/hidapi/branch/master) |
77
| `BSD, last build (branch/PR)` | [![builds.sr.ht status](https://builds.sr.ht/~z3ntu/hidapi.svg)](https://builds.sr.ht/~z3ntu/hidapi) |
8-
| `Coverity Scan (last)` | ![Coverity Scan](https://scan.coverity.com/projects/583/badge.svg) |
8+
| `Coverity Scan (last)` | [![Coverity Scan](https://scan.coverity.com/projects/583/badge.svg)](https://scan.coverity.com/projects/hidapi) |
99

1010
HIDAPI is a multi-platform library which allows an application to interface
1111
with USB and Bluetooth HID-Class devices on Windows, Linux, FreeBSD, and macOS.

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)