├── .appveyor.yml ├── .builds ├── freebsd.yml ├── netbsd.yml └── openbsd.yml ├── .cirrus.yml ├── .gitattributes ├── .github └── workflows │ ├── builds.yml │ └── docs.yaml ├── .gitignore ├── AUTHORS.txt ├── BUILD.autotools.md ├── BUILD.cmake.md ├── BUILD.md ├── CMakeLists.txt ├── HACKING.txt ├── LICENSE-bsd.txt ├── LICENSE-gpl3.txt ├── LICENSE-orig.txt ├── LICENSE.txt ├── Makefile.am ├── README.md ├── VERSION ├── android └── jni │ └── Android.mk ├── bootstrap ├── configure.ac ├── dist └── hidapi.podspec ├── documentation ├── cmake-gui-drop-down.png └── cmake-gui-highlights.png ├── doxygen ├── Doxyfile └── main_page.md ├── hidapi └── hidapi.h ├── hidtest ├── .gitignore ├── CMakeLists.txt ├── Makefile.am └── test.c ├── libusb ├── .gitignore ├── CMakeLists.txt ├── Makefile-manual ├── Makefile.am ├── Makefile.freebsd ├── Makefile.haiku ├── Makefile.linux ├── hid.c └── hidapi_libusb.h ├── linux ├── .gitignore ├── CMakeLists.txt ├── Makefile-manual ├── Makefile.am └── hid.c ├── m4 ├── .gitignore ├── ax_pthread.m4 └── pkg.m4 ├── mac ├── .gitignore ├── CMakeLists.txt ├── Makefile-manual ├── Makefile.am ├── hid.c └── hidapi_darwin.h ├── meson.build ├── pc ├── .gitignore ├── hidapi-hidraw.pc.in ├── hidapi-libusb.pc.in └── hidapi.pc.in ├── src ├── CMakeLists.txt └── cmake │ └── hidapi-config.cmake.in ├── subprojects ├── README.md └── hidapi_build_cmake │ └── CMakeLists.txt ├── testgui ├── .gitignore ├── Makefile-manual ├── Makefile.am ├── Makefile.freebsd ├── Makefile.linux ├── Makefile.mac ├── Makefile.mingw ├── TestGUI.app.in │ └── Contents │ │ ├── Info.plist │ │ ├── PkgInfo │ │ └── Resources │ │ ├── English.lproj │ │ └── InfoPlist.strings │ │ └── Signal11.icns ├── copy_to_bundle.sh ├── mac_support.h ├── mac_support_cocoa.m ├── test.cpp ├── testgui.sln └── testgui.vcproj ├── udev └── 69-hid.rules └── windows ├── .gitignore ├── CMakeLists.txt ├── Makefile-manual ├── Makefile.am ├── Makefile.mingw ├── hid.c ├── hidapi.rc ├── hidapi.sln ├── hidapi.vcproj ├── hidapi.vcxproj ├── hidapi.vcxproj.filters ├── hidapi_cfgmgr32.h ├── hidapi_descriptor_reconstruct.c ├── hidapi_descriptor_reconstruct.h ├── hidapi_hidclass.h ├── hidapi_hidpi.h ├── hidapi_hidsdi.h ├── hidapi_winapi.h ├── hidtest.vcproj ├── hidtest.vcxproj ├── hidtest.vcxproj.filters ├── pp_data_dump ├── CMakeLists.txt ├── README.md └── pp_data_dump.c └── test ├── CMakeLists.txt ├── data ├── 045E_02FF_0005_0001.pp_data ├── 045E_02FF_0005_0001_expected.rpt_desc ├── 045E_02FF_0005_0001_real.rpt_desc ├── 046A_0011_0006_0001.pp_data ├── 046A_0011_0006_0001_expected.rpt_desc ├── 046A_0011_0006_0001_real.rpt_desc ├── 046D_0A37_0001_000C.pp_data ├── 046D_0A37_0001_000C_expected.rpt_desc ├── 046D_0A37_0001_000C_real.rpt_desc ├── 046D_B010_0001_000C.pp_data ├── 046D_B010_0001_000C_expected.rpt_desc ├── 046D_B010_0001_000C_real.rpt_desc ├── 046D_B010_0001_FF00.pp_data ├── 046D_B010_0001_FF00_expected.rpt_desc ├── 046D_B010_0001_FF00_real.rpt_desc ├── 046D_B010_0002_0001.pp_data ├── 046D_B010_0002_0001_expected.rpt_desc ├── 046D_B010_0002_0001_real.rpt_desc ├── 046D_B010_0002_FF00.pp_data ├── 046D_B010_0002_FF00_expected.rpt_desc ├── 046D_B010_0002_FF00_real.rpt_desc ├── 046D_B010_0006_0001.pp_data ├── 046D_B010_0006_0001_expected.rpt_desc ├── 046D_B010_0006_0001_real.rpt_desc ├── 046D_C077_0002_0001.pp_data ├── 046D_C077_0002_0001_expected.rpt_desc ├── 046D_C077_0002_0001_real.rpt_desc ├── 046D_C283_0004_0001.pp_data ├── 046D_C283_0004_0001_expected.rpt_desc ├── 046D_C283_0004_0001_real.rpt_desc ├── 046D_C52F_0001_000C.pp_data ├── 046D_C52F_0001_000C_expected.rpt_desc ├── 046D_C52F_0001_000C_real.rpt_desc ├── 046D_C52F_0001_FF00.pp_data ├── 046D_C52F_0001_FF00_expected.rpt_desc ├── 046D_C52F_0001_FF00_real.rpt_desc ├── 046D_C52F_0002_0001.pp_data ├── 046D_C52F_0002_0001_expected.rpt_desc ├── 046D_C52F_0002_0001_real.rpt_desc ├── 046D_C52F_0002_FF00.pp_data ├── 046D_C52F_0002_FF00_expected.rpt_desc ├── 046D_C52F_0002_FF00_real.rpt_desc ├── 046D_C534_0001_000C.pp_data ├── 046D_C534_0001_000C_expected.rpt_desc ├── 046D_C534_0001_000C_real.rpt_desc ├── 046D_C534_0001_FF00.pp_data ├── 046D_C534_0001_FF00_expected.rpt_desc ├── 046D_C534_0001_FF00_real.rpt_desc ├── 046D_C534_0002_0001.pp_data ├── 046D_C534_0002_0001_expected.rpt_desc ├── 046D_C534_0002_0001_real.rpt_desc ├── 046D_C534_0002_FF00.pp_data ├── 046D_C534_0002_FF00_expected.rpt_desc ├── 046D_C534_0002_FF00_real.rpt_desc ├── 046D_C534_0006_0001.pp_data ├── 046D_C534_0006_0001_expected.rpt_desc ├── 046D_C534_0006_0001_real.rpt_desc ├── 046D_C534_0080_0001.pp_data ├── 046D_C534_0080_0001_expected.rpt_desc ├── 046D_C534_0080_0001_real.rpt_desc ├── 047F_C056_0001_000C.pp_data ├── 047F_C056_0001_000C_expected.rpt_desc ├── 047F_C056_0001_000C_real.rpt_desc ├── 047F_C056_0003_FFA0.pp_data ├── 047F_C056_0003_FFA0_expected.rpt_desc ├── 047F_C056_0003_FFA0_real.rpt_desc ├── 047F_C056_0005_000B.pp_data ├── 047F_C056_0005_000B_expected.rpt_desc ├── 047F_C056_0005_000B_real.rpt_desc ├── 17CC_1130_0000_FF01.pp_data ├── 17CC_1130_0000_FF01_expected.rpt_desc └── 17CC_1130_0000_FF01_real.rpt_desc └── hid_report_reconstructor_test.c /.appveyor.yml: -------------------------------------------------------------------------------- 1 | environment: 2 | matrix: 3 | - BUILD_ENV: msbuild 4 | arch: x64 5 | - BUILD_ENV: msbuild 6 | arch: Win32 7 | - BUILD_ENV: cygwin 8 | 9 | for: 10 | - 11 | matrix: 12 | only: 13 | - BUILD_ENV: msbuild 14 | 15 | os: Visual Studio 2015 16 | 17 | build_script: 18 | - cmd: msbuild .\windows\hidapi.sln /p:Configuration=Release /p:Platform=%arch% /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" 19 | 20 | - 21 | matrix: 22 | only: 23 | - BUILD_ENV: cygwin 24 | 25 | os: Visual Studio 2022 26 | 27 | install: 28 | - cmd: C:\cygwin64\setup-x86_64.exe --quiet-mode --no-shortcuts --upgrade-also --packages autoconf,automake 29 | 30 | build_script: 31 | - cmd: C:\cygwin64\bin\bash -exlc "cd $APPVEYOR_BUILD_FOLDER; ./bootstrap; ./configure; make" 32 | -------------------------------------------------------------------------------- /.builds/freebsd.yml: -------------------------------------------------------------------------------- 1 | image: freebsd/latest 2 | packages: 3 | - autoconf 4 | - automake 5 | - gmake 6 | - libiconv 7 | - libtool 8 | - pkgconf 9 | - cmake 10 | - ninja 11 | sources: 12 | - https://github.com/libusb/hidapi 13 | tasks: 14 | - configure: | 15 | cd hidapi 16 | echo Configure Autotools build 17 | ./bootstrap 18 | ./configure 19 | echo Configure CMake build 20 | mkdir -p build install_cmake 21 | cmake -GNinja -B build -S . -DCMAKE_INSTALL_PREFIX=install_cmake 22 | - build-autotools: | 23 | cd hidapi 24 | make 25 | make DESTDIR=$PWD/root install 26 | make clean 27 | - build-cmake: | 28 | cd hidapi/build 29 | ninja 30 | ninja install 31 | ninja clean 32 | - build-manual: | 33 | cd hidapi/libusb 34 | gmake -f Makefile-manual 35 | -------------------------------------------------------------------------------- /.builds/netbsd.yml: -------------------------------------------------------------------------------- 1 | image: netbsd/latest 2 | packages: 3 | - cmake 4 | - pkgconf 5 | - libusb1 6 | - libiconv 7 | sources: 8 | - https://github.com/libusb/hidapi 9 | tasks: 10 | - configure: | 11 | cd hidapi 12 | mkdir -p build install 13 | cmake -B build -S . -DCMAKE_INSTALL_PREFIX=install 14 | - build: | 15 | cd hidapi/build 16 | make 17 | make install 18 | make clean 19 | -------------------------------------------------------------------------------- /.builds/openbsd.yml: -------------------------------------------------------------------------------- 1 | image: openbsd/latest 2 | packages: 3 | - cmake 4 | - pkgconf 5 | - libusb1-- 6 | - libiconv 7 | - ninja 8 | sources: 9 | - https://github.com/libusb/hidapi 10 | tasks: 11 | - configure: | 12 | cd hidapi 13 | mkdir -p build install 14 | cmake -GNinja -B build -S . -DCMAKE_INSTALL_PREFIX=install 15 | - build: | 16 | cd hidapi/build 17 | ninja 18 | ninja install 19 | ninja clean 20 | -------------------------------------------------------------------------------- /.cirrus.yml: -------------------------------------------------------------------------------- 1 | alpine_task: 2 | container: 3 | image: alpine:latest 4 | install_script: apk add autoconf automake g++ gcc libusb-dev libtool linux-headers eudev-dev make musl-dev 5 | script: 6 | - ./bootstrap 7 | - ./configure || { cat config.log; exit 1; } 8 | - make 9 | - make install 10 | 11 | freebsd11_task: 12 | freebsd_instance: 13 | image: freebsd-11-2-release-amd64 14 | install_script: 15 | - pkg install -y 16 | autoconf automake libiconv libtool pkgconf 17 | script: 18 | - ./bootstrap 19 | - ./configure || { cat config.log; exit 1; } 20 | - make 21 | - make install 22 | 23 | freebsd12_task: 24 | freebsd_instance: 25 | image: freebsd-12-1-release-amd64 26 | install_script: 27 | - pkg install -y 28 | autoconf automake libiconv libtool pkgconf 29 | script: 30 | - ./bootstrap 31 | - ./configure || { cat config.log; exit 1; } 32 | - make 33 | - make install 34 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | 3 | *.sln text eol=crlf 4 | *.vcproj text eol=crlf 5 | 6 | bootstrap text eol=lf 7 | configure.ac text eol=lf 8 | -------------------------------------------------------------------------------- /.github/workflows/docs.yaml: -------------------------------------------------------------------------------- 1 | name: Docs 2 | 3 | on: 4 | push: 5 | branches: [master] 6 | pull_request: 7 | branches: [master] 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | steps: 13 | 14 | - name: Install Doxygen static libclang deps 15 | run: sudo apt-get install libclang1-12 libclang-cpp12 16 | 17 | - name: Install Doxygen from SF binary archives 18 | env: 19 | DOXYGEN_VERSION: '1.9.6' 20 | run: | 21 | mkdir .doxygen && cd .doxygen 22 | curl -L https://sourceforge.net/projects/doxygen/files/rel-$DOXYGEN_VERSION/doxygen-$DOXYGEN_VERSION.linux.bin.tar.gz > doxygen.tar.gz 23 | gunzip doxygen.tar.gz 24 | tar xf doxygen.tar 25 | cd doxygen-$DOXYGEN_VERSION 26 | sudo make install 27 | 28 | - uses: actions/checkout@v3 29 | 30 | - run: doxygen 31 | working-directory: doxygen 32 | 33 | - name: Save doxygen docs as artifact 34 | uses: actions/upload-artifact@v3 35 | with: 36 | name: HIDAPI_doxygen_docs 37 | path: ${{ github.workspace }}/doxygen/html 38 | 39 | deploy-docs: 40 | runs-on: ubuntu-latest 41 | needs: [build] 42 | if: github.ref_type == 'branch' && github.ref_name == 'master' 43 | concurrency: 44 | group: "github-pages-deploy" 45 | cancel-in-progress: true 46 | steps: 47 | - name: downlod artifact 48 | uses: actions/download-artifact@v3 49 | with: 50 | name: HIDAPI_doxygen_docs 51 | path: docs 52 | 53 | - name: upload to github pages 54 | uses: peaceiris/actions-gh-pages@v3 55 | with: 56 | github_token: ${{ secrets.GITHUB_TOKEN }} 57 | publish_dir: ./docs 58 | force_orphan: true 59 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Autotools-added generated files 3 | Makefile.in 4 | aclocal.m4 5 | ar-lib 6 | autom4te.cache/ 7 | config.* 8 | configure 9 | configure~ 10 | compile 11 | depcomp 12 | install-sh 13 | libusb/Makefile.in 14 | linux/Makefile.in 15 | ltmain.sh 16 | mac/Makefile.in 17 | missing 18 | testgui/Makefile.in 19 | windows/Makefile.in 20 | 21 | Makefile 22 | stamp-h1 23 | libtool 24 | 25 | # macOS 26 | .DS_Store 27 | 28 | # Qt Creator 29 | CMakeLists.txt.user 30 | 31 | # doxgen output 32 | doxygen/html/ 33 | -------------------------------------------------------------------------------- /AUTHORS.txt: -------------------------------------------------------------------------------- 1 | 2 | HIDAPI Authors: 3 | 4 | Alan Ott : 5 | Original Author and Maintainer 6 | Linux, Windows, and Mac implementations 7 | 8 | Ludovic Rousseau : 9 | Formatting for Doxygen documentation 10 | Bug fixes 11 | Correctness fixes 12 | 13 | libusb/hidapi Team: 14 | Development/maintainance since June 4th 2019 15 | 16 | For a comprehensive list of contributions, see the commit list at github: 17 | https://github.com/libusb/hidapi/graphs/contributors 18 | 19 | -------------------------------------------------------------------------------- /BUILD.autotools.md: -------------------------------------------------------------------------------- 1 | # Building HIDAPI using Autotools (deprecated) 2 | 3 | --- 4 | **NOTE**: for all intentions and purposes the Autotools build scripts for HIDAPI are _deprecated_ and going to be obsolete in the future. 5 | HIDAPI Team recommends using CMake build for HIDAPI. 6 | If you are already using Autotools build scripts provided by HIDAPI, 7 | consider switching to CMake build scripts as soon as possible. 8 | 9 | --- 10 | 11 | To be able to use Autotools to build HIDAPI, it has to be [installed](#installing-autotools)/available in the system. 12 | 13 | Make sure you've checked [prerequisites](BUILD.md#prerequisites) and installed all required dependencies. 14 | 15 | ## Installing Autotools 16 | 17 | HIDAPI uses few specific tools/packages from Autotools: `autoconf`, `automake`, `libtool`. 18 | 19 | On different platforms or package managers, those could be named a bit differently or packaged together. 20 | You'll have to check the documentation/package list for your specific package manager. 21 | 22 | ### Linux 23 | 24 | On Ubuntu the tools are available via APT: 25 | 26 | ```sh 27 | sudo apt install autoconf automake libtool 28 | ``` 29 | 30 | ### FreeBSD 31 | 32 | FreeBSD Autotools can be installed as: 33 | 34 | ```sh 35 | pkg_add -r autotools 36 | ``` 37 | 38 | Additionally, on FreeBSD you will need to install GNU make: 39 | ```sh 40 | pkg_add -r gmake 41 | ``` 42 | 43 | ## Building HIDAPI with Autotools 44 | 45 | A simple command list, to build HIDAPI with Autotools as a _shared library_ and install in into your system: 46 | 47 | ```sh 48 | ./bootstrap # this prepares the configure script 49 | ./configure 50 | make # build the library 51 | make install # as root, or using sudo, this will install hidapi into your system 52 | ``` 53 | 54 | `./configure` can take several arguments which control the build. A few commonly used options: 55 | ```sh 56 | --enable-testgui 57 | # Enable the build of Foxit-based Test GUI. This requires Fox toolkit to 58 | # be installed/available. See README.md#test-gui for remarks. 59 | 60 | --prefix=/usr 61 | # Specify where you want the output headers and libraries to 62 | # be installed. The example above will put the headers in 63 | # /usr/include and the binaries in /usr/lib. The default is to 64 | # install into /usr/local which is fine on most systems. 65 | 66 | --disable-shared 67 | # By default, both shared and static libraries are going to be built/installed. 68 | # This option disables shared library build, if only static library is required. 69 | ``` 70 | 71 | 72 | ## Cross Compiling 73 | 74 | This section talks about cross compiling HIDAPI for Linux using Autotools. 75 | This is useful for using HIDAPI on embedded Linux targets. These 76 | instructions assume the most raw kind of embedded Linux build, where all 77 | prerequisites will need to be built first. This process will of course vary 78 | based on your embedded Linux build system if you are using one, such as 79 | OpenEmbedded or Buildroot. 80 | 81 | For the purpose of this section, it will be assumed that the following 82 | environment variables are exported. 83 | ```sh 84 | $ export STAGING=$HOME/out 85 | $ export HOST=arm-linux 86 | ``` 87 | 88 | `STAGING` and `HOST` can be modified to suit your setup. 89 | 90 | ### Prerequisites 91 | 92 | Depending on what backend you want to cross-compile, you also need to prepare the dependencies: 93 | `libusb` for libusb HIDAPI backend, or `libudev` for hidraw HIDAPI backend. 94 | 95 | An example of cross-compiling `libusb`. From `libusb` source directory, run: 96 | ```sh 97 | ./configure --host=$HOST --prefix=$STAGING 98 | make 99 | make install 100 | ``` 101 | 102 | An example of cross-comping `libudev` is not covered by this section. 103 | Check `libudev`'s documentation for details. 104 | 105 | ### Building HIDAPI 106 | 107 | Build HIDAPI: 108 | ```sh 109 | PKG_CONFIG_DIR= \ 110 | PKG_CONFIG_LIBDIR=$STAGING/lib/pkgconfig:$STAGING/share/pkgconfig \ 111 | PKG_CONFIG_SYSROOT_DIR=$STAGING \ 112 | ./configure --host=$HOST --prefix=$STAGING 113 | # make / make install - same as for a regular build 114 | ``` 115 | -------------------------------------------------------------------------------- /BUILD.md: -------------------------------------------------------------------------------- 1 | # Building HIDAPI from Source 2 | 3 | ## Table of content 4 | 5 | * [Intro](#intro) 6 | * [Prerequisites](#prerequisites) 7 | * [Linux](#linux) 8 | * [FreeBSD](#freebsd) 9 | * [Mac](#mac) 10 | * [Windows](#windows) 11 | * [Embedding HIDAPI directly into your source tree](#embedding-hidapi-directly-into-your-source-tree) 12 | * [Building the manual way on Unix platforms](#building-the-manual-way-on-unix-platforms) 13 | * [Building on Windows](#building-on-windows) 14 | 15 | ## Intro 16 | 17 | For various reasons, you may need to build HIDAPI on your own. 18 | 19 | It can be done in several different ways: 20 | - using [CMake](BUILD.cmake.md); 21 | - using [Autotools](BUILD.autotools.md) (deprecated); 22 | - using [manual makefiles](#building-the-manual-way-on-unix-platforms); 23 | - using `Meson` (requires CMake); 24 | 25 | **Autotools** build system is historically the first mature build system for 26 | HIDAPI. The most common usage of it is in its separate README: [BUILD.autotools.md](BUILD.autotools.md).
27 | NOTE: for all intentions and purposes the Autotools build scripts for HIDAPI are _deprecated_ and going to be obsolete in the future. 28 | HIDAPI Team recommends using CMake build for HIDAPI. 29 | 30 | **CMake** build system is de facto an industry standard for many open-source and proprietary projects and solutions. 31 | HIDAPI is one of the projects which use the power of CMake to its advantage. 32 | More documentation is available in its separate README: [BUILD.cmake.md](BUILD.cmake.md). 33 | 34 | **Meson** build system for HIDAPI is designed as a [wrapper](https://mesonbuild.com/CMake-module.html) over CMake build script. 35 | It is present for the convenience of Meson users who need to use HIDAPI and need to be sure HIDAPI is built in accordance with officially supported build scripts.
36 | In the Meson script of your project you need a `hidapi = subproject('hidapi')` subproject, and `hidapi.get_variable('hidapi_dep')` as your dependency. 37 | There are also backend/platform-specific dependencies available: `hidapi_winapi`, `hidapi_darwin`, `hidapi_hidraw`, `hidapi_libusb`. 38 | 39 | If you don't know where to start to build HIDAPI, we recommend starting with [CMake](BUILD.cmake.md) build. 40 | 41 | ## Prerequisites: 42 | 43 | Regardless of what build system you choose to use, there are specific dependencies for each platform/backend. 44 | 45 | ### Linux: 46 | 47 | Depending on which backend you're going to build, you'll need to install 48 | additional development packages. For `linux/hidraw` backend, you need a 49 | development package for `libudev`. For `libusb` backend, naturally, you need 50 | `libusb` development package. 51 | 52 | On Debian/Ubuntu systems these can be installed by running: 53 | ```sh 54 | # required only by hidraw backend 55 | sudo apt install libudev-dev 56 | # required only by libusb backend 57 | sudo apt install libusb-1.0-0-dev 58 | ``` 59 | 60 | ### FreeBSD: 61 | 62 | On FreeBSD, you will need to install libiconv. This is done by running 63 | the following: 64 | ```sh 65 | pkg_add -r libiconv 66 | ``` 67 | 68 | ### Mac: 69 | 70 | Make sure you have XCode installed and its Command Line Tools. 71 | 72 | ### Windows: 73 | 74 | You just need a compiler. You may use Visual Studio or Cygwin/MinGW, 75 | depending on which environment is best for your needs. 76 | 77 | ## Embedding HIDAPI directly into your source tree 78 | 79 | Instead of using one of the provided standalone build systems, 80 | you may want to integrate HIDAPI directly into your source tree. 81 | 82 | --- 83 | If your project uses CMake as a build system, it is safe to add HIDAPI as a [subdirectory](BUILD.cmake.md#hidapi-as-a-subdirectory). 84 | 85 | --- 86 | If _the only option_ that works for you is adding HIDAPI sources directly 87 | to your project's build system, then you need: 88 | - include a _single source file_ into your project's build system, 89 | depending on your platform and the backend you want to use: 90 | - [`windows\hid.c`](windows/hid.c); 91 | - [`linux/hid.c`](linux/hid.c); 92 | - [`libusb/hid.c`](libusb/hid.c); 93 | - [`mac/hid.c`](mac/hid.c); 94 | - add a [`hidapi`](hidapi) folder to the include path when building `hid.c`; 95 | - make the platform/backend specific [dependencies](#prerequisites) available during the compilation/linking, when building `hid.c`; 96 | 97 | NOTE: the above doesn't guarantee that having a copy of `/hid.c` and `hidapi/hidapi.h` is enough to build HIDAPI. 98 | The only guarantee that `/hid.c` includes all necessary sources to compile it as a single file. 99 | 100 | Check the manual makefiles for a simple example/reference of what are the dependencies of each specific backend. 101 | 102 | ## Building the manual way on Unix platforms 103 | 104 | Manual Makefiles are provided mostly to give the user an idea what it takes 105 | to build a program which embeds HIDAPI directly inside of it. These should 106 | really be used as examples only. If you want to build a system-wide shared 107 | library, use one of the build systems mentioned above. 108 | 109 | To build HIDAPI using the manual Makefiles, change the directory 110 | of your platform and run make. For example, on Linux run: 111 | ```sh 112 | cd linux/ 113 | make -f Makefile-manual 114 | ``` 115 | 116 | ## Building on Windows 117 | 118 | To build the HIDAPI DLL on Windows using Visual Studio, build the `.sln` file 119 | in the `windows/` directory. 120 | 121 | To build HIDAPI using MinGW or Cygwin using Autotools, use general Autotools 122 | [instruction](BUILD.autotools.md). 123 | 124 | Any windows builds (MSVC or MinGW/Cygwin) are also supported by [CMake](BUILD.cmake.md). 125 | 126 | If you are looking for information regarding DDK build of HIDAPI: 127 | - the build has been broken for a while and now the support files are obsolete. 128 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.1.3 FATAL_ERROR) 2 | 3 | if(NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) 4 | add_subdirectory(src) 5 | # compatibility with find_package() vs add_subdirectory 6 | set(hidapi_VERSION "${hidapi_VERSION}" PARENT_SCOPE) 7 | return() 8 | endif() 9 | # All of the below in this file is meant for a standalone build. 10 | # When building as a subdirectory of a larger project, most of the options may not make sense for it, 11 | # so it is up to developer to configure those, e.g.: 12 | # 13 | # # a subfolder of a master project, e.g.: 3rdparty/hidapi/CMakeLists.txt 14 | # 15 | # set(HIDAPI_WITH_HIDRAW OFF) 16 | # set(CMAKE_FRAMEWORK ON) 17 | # # and keep everything else to their defaults 18 | # add_subdirectory(hidapi) 19 | # 20 | 21 | set(DEFAULT_CMAKE_BUILD_TYPES "Debug" "Release" "MinSizeRel" "RelWithDebInfo") 22 | if(NOT DEFINED CMAKE_BUILD_TYPE OR NOT CMAKE_BUILD_TYPE) 23 | set(CMAKE_BUILD_TYPE "Release" CACHE STRING "${DEFAULT_CMAKE_BUILD_TYPES}" FORCE) 24 | endif() 25 | # This part is for convenience, when used one of the standard build types with cmake-gui 26 | list(FIND DEFAULT_CMAKE_BUILD_TYPES "${CMAKE_BUILD_TYPE}" _build_type_index) 27 | if(${_build_type_index} GREATER -1) 28 | # set it optionally, so a custom CMAKE_BUILD_TYPE can be used as well, if needed 29 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${DEFAULT_CMAKE_BUILD_TYPES}) 30 | endif() 31 | unset(_build_type_index) 32 | # 33 | 34 | project(hidapi LANGUAGES C) 35 | 36 | if(APPLE) 37 | if(NOT CMAKE_VERSION VERSION_LESS "3.15") 38 | option(CMAKE_FRAMEWORK "Build macOS/iOS Framework version of the library" OFF) 39 | endif() 40 | elseif(NOT WIN32) 41 | if(CMAKE_SYSTEM_NAME MATCHES "Linux") 42 | option(HIDAPI_WITH_HIDRAW "Build HIDRAW-based implementation of HIDAPI" ON) 43 | option(HIDAPI_WITH_LIBUSB "Build LIBUSB-based implementation of HIDAPI" ON) 44 | endif() 45 | endif() 46 | 47 | option(BUILD_SHARED_LIBS "Build shared version of the libraries, otherwise build statically" ON) 48 | 49 | set(HIDAPI_INSTALL_TARGETS ON) 50 | set(HIDAPI_PRINT_VERSION ON) 51 | 52 | set(IS_DEBUG_BUILD OFF) 53 | if(CMAKE_BUILD_TYPE STREQUAL "Debug") 54 | set(IS_DEBUG_BUILD ON) 55 | endif() 56 | 57 | option(HIDAPI_ENABLE_ASAN "Build HIDAPI with ASAN address sanitizer instrumentation" OFF) 58 | 59 | if(HIDAPI_ENABLE_ASAN) 60 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address") 61 | if(MSVC) 62 | # the default is to have "/INCREMENTAL" which causes a warning when "-fsanitize=address" is present 63 | set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /INCREMENTAL:NO") 64 | set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} /INCREMENTAL:NO") 65 | set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} /INCREMENTAL:NO") 66 | set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO} /INCREMENTAL:NO") 67 | endif() 68 | endif() 69 | 70 | if(WIN32) 71 | # so far only Windows has tests 72 | option(HIDAPI_WITH_TESTS "Build HIDAPI (unit-)tests" ${IS_DEBUG_BUILD}) 73 | else() 74 | set(HIDAPI_WITH_TESTS OFF) 75 | endif() 76 | 77 | if(HIDAPI_WITH_TESTS) 78 | enable_testing() 79 | endif() 80 | 81 | if(WIN32) 82 | option(HIDAPI_BUILD_PP_DATA_DUMP "Build small Windows console application pp_data_dump.exe" ${IS_DEBUG_BUILD}) 83 | endif() 84 | 85 | add_subdirectory(src) 86 | 87 | option(HIDAPI_BUILD_HIDTEST "Build small console test application hidtest" ${IS_DEBUG_BUILD}) 88 | if(HIDAPI_BUILD_HIDTEST) 89 | add_subdirectory(hidtest) 90 | endif() 91 | 92 | if(HIDAPI_ENABLE_ASAN) 93 | if(NOT MSVC) 94 | # MSVC doesn't recognize those options, other compilers - requiring it 95 | foreach(HIDAPI_TARGET hidapi_winapi hidapi_darwin hidapi_hidraw hidapi_libusb hidtest_hidraw hidtest_libusb hidtest) 96 | if(TARGET ${HIDAPI_TARGET}) 97 | if(BUILD_SHARED_LIBS) 98 | target_link_options(${HIDAPI_TARGET} PRIVATE -fsanitize=address) 99 | else() 100 | target_link_options(${HIDAPI_TARGET} PUBLIC -fsanitize=address) 101 | endif() 102 | endif() 103 | endforeach() 104 | endif() 105 | endif() 106 | -------------------------------------------------------------------------------- /HACKING.txt: -------------------------------------------------------------------------------- 1 | This file is mostly for the maintainer. 2 | 3 | Updating a Version: 4 | 1. Update VERSION file. 5 | 2. HID_API_VERSION_MAJOR/HID_API_VERSION_MINOR/HID_API_VERSION_PATCH in hidapi.h. 6 | 7 | Firing a new release: 8 | 1. Update the Version (if not yet updated). 9 | 2. Prepare the Release Notes. 10 | 3. Store the Release Notes into a file. 11 | 4. Create locally an annotated git tag with release notes attached, e.g.: `git tag -aF ../hidapi_release_notes hidapi-` 12 | 5. Push newly created tag: `git push origin hidapi-` 13 | 6. Grab the hidapi-win.zip from Summary page of "GitHub Builds" Action for latest master build. 14 | 7. Create a Github Release with hidapi-win.zip attached, for newly created tag. 15 | -------------------------------------------------------------------------------- /LICENSE-bsd.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010, Alan Ott, Signal 11 Software 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of Signal 11 Software nor the names of its 13 | contributors may be used to endorse or promote products derived from 14 | this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | POSSIBILITY OF SUCH DAMAGE. 27 | -------------------------------------------------------------------------------- /LICENSE-orig.txt: -------------------------------------------------------------------------------- 1 | HIDAPI - Multi-Platform library for 2 | communication with HID devices. 3 | 4 | Copyright 2009, Alan Ott, Signal 11 Software. 5 | All Rights Reserved. 6 | 7 | This software may be used by anyone for any reason so 8 | long as the copyright notice in the source files 9 | remains intact. 10 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | HIDAPI can be used under one of three licenses. 2 | 3 | 1. The GNU General Public License, version 3.0, in LICENSE-gpl3.txt 4 | 2. A BSD-Style License, in LICENSE-bsd.txt. 5 | 3. The more liberal original HIDAPI license. LICENSE-orig.txt 6 | 7 | The license chosen is at the discretion of the user of HIDAPI. For example: 8 | 1. An author of GPL software would likely use HIDAPI under the terms of the 9 | GPL. 10 | 11 | 2. An author of commercial closed-source software would likely use HIDAPI 12 | under the terms of the BSD-style license or the original HIDAPI license. 13 | 14 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | ACLOCAL_AMFLAGS = -I m4 3 | 4 | if OS_FREEBSD 5 | pkgconfigdir=$(prefix)/libdata/pkgconfig 6 | else 7 | pkgconfigdir=$(libdir)/pkgconfig 8 | endif 9 | 10 | if OS_LINUX 11 | pkgconfig_DATA=pc/hidapi-hidraw.pc pc/hidapi-libusb.pc 12 | else 13 | pkgconfig_DATA=pc/hidapi.pc 14 | endif 15 | 16 | SUBDIRS= 17 | 18 | if OS_LINUX 19 | SUBDIRS += linux libusb 20 | endif 21 | 22 | if OS_DARWIN 23 | SUBDIRS += mac 24 | endif 25 | 26 | if OS_FREEBSD 27 | SUBDIRS += libusb 28 | endif 29 | 30 | if OS_KFREEBSD 31 | SUBDIRS += libusb 32 | endif 33 | 34 | if OS_HAIKU 35 | SUBDIRS += libusb 36 | endif 37 | 38 | if OS_WINDOWS 39 | SUBDIRS += windows 40 | endif 41 | 42 | SUBDIRS += hidtest 43 | 44 | if BUILD_TESTGUI 45 | SUBDIRS += testgui 46 | endif 47 | 48 | EXTRA_DIST = udev doxygen 49 | 50 | dist_doc_DATA = \ 51 | README.md \ 52 | AUTHORS.txt \ 53 | LICENSE-bsd.txt \ 54 | LICENSE-gpl3.txt \ 55 | LICENSE-orig.txt \ 56 | LICENSE.txt 57 | 58 | SCMCLEAN_TARGETS= \ 59 | aclocal.m4 \ 60 | config.guess \ 61 | config.sub \ 62 | configure \ 63 | config.h.in \ 64 | depcomp \ 65 | install-sh \ 66 | ltmain.sh \ 67 | missing \ 68 | mac/Makefile.in \ 69 | testgui/Makefile.in \ 70 | libusb/Makefile.in \ 71 | Makefile.in \ 72 | linux/Makefile.in \ 73 | windows/Makefile.in \ 74 | m4/libtool.m4 \ 75 | m4/lt~obsolete.m4 \ 76 | m4/ltoptions.m4 \ 77 | m4/ltsugar.m4 \ 78 | m4/ltversion.m4 79 | 80 | SCMCLEAN_DIR_TARGETS = \ 81 | autom4te.cache 82 | 83 | scm-clean: distclean 84 | rm -f $(SCMCLEAN_TARGETS) 85 | rm -Rf $(SCMCLEAN_DIR_TARGETS) 86 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 0.14.0 -------------------------------------------------------------------------------- /android/jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH:= $(call my-dir) 2 | 3 | HIDAPI_ROOT_REL:= ../.. 4 | HIDAPI_ROOT_ABS:= $(LOCAL_PATH)/../.. 5 | 6 | include $(CLEAR_VARS) 7 | 8 | LOCAL_SRC_FILES := \ 9 | $(HIDAPI_ROOT_REL)/libusb/hid.c 10 | 11 | LOCAL_C_INCLUDES += \ 12 | $(HIDAPI_ROOT_ABS)/hidapi \ 13 | $(HIDAPI_ROOT_ABS)/android 14 | 15 | LOCAL_SHARED_LIBRARIES := libusb1.0 16 | 17 | LOCAL_MODULE := libhidapi 18 | 19 | include $(BUILD_SHARED_LIBRARY) 20 | -------------------------------------------------------------------------------- /bootstrap: -------------------------------------------------------------------------------- 1 | #!/bin/sh -x 2 | autoreconf --install --verbose --force 3 | -------------------------------------------------------------------------------- /dist/hidapi.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |spec| 2 | 3 | spec.name = "hidapi" 4 | spec.version = File.read('../VERSION') 5 | spec.summary = "A Simple library for communicating with USB and Bluetooth HID devices on Linux, Mac and Windows." 6 | 7 | spec.description = <<-DESC 8 | HIDAPI is a multi-platform library which allows an application to interface with USB and Bluetooth HID-Class devices on Windows, Linux, FreeBSD, and macOS. HIDAPI can be either built as a shared library (.so, .dll or .dylib) or can be embedded directly into a target application by adding a single source file (per platform) and a single header. 9 | DESC 10 | 11 | spec.homepage = "https://github.com/libusb/hidapi" 12 | 13 | spec.license = { :type=> "GNU GPLv3 or BSD or HIDAPI original", :file => "LICENSE.txt" } 14 | 15 | spec.authors = { "Alan Ott" => "alan@signal11.us", 16 | "Ludovic Rousseau" => "rousseau@debian.org", 17 | "libusb/hidapi Team" => "https://github.com/libusb/hidapi/blob/master/AUTHORS.txt", 18 | } 19 | 20 | spec.platform = :osx 21 | spec.osx.deployment_target = "10.7" 22 | 23 | spec.source = { :git => "https://github.com/libusb/hidapi.git", :tag => "hidapi-#{spec.version}" } 24 | 25 | spec.source_files = "mac/hid.c", "hidapi/hidapi.h", "mac/hidapi_darwin.h" 26 | 27 | spec.public_header_files = "hidapi/hidapi.h", "mac/hidapi_darwin.h" 28 | 29 | spec.frameworks = "IOKit", "CoreFoundation", "AppKit" 30 | 31 | end 32 | -------------------------------------------------------------------------------- /documentation/cmake-gui-drop-down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gus33000/hidapi/b516e970480a8d05b1c392d106ca110a9d06d668/documentation/cmake-gui-drop-down.png -------------------------------------------------------------------------------- /documentation/cmake-gui-highlights.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gus33000/hidapi/b516e970480a8d05b1c392d106ca110a9d06d668/documentation/cmake-gui-highlights.png -------------------------------------------------------------------------------- /doxygen/main_page.md: -------------------------------------------------------------------------------- 1 | # HIDAPI Doxygen output 2 | 3 | This site is dedicated to hosting an [API reference for the HIDAPI library](#API). 4 | 5 | For general information, see the [source repository](https://github.com/libusb/hidapi#readme). 6 | 7 | There are also build instructions hosted on github: 8 | 9 | - [Building from source](https://github.com/libusb/hidapi/blob/master/BUILD.md) 10 | - [Using CMake](https://github.com/libusb/hidapi/blob/master/BUILD.cmake.md) 11 | - [Using Autotools (deprecated)](https://github.com/libusb/hidapi/blob/master/BUILD.autotools.md) 12 | 13 | \example test.c contains a basic example usage of the HIDAPI library. 14 | -------------------------------------------------------------------------------- /hidtest/.gitignore: -------------------------------------------------------------------------------- 1 | Debug 2 | Release 3 | *.exp 4 | *.ilk 5 | *.lib 6 | *.suo 7 | *.vcproj.* 8 | *.ncb 9 | *.suo 10 | *.dll 11 | *.pdb 12 | *.o 13 | .deps/ 14 | .libs/ 15 | hidtest-hidraw 16 | hidtest-libusb 17 | hidtest 18 | -------------------------------------------------------------------------------- /hidtest/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.1.3 FATAL_ERROR) 2 | project(hidtest C) 3 | 4 | if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) 5 | # hidtest is build as a standalone project 6 | 7 | if(POLICY CMP0074) 8 | # allow using hidapi_ROOT if CMake supports it 9 | cmake_policy(SET CMP0074 NEW) 10 | endif() 11 | 12 | find_package(hidapi 0.12 REQUIRED) 13 | message(STATUS "Using HIDAPI: ${hidapi_VERSION}") 14 | else() 15 | # hidtest is built as part of the main HIDAPI build 16 | message(STATUS "Building hidtest") 17 | endif() 18 | 19 | set(HIDAPI_HIDTEST_TARGETS) 20 | if(NOT WIN32 AND NOT APPLE AND CMAKE_SYSTEM_NAME MATCHES "Linux") 21 | if(TARGET hidapi::hidraw) 22 | add_executable(hidtest_hidraw test.c) 23 | target_link_libraries(hidtest_hidraw hidapi::hidraw) 24 | list(APPEND HIDAPI_HIDTEST_TARGETS hidtest_hidraw) 25 | endif() 26 | if(TARGET hidapi::libusb) 27 | add_executable(hidtest_libusb test.c) 28 | target_compile_definitions(hidtest_libusb PRIVATE USING_HIDAPI_LIBUSB) 29 | target_link_libraries(hidtest_libusb hidapi::libusb) 30 | list(APPEND HIDAPI_HIDTEST_TARGETS hidtest_libusb) 31 | endif() 32 | else() 33 | add_executable(hidtest test.c) 34 | target_link_libraries(hidtest hidapi::hidapi) 35 | list(APPEND HIDAPI_HIDTEST_TARGETS hidtest) 36 | endif() 37 | 38 | install(TARGETS ${HIDAPI_HIDTEST_TARGETS} 39 | RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" 40 | ) 41 | -------------------------------------------------------------------------------- /hidtest/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = -I$(top_srcdir)/hidapi/ 2 | 3 | ## Linux 4 | if OS_LINUX 5 | noinst_PROGRAMS = hidtest-libusb hidtest-hidraw 6 | 7 | hidtest_hidraw_SOURCES = test.c 8 | hidtest_hidraw_LDADD = $(top_builddir)/linux/libhidapi-hidraw.la 9 | 10 | hidtest_libusb_SOURCES = test.c 11 | hidtest_libusb_LDADD = $(top_builddir)/libusb/libhidapi-libusb.la 12 | else 13 | 14 | # Other OS's 15 | noinst_PROGRAMS = hidtest 16 | 17 | hidtest_SOURCES = test.c 18 | hidtest_LDADD = $(top_builddir)/$(backend)/libhidapi.la 19 | 20 | endif 21 | 22 | if OS_DARWIN 23 | AM_CPPFLAGS += -I$(top_srcdir)/mac/ 24 | endif 25 | 26 | if OS_WINDOWS 27 | AM_CPPFLAGS += -I$(top_srcdir)/windows/ 28 | endif 29 | -------------------------------------------------------------------------------- /libusb/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.so 3 | *.la 4 | *.lo 5 | *.a 6 | .libs 7 | .deps 8 | hidtest-libusb 9 | -------------------------------------------------------------------------------- /libusb/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.6.3 FATAL_ERROR) 2 | 3 | list(APPEND HIDAPI_PUBLIC_HEADERS "hidapi_libusb.h") 4 | 5 | add_library(hidapi_libusb 6 | ${HIDAPI_PUBLIC_HEADERS} 7 | hid.c 8 | ) 9 | target_link_libraries(hidapi_libusb PUBLIC hidapi_include) 10 | 11 | if(TARGET usb-1.0) 12 | target_link_libraries(hidapi_libusb PRIVATE usb-1.0) 13 | else() 14 | include(FindPkgConfig) 15 | pkg_check_modules(libusb REQUIRED IMPORTED_TARGET libusb-1.0>=1.0.9) 16 | target_link_libraries(hidapi_libusb PRIVATE PkgConfig::libusb) 17 | endif() 18 | 19 | find_package(Threads REQUIRED) 20 | target_link_libraries(hidapi_libusb PRIVATE Threads::Threads) 21 | 22 | if(HIDAPI_NO_ICONV) 23 | target_compile_definitions(hidapi_libusb PRIVATE NO_ICONV) 24 | else() 25 | if(NOT ANDROID) 26 | include(CheckCSourceCompiles) 27 | 28 | if(NOT CMAKE_VERSION VERSION_LESS 3.11) 29 | message(STATUS "Check for Iconv") 30 | find_package(Iconv) 31 | if(Iconv_FOUND) 32 | if(NOT Iconv_IS_BUILT_IN) 33 | target_link_libraries(hidapi_libusb PRIVATE Iconv::Iconv) 34 | set(CMAKE_REQUIRED_LIBRARIES "Iconv::Iconv") 35 | if(NOT BUILD_SHARED_LIBS) 36 | set(HIDAPI_NEED_EXPORT_ICONV TRUE PARENT_SCOPE) 37 | endif() 38 | endif() 39 | else() 40 | message(STATUS "Iconv Explicitly check '-liconv'") 41 | # Sometime the build environment is not setup 42 | # in a way CMake can find Iconv on its own by default. 43 | # But if we simply link against iconv (-liconv), the build may succeed 44 | # due to other compiler/link flags. 45 | set(CMAKE_REQUIRED_LIBRARIES "iconv") 46 | check_c_source_compiles(" 47 | #include 48 | #include 49 | int main() { 50 | char *a, *b; 51 | size_t i, j; 52 | iconv_t ic; 53 | ic = iconv_open(\"to\", \"from\"); 54 | iconv(ic, &a, &i, &b, &j); 55 | iconv_close(ic); 56 | } 57 | " 58 | Iconv_EXPLICITLY_AT_ENV) 59 | if(Iconv_EXPLICITLY_AT_ENV) 60 | message(STATUS "Iconv Explicitly check '-liconv' - Available") 61 | target_link_libraries(hidapi_libusb PRIVATE iconv) 62 | else() 63 | message(FATAL_ERROR "Iconv is not found, make sure to provide it in the build environment") 64 | endif() 65 | endif() 66 | else() 67 | # otherwise there is 2 options: 68 | # 1) iconv is provided by Standard C library and the build will be just fine 69 | # 2) The _user_ has to provide additiona compilation options for this project/target 70 | endif() 71 | 72 | # check for error: "conflicting types for 'iconv'" 73 | check_c_source_compiles("#include 74 | extern size_t iconv (iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); 75 | int main() {}" 76 | HIDAPI_ICONV_CONST) 77 | if(HIDAPI_ICONV_CONST) 78 | target_compile_definitions(hidapi_libusb PRIVATE "ICONV_CONST=const") 79 | endif() 80 | else() 81 | # On Android Iconv is disabled on the code level anyway, so no issue; 82 | endif() 83 | endif() 84 | 85 | set_target_properties(hidapi_libusb 86 | PROPERTIES 87 | EXPORT_NAME "libusb" 88 | OUTPUT_NAME "hidapi-libusb" 89 | VERSION ${PROJECT_VERSION} 90 | SOVERSION ${PROJECT_VERSION_MAJOR} 91 | PUBLIC_HEADER "${HIDAPI_PUBLIC_HEADERS}" 92 | ) 93 | 94 | # compatibility with find_package() 95 | add_library(hidapi::libusb ALIAS hidapi_libusb) 96 | # compatibility with raw library link 97 | add_library(hidapi-libusb ALIAS hidapi_libusb) 98 | 99 | if(HIDAPI_INSTALL_TARGETS) 100 | install(TARGETS hidapi_libusb EXPORT hidapi 101 | LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" 102 | ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" 103 | PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/hidapi" 104 | ) 105 | endif() 106 | 107 | hidapi_configure_pc("${PROJECT_ROOT}/pc/hidapi-libusb.pc.in") 108 | -------------------------------------------------------------------------------- /libusb/Makefile-manual: -------------------------------------------------------------------------------- 1 | 2 | 3 | OS=$(shell uname) 4 | 5 | ifeq ($(OS), Linux) 6 | FILE=Makefile.linux 7 | endif 8 | 9 | ifeq ($(OS), FreeBSD) 10 | FILE=Makefile.freebsd 11 | endif 12 | 13 | ifeq ($(OS), Haiku) 14 | FILE=Makefile.haiku 15 | endif 16 | 17 | ifeq ($(FILE), ) 18 | all: 19 | $(error Your platform ${OS} is not supported by hidapi/libusb at this time.) 20 | endif 21 | 22 | include $(FILE) 23 | -------------------------------------------------------------------------------- /libusb/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = -I$(top_srcdir)/hidapi $(CFLAGS_LIBUSB) 2 | 3 | if OS_LINUX 4 | lib_LTLIBRARIES = libhidapi-libusb.la 5 | libhidapi_libusb_la_SOURCES = hid.c 6 | libhidapi_libusb_la_LDFLAGS = $(LTLDFLAGS) $(PTHREAD_CFLAGS) 7 | libhidapi_libusb_la_LIBADD = $(LIBS_LIBUSB) 8 | endif 9 | 10 | if OS_FREEBSD 11 | lib_LTLIBRARIES = libhidapi.la 12 | libhidapi_la_SOURCES = hid.c 13 | libhidapi_la_LDFLAGS = $(LTLDFLAGS) 14 | libhidapi_la_LIBADD = $(LIBS_LIBUSB) 15 | endif 16 | 17 | if OS_KFREEBSD 18 | lib_LTLIBRARIES = libhidapi.la 19 | libhidapi_la_SOURCES = hid.c 20 | libhidapi_la_LDFLAGS = $(LTLDFLAGS) 21 | libhidapi_la_LIBADD = $(LIBS_LIBUSB) 22 | endif 23 | 24 | if OS_HAIKU 25 | lib_LTLIBRARIES = libhidapi.la 26 | libhidapi_la_SOURCES = hid.c 27 | libhidapi_la_LDFLAGS = $(LTLDFLAGS) 28 | libhidapi_la_LIBADD = $(LIBS_LIBUSB) 29 | endif 30 | 31 | hdrdir = $(includedir)/hidapi 32 | hdr_HEADERS = $(top_srcdir)/hidapi/hidapi.h hidapi_libusb.h 33 | 34 | EXTRA_DIST = Makefile-manual 35 | -------------------------------------------------------------------------------- /libusb/Makefile.freebsd: -------------------------------------------------------------------------------- 1 | ########################################### 2 | # Simple Makefile for HIDAPI test program 3 | # 4 | # Alan Ott 5 | # Signal 11 Software 6 | # 2010-06-01 7 | ########################################### 8 | 9 | all: hidtest libs 10 | 11 | libs: libhidapi.so 12 | 13 | CC ?= cc 14 | CFLAGS ?= -Wall -g -fPIC 15 | 16 | COBJS = hid.o ../hidtest/test.o 17 | OBJS = $(COBJS) 18 | INCLUDES = -I../hidapi -I. -I/usr/local/include 19 | LDFLAGS = -L/usr/local/lib 20 | LIBS = -lusb -liconv -pthread 21 | 22 | 23 | # Console Test Program 24 | hidtest: $(OBJS) 25 | $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ $(LIBS) 26 | 27 | # Shared Libs 28 | libhidapi.so: $(COBJS) 29 | $(CC) $(LDFLAGS) -shared -Wl,-soname,$@.0 $^ -o $@ $(LIBS) 30 | 31 | # Objects 32 | $(COBJS): %.o: %.c 33 | $(CC) $(CFLAGS) -c $(INCLUDES) $< -o $@ 34 | 35 | 36 | clean: 37 | rm -f $(OBJS) hidtest libhidapi.so ../hidtest/hidtest.o 38 | 39 | .PHONY: clean libs 40 | -------------------------------------------------------------------------------- /libusb/Makefile.haiku: -------------------------------------------------------------------------------- 1 | ########################################### 2 | # Simple Makefile for HIDAPI test program 3 | # 4 | # Alan Ott 5 | # Signal 11 Software 6 | # 2010-06-01 7 | ########################################### 8 | 9 | all: hidtest libs 10 | 11 | libs: libhidapi.so 12 | 13 | CC ?= cc 14 | CFLAGS ?= -Wall -g -fPIC 15 | 16 | COBJS = hid.o ../hidtest/test.o 17 | OBJS = $(COBJS) 18 | INCLUDES = -I../hidapi -I. -I/usr/local/include 19 | LDFLAGS = -L/usr/local/lib 20 | LIBS = -lusb -liconv -pthread 21 | 22 | 23 | # Console Test Program 24 | hidtest: $(OBJS) 25 | $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ $(LIBS) 26 | 27 | # Shared Libs 28 | libhidapi.so: $(COBJS) 29 | $(CC) $(LDFLAGS) -shared -Wl,-soname,$@.0 $^ -o $@ $(LIBS) 30 | 31 | # Objects 32 | $(COBJS): %.o: %.c 33 | $(CC) $(CFLAGS) -c $(INCLUDES) $< -o $@ 34 | 35 | 36 | clean: 37 | rm -f $(OBJS) hidtest libhidapi.so ../hidtest/hidtest.o 38 | 39 | .PHONY: clean libs 40 | -------------------------------------------------------------------------------- /libusb/Makefile.linux: -------------------------------------------------------------------------------- 1 | ########################################### 2 | # Simple Makefile for HIDAPI test program 3 | # 4 | # Alan Ott 5 | # Signal 11 Software 6 | # 2010-06-01 7 | ########################################### 8 | 9 | all: hidtest-libusb libs 10 | 11 | libs: libhidapi-libusb.so 12 | 13 | CC ?= gcc 14 | CFLAGS ?= -Wall -g -fpic 15 | 16 | LDFLAGS ?= -Wall -g 17 | 18 | COBJS_LIBUSB = hid.o 19 | COBJS = $(COBJS_LIBUSB) ../hidtest/test.o 20 | OBJS = $(COBJS) 21 | LIBS_USB = `pkg-config libusb-1.0 --libs` -lrt -lpthread 22 | LIBS = $(LIBS_USB) 23 | INCLUDES ?= -I../hidapi -I. `pkg-config libusb-1.0 --cflags` 24 | 25 | 26 | # Console Test Program 27 | hidtest-libusb: $(COBJS) 28 | $(CC) $(LDFLAGS) $^ $(LIBS_USB) -o $@ 29 | 30 | # Shared Libs 31 | libhidapi-libusb.so: $(COBJS_LIBUSB) 32 | $(CC) $(LDFLAGS) $(LIBS_USB) -shared -fpic -Wl,-soname,$@.0 $^ -o $@ 33 | 34 | # Objects 35 | $(COBJS): %.o: %.c 36 | $(CC) $(CFLAGS) -c $(INCLUDES) $< -o $@ 37 | 38 | 39 | clean: 40 | rm -f $(OBJS) hidtest-libusb libhidapi-libusb.so ../hidtest/hidtest.o 41 | 42 | .PHONY: clean libs 43 | -------------------------------------------------------------------------------- /libusb/hidapi_libusb.h: -------------------------------------------------------------------------------- 1 | /******************************************************* 2 | HIDAPI - Multi-Platform library for 3 | communication with HID devices. 4 | 5 | libusb/hidapi Team 6 | 7 | Copyright 2021, All Rights Reserved. 8 | 9 | At the discretion of the user of this library, 10 | this software may be licensed under the terms of the 11 | GNU General Public License v3, a BSD-Style license, or the 12 | original HIDAPI license as outlined in the LICENSE.txt, 13 | LICENSE-gpl3.txt, LICENSE-bsd.txt, and LICENSE-orig.txt 14 | files located at the root of the source distribution. 15 | These files may also be found in the public source 16 | code repository located at: 17 | https://github.com/libusb/hidapi . 18 | ********************************************************/ 19 | 20 | /** @file 21 | * @defgroup API hidapi API 22 | 23 | * Since version 0.11.0, @ref HID_API_VERSION >= HID_API_MAKE_VERSION(0, 11, 0). 24 | */ 25 | 26 | #ifndef HIDAPI_LIBUSB_H__ 27 | #define HIDAPI_LIBUSB_H__ 28 | 29 | #include 30 | 31 | #include "hidapi.h" 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /** @brief Open a HID device using libusb_wrap_sys_device. 38 | See https://libusb.sourceforge.io/api-1.0/group__libusb__dev.html#ga98f783e115ceff4eaf88a60e6439563c, 39 | for details on libusb_wrap_sys_device. 40 | 41 | @ingroup API 42 | @param sys_dev Platform-specific file descriptor that can be recognised by libusb. 43 | @param interface_num USB interface number of the device to be used as HID interface. 44 | Pass -1 to select first HID interface of the device. 45 | 46 | @returns 47 | This function returns a pointer to a #hid_device object on 48 | success or NULL on failure. 49 | */ 50 | HID_API_EXPORT hid_device * HID_API_CALL hid_libusb_wrap_sys_device(intptr_t sys_dev, int interface_num); 51 | 52 | #ifdef __cplusplus 53 | } 54 | #endif 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /linux/.gitignore: -------------------------------------------------------------------------------- 1 | Debug 2 | Release 3 | *.exp 4 | *.ilk 5 | *.lib 6 | *.suo 7 | *.vcproj.* 8 | *.ncb 9 | *.suo 10 | *.dll 11 | *.pdb 12 | *.o 13 | *.so 14 | hidtest-hidraw 15 | .deps 16 | .libs 17 | *.lo 18 | *.la 19 | -------------------------------------------------------------------------------- /linux/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.6.3 FATAL_ERROR) 2 | 3 | add_library(hidapi_hidraw 4 | ${HIDAPI_PUBLIC_HEADERS} 5 | hid.c 6 | ) 7 | target_link_libraries(hidapi_hidraw PUBLIC hidapi_include) 8 | 9 | find_package(Threads REQUIRED) 10 | 11 | include(FindPkgConfig) 12 | pkg_check_modules(libudev REQUIRED IMPORTED_TARGET libudev) 13 | 14 | target_link_libraries(hidapi_hidraw PRIVATE PkgConfig::libudev Threads::Threads) 15 | 16 | set_target_properties(hidapi_hidraw 17 | PROPERTIES 18 | EXPORT_NAME "hidraw" 19 | OUTPUT_NAME "hidapi-hidraw" 20 | VERSION ${PROJECT_VERSION} 21 | SOVERSION ${PROJECT_VERSION_MAJOR} 22 | PUBLIC_HEADER "${HIDAPI_PUBLIC_HEADERS}" 23 | ) 24 | 25 | # compatibility with find_package() 26 | add_library(hidapi::hidraw ALIAS hidapi_hidraw) 27 | # compatibility with raw library link 28 | add_library(hidapi-hidraw ALIAS hidapi_hidraw) 29 | 30 | if(HIDAPI_INSTALL_TARGETS) 31 | install(TARGETS hidapi_hidraw EXPORT hidapi 32 | LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" 33 | ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" 34 | PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/hidapi" 35 | ) 36 | endif() 37 | 38 | hidapi_configure_pc("${PROJECT_ROOT}/pc/hidapi-hidraw.pc.in") 39 | -------------------------------------------------------------------------------- /linux/Makefile-manual: -------------------------------------------------------------------------------- 1 | ########################################### 2 | # Simple Makefile for HIDAPI test program 3 | # 4 | # Alan Ott 5 | # Signal 11 Software 6 | # 2010-06-01 7 | ########################################### 8 | 9 | all: hidtest-hidraw libs 10 | 11 | libs: libhidapi-hidraw.so 12 | 13 | CC ?= gcc 14 | CFLAGS ?= -Wall -g -fpic 15 | 16 | LDFLAGS ?= -Wall -g 17 | 18 | 19 | COBJS = hid.o ../hidtest/test.o 20 | OBJS = $(COBJS) 21 | LIBS_UDEV = `pkg-config libudev --libs` -lrt 22 | LIBS = $(LIBS_UDEV) 23 | INCLUDES ?= -I../hidapi `pkg-config libusb-1.0 --cflags` 24 | 25 | 26 | # Console Test Program 27 | hidtest-hidraw: $(COBJS) 28 | $(CC) $(LDFLAGS) $^ $(LIBS_UDEV) -o $@ 29 | 30 | # Shared Libs 31 | libhidapi-hidraw.so: $(COBJS) 32 | $(CC) $(LDFLAGS) $(LIBS_UDEV) -shared -fpic -Wl,-soname,$@.0 $^ -o $@ 33 | 34 | # Objects 35 | $(COBJS): %.o: %.c 36 | $(CC) $(CFLAGS) -c $(INCLUDES) $< -o $@ 37 | 38 | 39 | clean: 40 | rm -f $(OBJS) hidtest-hidraw libhidapi-hidraw.so $(COBJS) 41 | 42 | .PHONY: clean libs 43 | -------------------------------------------------------------------------------- /linux/Makefile.am: -------------------------------------------------------------------------------- 1 | lib_LTLIBRARIES = libhidapi-hidraw.la 2 | libhidapi_hidraw_la_SOURCES = hid.c 3 | libhidapi_hidraw_la_LDFLAGS = $(LTLDFLAGS) 4 | AM_CPPFLAGS = -I$(top_srcdir)/hidapi/ $(CFLAGS_HIDRAW) 5 | libhidapi_hidraw_la_LIBADD = $(LIBS_HIDRAW) 6 | 7 | hdrdir = $(includedir)/hidapi 8 | hdr_HEADERS = $(top_srcdir)/hidapi/hidapi.h 9 | 10 | EXTRA_DIST = Makefile-manual 11 | -------------------------------------------------------------------------------- /m4/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore All, except pkg.m4, and of course this file. 2 | * 3 | !.gitignore 4 | !pkg.m4 5 | !ax_pthread.m4 6 | -------------------------------------------------------------------------------- /m4/pkg.m4: -------------------------------------------------------------------------------- 1 | # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- 2 | # 3 | # Copyright © 2004 Scott James Remnant . 4 | # 5 | # This program is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 2 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, but 11 | # WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program; if not, write to the Free Software 17 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | # 19 | # As a special exception to the GNU General Public License, if you 20 | # distribute this file as part of a program that contains a 21 | # configuration script generated by Autoconf, you may include it under 22 | # the same distribution terms that you use for the rest of that program. 23 | 24 | # PKG_PROG_PKG_CONFIG([MIN-VERSION]) 25 | # ---------------------------------- 26 | AC_DEFUN([PKG_PROG_PKG_CONFIG], 27 | [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) 28 | m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) 29 | AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl 30 | if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then 31 | AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) 32 | fi 33 | if test -n "$PKG_CONFIG"; then 34 | _pkg_min_version=m4_default([$1], [0.9.0]) 35 | AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) 36 | if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then 37 | AC_MSG_RESULT([yes]) 38 | else 39 | AC_MSG_RESULT([no]) 40 | PKG_CONFIG="" 41 | fi 42 | 43 | fi[]dnl 44 | ])# PKG_PROG_PKG_CONFIG 45 | 46 | # PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) 47 | # 48 | # Check to see whether a particular set of modules exists. Similar 49 | # to PKG_CHECK_MODULES(), but does not set variables or print errors. 50 | # 51 | # 52 | # Similar to PKG_CHECK_MODULES, make sure that the first instance of 53 | # this or PKG_CHECK_MODULES is called, or make sure to call 54 | # PKG_CHECK_EXISTS manually 55 | # -------------------------------------------------------------- 56 | AC_DEFUN([PKG_CHECK_EXISTS], 57 | [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl 58 | if test -n "$PKG_CONFIG" && \ 59 | AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then 60 | m4_ifval([$2], [$2], [:]) 61 | m4_ifvaln([$3], [else 62 | $3])dnl 63 | fi]) 64 | 65 | 66 | # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) 67 | # --------------------------------------------- 68 | m4_define([_PKG_CONFIG], 69 | [if test -n "$PKG_CONFIG"; then 70 | if test -n "$$1"; then 71 | pkg_cv_[]$1="$$1" 72 | else 73 | PKG_CHECK_EXISTS([$3], 74 | [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], 75 | [pkg_failed=yes]) 76 | fi 77 | else 78 | pkg_failed=untried 79 | fi[]dnl 80 | ])# _PKG_CONFIG 81 | 82 | # _PKG_SHORT_ERRORS_SUPPORTED 83 | # ----------------------------- 84 | AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], 85 | [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) 86 | if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then 87 | _pkg_short_errors_supported=yes 88 | else 89 | _pkg_short_errors_supported=no 90 | fi[]dnl 91 | ])# _PKG_SHORT_ERRORS_SUPPORTED 92 | 93 | 94 | # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], 95 | # [ACTION-IF-NOT-FOUND]) 96 | # 97 | # 98 | # Note that if there is a possibility the first call to 99 | # PKG_CHECK_MODULES might not happen, you should be sure to include an 100 | # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac 101 | # 102 | # 103 | # -------------------------------------------------------------- 104 | AC_DEFUN([PKG_CHECK_MODULES], 105 | [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl 106 | AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl 107 | AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl 108 | 109 | pkg_failed=no 110 | AC_MSG_CHECKING([for $1]) 111 | 112 | _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) 113 | _PKG_CONFIG([$1][_LIBS], [libs], [$2]) 114 | 115 | m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS 116 | and $1[]_LIBS to avoid the need to call pkg-config. 117 | See the pkg-config man page for more details.]) 118 | 119 | if test $pkg_failed = yes; then 120 | _PKG_SHORT_ERRORS_SUPPORTED 121 | if test $_pkg_short_errors_supported = yes; then 122 | $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"` 123 | else 124 | $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` 125 | fi 126 | # Put the nasty error message in config.log where it belongs 127 | echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD 128 | 129 | ifelse([$4], , [AC_MSG_ERROR(dnl 130 | [Package requirements ($2) were not met: 131 | 132 | $$1_PKG_ERRORS 133 | 134 | Consider adjusting the PKG_CONFIG_PATH environment variable if you 135 | installed software in a non-standard prefix. 136 | 137 | _PKG_TEXT 138 | ])], 139 | [AC_MSG_RESULT([no]) 140 | $4]) 141 | elif test $pkg_failed = untried; then 142 | ifelse([$4], , [AC_MSG_FAILURE(dnl 143 | [The pkg-config script could not be found or is too old. Make sure it 144 | is in your PATH or set the PKG_CONFIG environment variable to the full 145 | path to pkg-config. 146 | 147 | _PKG_TEXT 148 | 149 | To get pkg-config, see .])], 150 | [$4]) 151 | else 152 | $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS 153 | $1[]_LIBS=$pkg_cv_[]$1[]_LIBS 154 | AC_MSG_RESULT([yes]) 155 | ifelse([$3], , :, [$3]) 156 | fi[]dnl 157 | ])# PKG_CHECK_MODULES 158 | -------------------------------------------------------------------------------- /mac/.gitignore: -------------------------------------------------------------------------------- 1 | Debug 2 | Release 3 | *.exp 4 | *.ilk 5 | *.lib 6 | *.suo 7 | *.vcproj.* 8 | *.ncb 9 | *.suo 10 | *.dll 11 | *.pdb 12 | *.o 13 | hidapi-hidtest 14 | .deps 15 | .libs 16 | *.la 17 | *.lo 18 | -------------------------------------------------------------------------------- /mac/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.4.3 FATAL_ERROR) 2 | 3 | list(APPEND HIDAPI_PUBLIC_HEADERS "hidapi_darwin.h") 4 | 5 | add_library(hidapi_darwin 6 | ${HIDAPI_PUBLIC_HEADERS} 7 | hid.c 8 | ) 9 | 10 | find_package(Threads REQUIRED) 11 | 12 | target_link_libraries(hidapi_darwin 13 | PUBLIC hidapi_include 14 | PRIVATE Threads::Threads 15 | PRIVATE "-framework IOKit" "-framework CoreFoundation" "-framework AppKit" 16 | ) 17 | 18 | set_target_properties(hidapi_darwin 19 | PROPERTIES 20 | EXPORT_NAME "darwin" 21 | OUTPUT_NAME "hidapi" 22 | VERSION ${PROJECT_VERSION} 23 | SOVERSION ${PROJECT_VERSION_MAJOR} 24 | MACHO_COMPATIBILITY_VERSION ${PROJECT_VERSION_MAJOR} 25 | FRAMEWORK_VERSION ${PROJECT_VERSION_MAJOR} 26 | PUBLIC_HEADER "${HIDAPI_PUBLIC_HEADERS}" 27 | ) 28 | 29 | # compatibility with find_package() 30 | add_library(hidapi::darwin ALIAS hidapi_darwin) 31 | # compatibility with raw library link 32 | add_library(hidapi ALIAS hidapi_darwin) 33 | 34 | set(PUBLIC_HEADER_DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") 35 | if(NOT CMAKE_FRAMEWORK) 36 | set(PUBLIC_HEADER_DESTINATION "${PUBLIC_HEADER_DESTINATION}/hidapi") 37 | endif() 38 | 39 | if(HIDAPI_INSTALL_TARGETS) 40 | install(TARGETS hidapi_darwin EXPORT hidapi 41 | LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" 42 | ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" 43 | FRAMEWORK DESTINATION "${CMAKE_INSTALL_LIBDIR}" 44 | PUBLIC_HEADER DESTINATION "${PUBLIC_HEADER_DESTINATION}" 45 | ) 46 | endif() 47 | 48 | hidapi_configure_pc("${PROJECT_ROOT}/pc/hidapi.pc.in") 49 | -------------------------------------------------------------------------------- /mac/Makefile-manual: -------------------------------------------------------------------------------- 1 | ########################################### 2 | # Simple Makefile for HIDAPI test program 3 | # 4 | # Alan Ott 5 | # Signal 11 Software 6 | # 2010-07-03 7 | ########################################### 8 | 9 | all: hidtest 10 | 11 | CC=gcc 12 | COBJS=hid.o ../hidtest/test.o 13 | OBJS=$(COBJS) 14 | CFLAGS+=-I../hidapi -I. -Wall -g -c 15 | LIBS=-framework IOKit -framework CoreFoundation -framework AppKit 16 | 17 | 18 | hidtest: $(OBJS) 19 | $(CC) -Wall -g $^ $(LIBS) -o hidtest 20 | 21 | $(COBJS): %.o: %.c 22 | $(CC) $(CFLAGS) $< -o $@ 23 | 24 | clean: 25 | rm -f *.o hidtest 26 | 27 | .PHONY: clean 28 | -------------------------------------------------------------------------------- /mac/Makefile.am: -------------------------------------------------------------------------------- 1 | lib_LTLIBRARIES = libhidapi.la 2 | libhidapi_la_SOURCES = hid.c 3 | libhidapi_la_LDFLAGS = $(LTLDFLAGS) 4 | AM_CPPFLAGS = -I$(top_srcdir)/hidapi/ 5 | 6 | hdrdir = $(includedir)/hidapi 7 | hdr_HEADERS = $(top_srcdir)/hidapi/hidapi.h 8 | 9 | EXTRA_DIST = Makefile-manual 10 | -------------------------------------------------------------------------------- /mac/hidapi_darwin.h: -------------------------------------------------------------------------------- 1 | /******************************************************* 2 | HIDAPI - Multi-Platform library for 3 | communication with HID devices. 4 | 5 | libusb/hidapi Team 6 | 7 | Copyright 2022, All Rights Reserved. 8 | 9 | At the discretion of the user of this library, 10 | this software may be licensed under the terms of the 11 | GNU General Public License v3, a BSD-Style license, or the 12 | original HIDAPI license as outlined in the LICENSE.txt, 13 | LICENSE-gpl3.txt, LICENSE-bsd.txt, and LICENSE-orig.txt 14 | files located at the root of the source distribution. 15 | These files may also be found in the public source 16 | code repository located at: 17 | https://github.com/libusb/hidapi . 18 | ********************************************************/ 19 | 20 | /** @file 21 | * @defgroup API hidapi API 22 | 23 | * Since version 0.12.0, @ref HID_API_VERSION >= HID_API_MAKE_VERSION(0, 12, 0) 24 | */ 25 | 26 | #ifndef HIDAPI_DARWIN_H__ 27 | #define HIDAPI_DARWIN_H__ 28 | 29 | #include 30 | 31 | #include "hidapi.h" 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /** @brief Get the location ID for a HID device. 38 | 39 | Since version 0.12.0, @ref HID_API_VERSION >= HID_API_MAKE_VERSION(0, 12, 0) 40 | 41 | @ingroup API 42 | @param dev A device handle returned from hid_open(). 43 | @param location_id The device's location ID on return. 44 | 45 | @returns 46 | This function returns 0 on success and -1 on error. 47 | */ 48 | int HID_API_EXPORT_CALL hid_darwin_get_location_id(hid_device *dev, uint32_t *location_id); 49 | 50 | 51 | /** @brief Changes the behavior of all further calls to @ref hid_open or @ref hid_open_path. 52 | 53 | By default on Darwin platform all devices opened by HIDAPI with @ref hid_open or @ref hid_open_path 54 | are opened in exclusive mode (see kIOHIDOptionsTypeSeizeDevice). 55 | 56 | Since version 0.12.0, @ref HID_API_VERSION >= HID_API_MAKE_VERSION(0, 12, 0) 57 | 58 | @ingroup API 59 | @param open_exclusive When set to 0 - all further devices will be opened 60 | in non-exclusive mode. Otherwise - all further devices will be opened 61 | in exclusive mode. 62 | 63 | @note During the initialisation by @ref hid_init - this property is set to 1 (TRUE). 64 | This is done to preserve full backward compatibility with previous behavior. 65 | 66 | @note Calling this function before @ref hid_init or after @ref hid_exit has no effect. 67 | */ 68 | void HID_API_EXPORT_CALL hid_darwin_set_open_exclusive(int open_exclusive); 69 | 70 | /** @brief Getter for option set by @ref hid_darwin_set_open_exclusive. 71 | 72 | Since version 0.12.0, @ref HID_API_VERSION >= HID_API_MAKE_VERSION(0, 12, 0) 73 | 74 | @ingroup API 75 | @return 1 if all further devices will be opened in exclusive mode. 76 | 77 | @note Value returned by this function before calling to @ref hid_init or after @ref hid_exit 78 | is not reliable. 79 | */ 80 | int HID_API_EXPORT_CALL hid_darwin_get_open_exclusive(void); 81 | 82 | /** @brief Check how the device was opened. 83 | 84 | Since version 0.12.0, @ref HID_API_VERSION >= HID_API_MAKE_VERSION(0, 12, 0) 85 | 86 | @ingroup API 87 | @param dev A device to get property from. 88 | 89 | @return 1 if the device is opened in exclusive mode, 0 - opened in non-exclusive, 90 | -1 - if dev is invalid. 91 | */ 92 | int HID_API_EXPORT_CALL hid_darwin_is_device_open_exclusive(hid_device *dev); 93 | 94 | #ifdef __cplusplus 95 | } 96 | #endif 97 | 98 | #endif 99 | -------------------------------------------------------------------------------- /meson.build: -------------------------------------------------------------------------------- 1 | project('hidapi', meson_version: '>=0.57.0', version: files('VERSION')) 2 | 3 | cmake = import('cmake') 4 | 5 | hidapi_build_options = cmake.subproject_options() 6 | hidapi_build_options.set_install(true) 7 | 8 | hidapi_build = cmake.subproject('hidapi_build_cmake', options: hidapi_build_options) 9 | 10 | if (hidapi_build.target_list().contains('hidapi_winapi')) 11 | hidapi_winapi_dep = hidapi_build.dependency('hidapi_winapi') 12 | hidapi_dep = hidapi_winapi_dep 13 | elif (hidapi_build.target_list().contains('hidapi_darwin')) 14 | hidapi_darwin_dep = hidapi_build.dependency('hidapi_darwin') 15 | hidapi_dep = hidapi_darwin_dep 16 | elif (hidapi_build.target_list().contains('hidapi_hidraw')) 17 | hidapi_hidraw_dep = hidapi_build.dependency('hidapi_hidraw') 18 | hidapi_dep = hidapi_hidraw_dep 19 | elif (hidapi_build.target_list().contains('hidapi_libusb')) 20 | hidapi_libusb_dep = hidapi_build.dependency('hidapi_libusb') 21 | hidapi_dep = hidapi_libusb_dep 22 | endif 23 | -------------------------------------------------------------------------------- /pc/.gitignore: -------------------------------------------------------------------------------- 1 | *.pc 2 | -------------------------------------------------------------------------------- /pc/hidapi-hidraw.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: hidapi-hidraw 7 | Description: C Library for USB/Bluetooth HID device access from Linux, Mac OS X, FreeBSD, and Windows. This is the hidraw implementation. 8 | URL: https://github.com/libusb/hidapi 9 | Version: @VERSION@ 10 | Libs: -L${libdir} -lhidapi-hidraw 11 | Cflags: -I${includedir}/hidapi 12 | -------------------------------------------------------------------------------- /pc/hidapi-libusb.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: hidapi-libusb 7 | Description: C Library for USB HID device access from Linux, Mac OS X, FreeBSD, and Windows. This is the libusb implementation. 8 | URL: https://github.com/libusb/hidapi 9 | Version: @VERSION@ 10 | Libs: -L${libdir} -lhidapi-libusb 11 | Cflags: -I${includedir}/hidapi 12 | -------------------------------------------------------------------------------- /pc/hidapi.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: hidapi 7 | Description: C Library for USB/Bluetooth HID device access from Linux, Mac OS X, FreeBSD, and Windows. 8 | URL: https://github.com/libusb/hidapi 9 | Version: @VERSION@ 10 | Libs: -L${libdir} -lhidapi 11 | Cflags: -I${includedir}/hidapi 12 | -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(PROJECT_ROOT "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE) 2 | 3 | # Read version from file 4 | file(READ "${PROJECT_ROOT}/VERSION" RAW_VERSION_STR) 5 | string(REGEX MATCH "^([0-9]+\\.[0-9]+\\.[0-9]+)(.*)" VERSION_STR "${RAW_VERSION_STR}") 6 | 7 | if(NOT VERSION_STR) 8 | message(FATAL_ERROR "Broken VERSION file, couldn't parse '${PROJECT_ROOT}/VERSION' with content: '${RAW_VERSION_STR}'") 9 | endif() 10 | 11 | set(VERSION "${CMAKE_MATCH_1}") 12 | string(STRIP "${CMAKE_MATCH_2}" VERSION_SUFFIX) 13 | # compatibility with find_package() vs add_subdirectory 14 | set(hidapi_VERSION "${VERSION}" PARENT_SCOPE) 15 | # 16 | 17 | if(DEFINED HIDAPI_PRINT_VERSION AND HIDAPI_PRINT_VERSION) 18 | set(HIDAPI_PRINT_VERSION "hidapi: v${VERSION}") 19 | if(VERSION_SUFFIX) 20 | set(HIDAPI_PRINT_VERSION "${HIDAPI_PRINT_VERSION} (${VERSION_SUFFIX})") 21 | endif() 22 | message(STATUS "${HIDAPI_PRINT_VERSION}") 23 | endif() 24 | 25 | project(hidapi VERSION "${VERSION}" LANGUAGES C) 26 | 27 | # Defaults and required options 28 | 29 | if(NOT DEFINED HIDAPI_WITH_TESTS) 30 | set(HIDAPI_WITH_TESTS OFF) 31 | endif() 32 | if(NOT DEFINED BUILD_SHARED_LIBS) 33 | set(BUILD_SHARED_LIBS ON) 34 | endif() 35 | if(NOT DEFINED HIDAPI_INSTALL_TARGETS) 36 | set(HIDAPI_INSTALL_TARGETS OFF) 37 | endif() 38 | if(NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE) 39 | set(CMAKE_POSITION_INDEPENDENT_CODE ON) 40 | endif() 41 | 42 | get_directory_property(IS_EXCLUDE_FROM_ALL EXCLUDE_FROM_ALL) 43 | if(IS_EXCLUDE_FROM_ALL) 44 | if(HIDAPI_INSTALL_TARGETS) 45 | message(WARNING "Installing EXCLUDE_FROM_ALL targets in an undefined behavior in CMake.\nDon't add 'hidapi' sundirectory with 'EXCLUDE_FROM_ALL' property, or don't set 'HIDAPI_INSTALL_TARGETS' to TRUE.") 46 | endif() 47 | endif() 48 | 49 | # Helper(s) 50 | 51 | function(hidapi_configure_pc PC_IN_FILE) 52 | file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/pc") 53 | 54 | set(VERSION "${VERSION}${VERSION_SUFFIX}") 55 | set(prefix "${CMAKE_INSTALL_PREFIX}") 56 | set(exec_prefix "\${prefix}") 57 | if(IS_ABSOLUTE "${CMAKE_INSTALL_LIBDIR}") 58 | set(libdir "${CMAKE_INSTALL_LIBDIR}") 59 | else() 60 | set(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}") 61 | endif() 62 | if(IS_ABSOLUTE "${CMAKE_INSTALL_INCLUDEDIR}") 63 | set(includedir "${CMAKE_INSTALL_INCLUDEDIR}") 64 | else() 65 | set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}") 66 | endif() 67 | 68 | get_filename_component(PC_IN_FILENAME "${PC_IN_FILE}" NAME_WE) 69 | set(PC_FILE "${CMAKE_CURRENT_BINARY_DIR}/pc/${PC_IN_FILENAME}.pc") 70 | configure_file("${PC_IN_FILE}" "${PC_FILE}" @ONLY) 71 | 72 | install(FILES "${PC_FILE}" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig/") 73 | endfunction() 74 | 75 | # The library 76 | 77 | if(HIDAPI_INSTALL_TARGETS) 78 | include(GNUInstallDirs) 79 | endif() 80 | 81 | add_library(hidapi_include INTERFACE) 82 | target_include_directories(hidapi_include INTERFACE 83 | "$" 84 | ) 85 | if(APPLE AND CMAKE_FRAMEWORK) 86 | # FIXME: https://github.com/libusb/hidapi/issues/492: it is untrivial to set the include path for Framework correctly 87 | else() 88 | target_include_directories(hidapi_include INTERFACE 89 | "$" 90 | ) 91 | endif() 92 | set_target_properties(hidapi_include PROPERTIES EXPORT_NAME "include") 93 | set(HIDAPI_PUBLIC_HEADERS "${PROJECT_ROOT}/hidapi/hidapi.h") 94 | 95 | add_library(hidapi::include ALIAS hidapi_include) 96 | 97 | if(HIDAPI_INSTALL_TARGETS) 98 | install(TARGETS hidapi_include EXPORT hidapi) 99 | endif() 100 | 101 | set(EXPORT_ALIAS) 102 | set(EXPORT_COMPONENTS) 103 | 104 | set(HIDAPI_NEED_EXPORT_THREADS FALSE) 105 | set(HIDAPI_NEED_EXPORT_LIBUSB FALSE) 106 | set(HIDAPI_NEED_EXPORT_LIBUDEV FALSE) 107 | set(HIDAPI_NEED_EXPORT_ICONV FALSE) 108 | 109 | if(WIN32) 110 | target_include_directories(hidapi_include INTERFACE 111 | "$" 112 | ) 113 | add_subdirectory("${PROJECT_ROOT}/windows" windows) 114 | set(EXPORT_ALIAS winapi) 115 | list(APPEND EXPORT_COMPONENTS winapi) 116 | elseif(APPLE) 117 | target_include_directories(hidapi_include INTERFACE 118 | "$" 119 | ) 120 | add_subdirectory("${PROJECT_ROOT}/mac" mac) 121 | set(EXPORT_ALIAS darwin) 122 | list(APPEND EXPORT_COMPONENTS darwin) 123 | if(NOT BUILD_SHARED_LIBS) 124 | set(HIDAPI_NEED_EXPORT_THREADS TRUE) 125 | endif() 126 | else() 127 | if(NOT DEFINED HIDAPI_WITH_LIBUSB) 128 | set(HIDAPI_WITH_LIBUSB ON) 129 | endif() 130 | if(CMAKE_SYSTEM_NAME MATCHES "Linux") 131 | if(NOT DEFINED HIDAPI_WITH_HIDRAW) 132 | set(HIDAPI_WITH_HIDRAW ON) 133 | endif() 134 | if(HIDAPI_WITH_HIDRAW) 135 | add_subdirectory("${PROJECT_ROOT}/linux" linux) 136 | list(APPEND EXPORT_COMPONENTS hidraw) 137 | set(EXPORT_ALIAS hidraw) 138 | if(NOT BUILD_SHARED_LIBS) 139 | set(HIDAPI_NEED_EXPORT_THREADS TRUE) 140 | set(HIDAPI_NEED_EXPORT_LIBUDEV TRUE) 141 | endif() 142 | endif() 143 | else() 144 | set(HIDAPI_WITH_LIBUSB ON) 145 | endif() 146 | if(HIDAPI_WITH_LIBUSB) 147 | target_include_directories(hidapi_include INTERFACE 148 | "$" 149 | ) 150 | if(NOT DEFINED HIDAPI_NO_ICONV) 151 | set(HIDAPI_NO_ICONV OFF) 152 | endif() 153 | add_subdirectory("${PROJECT_ROOT}/libusb" libusb) 154 | list(APPEND EXPORT_COMPONENTS libusb) 155 | if(NOT EXPORT_ALIAS) 156 | set(EXPORT_ALIAS libusb) 157 | endif() 158 | if(NOT BUILD_SHARED_LIBS) 159 | set(HIDAPI_NEED_EXPORT_THREADS TRUE) 160 | if(NOT TARGET usb-1.0) 161 | set(HIDAPI_NEED_EXPORT_LIBUSB TRUE) 162 | endif() 163 | endif() 164 | elseif(NOT TARGET hidapi_hidraw) 165 | message(FATAL_ERROR "Select at least one option to build: HIDAPI_WITH_LIBUSB or HIDAPI_WITH_HIDRAW") 166 | endif() 167 | endif() 168 | 169 | add_library(hidapi::hidapi ALIAS hidapi_${EXPORT_ALIAS}) 170 | 171 | if(HIDAPI_INSTALL_TARGETS) 172 | include(CMakePackageConfigHelpers) 173 | set(EXPORT_DENERATED_LOCATION "${CMAKE_BINARY_DIR}/export_generated") 174 | set(EXPORT_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/hidapi") 175 | write_basic_package_version_file("${EXPORT_DENERATED_LOCATION}/hidapi-config-version.cmake" 176 | COMPATIBILITY SameMajorVersion 177 | ) 178 | configure_package_config_file("cmake/hidapi-config.cmake.in" "${EXPORT_DENERATED_LOCATION}/hidapi-config.cmake" 179 | INSTALL_DESTINATION "${EXPORT_DESTINATION}" 180 | NO_SET_AND_CHECK_MACRO 181 | ) 182 | 183 | install(EXPORT hidapi 184 | DESTINATION "${EXPORT_DESTINATION}" 185 | NAMESPACE hidapi:: 186 | FILE "libhidapi.cmake" 187 | ) 188 | install(FILES 189 | "${EXPORT_DENERATED_LOCATION}/hidapi-config-version.cmake" 190 | "${EXPORT_DENERATED_LOCATION}/hidapi-config.cmake" 191 | DESTINATION "${EXPORT_DESTINATION}" 192 | ) 193 | endif() 194 | -------------------------------------------------------------------------------- /src/cmake/hidapi-config.cmake.in: -------------------------------------------------------------------------------- 1 | @PACKAGE_INIT@ 2 | 3 | set(hidapi_VERSION_MAJOR "@hidapi_VERSION_MAJOR@") 4 | set(hidapi_VERSION_MINOR "@hidapi_VERSION_MINOR@") 5 | set(hidapi_VERSION_PATCH "@hidapi_VERSION_PATCH@") 6 | set(hidapi_VERSION "@hidapi_VERSION@") 7 | set(hidapi_VERSION_STR "@hidapi_VERSION@@VERSION_SUFFIX@") 8 | 9 | set(hidapi_FOUND FALSE) 10 | 11 | set(HIDAPI_NEED_EXPORT_THREADS @HIDAPI_NEED_EXPORT_THREADS@) 12 | set(HIDAPI_NEED_EXPORT_LIBUSB @HIDAPI_NEED_EXPORT_LIBUSB@) 13 | set(HIDAPI_NEED_EXPORT_LIBUDEV @HIDAPI_NEED_EXPORT_LIBUDEV@) 14 | set(HIDAPI_NEED_EXPORT_ICONV @HIDAPI_NEED_EXPORT_ICONV@) 15 | 16 | if(HIDAPI_NEED_EXPORT_THREADS) 17 | if(CMAKE_VERSION VERSION_LESS 3.4.3) 18 | message(FATAL_ERROR "This file relies on consumers using CMake 3.4.3 or greater.") 19 | endif() 20 | find_package(Threads REQUIRED) 21 | endif() 22 | 23 | if(HIDAPI_NEED_EXPORT_LIBUSB OR HIDAPI_NEED_EXPORT_LIBUDEV) 24 | if(CMAKE_VERSION VERSION_LESS 3.6.3) 25 | message(FATAL_ERROR "This file relies on consumers using CMake 3.6.3 or greater.") 26 | endif() 27 | find_package(PkgConfig) 28 | if(HIDAPI_NEED_EXPORT_LIBUSB) 29 | pkg_check_modules(libusb REQUIRED IMPORTED_TARGET libusb-1.0>=1.0.9) 30 | endif() 31 | if(HIDAPI_NEED_EXPORT_LIBUDEV) 32 | pkg_check_modules(libudev REQUIRED IMPORTED_TARGET libudev) 33 | endif() 34 | endif() 35 | 36 | if(HIDAPI_NEED_EXPORT_ICONV) 37 | if(CMAKE_VERSION VERSION_LESS 3.11) 38 | message(WARNING "HIDAPI requires CMake target Iconv::Iconv, make sure to provide it") 39 | else() 40 | find_package(Iconv REQUIRED) 41 | endif() 42 | endif() 43 | 44 | include("${CMAKE_CURRENT_LIST_DIR}/libhidapi.cmake") 45 | 46 | set(hidapi_FOUND TRUE) 47 | 48 | foreach(_component @EXPORT_COMPONENTS@) 49 | if(TARGET hidapi::${_component}) 50 | set(hidapi_${_component}_FOUND TRUE) 51 | endif() 52 | endforeach() 53 | 54 | check_required_components(hidapi) 55 | 56 | if(NOT TARGET hidapi::hidapi) 57 | add_library(hidapi::hidapi INTERFACE IMPORTED) 58 | set_target_properties(hidapi::hidapi PROPERTIES 59 | INTERFACE_LINK_LIBRARIES hidapi::@EXPORT_ALIAS@ 60 | ) 61 | endif() 62 | -------------------------------------------------------------------------------- /subprojects/README.md: -------------------------------------------------------------------------------- 1 | This folder is used only to support [meson.build](../meson.build) `subproject` command 2 | which would only look for a subproject in a "subprojects" directory. -------------------------------------------------------------------------------- /subprojects/hidapi_build_cmake/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.1.3 FATAL_ERROR) 2 | project(hidapi LANGUAGES C) 3 | 4 | file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/root") 5 | 6 | foreach(ROOT_ELEMENT CMakeLists.txt hidapi src windows linux mac libusb pc VERSION) 7 | file(COPY "${CMAKE_CURRENT_LIST_DIR}/../../${ROOT_ELEMENT}" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/root/") 8 | endforeach() 9 | 10 | add_subdirectory("${CMAKE_CURRENT_BINARY_DIR}/root" hidapi_root) 11 | -------------------------------------------------------------------------------- /testgui/.gitignore: -------------------------------------------------------------------------------- 1 | Debug 2 | Release 3 | *.exp 4 | *.ilk 5 | *.lib 6 | *.suo 7 | *.vcproj.* 8 | *.ncb 9 | *.suo 10 | *.dll 11 | *.pdb 12 | *.o 13 | hidapi-testgui 14 | hidapi-hidraw-testgui 15 | hidapi-libusb-testgui 16 | .deps 17 | .libs 18 | *.la 19 | *.lo 20 | TestGUI.app 21 | -------------------------------------------------------------------------------- /testgui/Makefile-manual: -------------------------------------------------------------------------------- 1 | 2 | 3 | OS=$(shell uname) 4 | 5 | ifeq ($(OS), Darwin) 6 | FILE=Makefile.mac 7 | endif 8 | 9 | ifneq (,$(findstring MINGW,$(OS))) 10 | FILE=Makefile.mingw 11 | endif 12 | 13 | ifeq ($(OS), Linux) 14 | FILE=Makefile.linux 15 | endif 16 | 17 | ifeq ($(OS), FreeBSD) 18 | FILE=Makefile.freebsd 19 | endif 20 | 21 | ifeq ($(FILE), ) 22 | all: 23 | $(error Your platform ${OS} is not supported at this time.) 24 | endif 25 | 26 | include $(FILE) 27 | -------------------------------------------------------------------------------- /testgui/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | AM_CPPFLAGS = -I$(top_srcdir)/hidapi/ $(CFLAGS_TESTGUI) 3 | 4 | if OS_LINUX 5 | ## Linux 6 | bin_PROGRAMS = hidapi-hidraw-testgui hidapi-libusb-testgui 7 | 8 | hidapi_hidraw_testgui_SOURCES = test.cpp 9 | hidapi_hidraw_testgui_LDADD = $(top_builddir)/linux/libhidapi-hidraw.la $(LIBS_TESTGUI) 10 | 11 | hidapi_libusb_testgui_SOURCES = test.cpp 12 | hidapi_libusb_testgui_LDADD = $(top_builddir)/libusb/libhidapi-libusb.la $(LIBS_TESTGUI) 13 | else 14 | ## Other OS's 15 | bin_PROGRAMS = hidapi-testgui 16 | 17 | hidapi_testgui_SOURCES = test.cpp 18 | hidapi_testgui_LDADD = $(top_builddir)/$(backend)/libhidapi.la $(LIBS_TESTGUI) 19 | endif 20 | 21 | if OS_DARWIN 22 | hidapi_testgui_SOURCES = test.cpp mac_support_cocoa.m mac_support.h 23 | # Rules for copying the binary and its dependencies into the app bundle. 24 | TestGUI.app/Contents/MacOS/hidapi-testgui$(EXEEXT): hidapi-testgui$(EXEEXT) 25 | $(srcdir)/copy_to_bundle.sh 26 | 27 | all: all-am TestGUI.app/Contents/MacOS/hidapi-testgui$(EXEEXT) 28 | 29 | endif 30 | 31 | EXTRA_DIST = \ 32 | copy_to_bundle.sh \ 33 | Makefile-manual \ 34 | Makefile.freebsd \ 35 | Makefile.linux \ 36 | Makefile.mac \ 37 | Makefile.mingw \ 38 | TestGUI.app.in \ 39 | testgui.sln \ 40 | testgui.vcproj 41 | 42 | distclean-local: 43 | rm -rf TestGUI.app 44 | -------------------------------------------------------------------------------- /testgui/Makefile.freebsd: -------------------------------------------------------------------------------- 1 | ########################################### 2 | # Simple Makefile for HIDAPI test program 3 | # 4 | # Alan Ott 5 | # Signal 11 Software 6 | # 2010-06-01 7 | ########################################### 8 | 9 | all: testgui 10 | 11 | CC=cc 12 | CXX=c++ 13 | COBJS=../libusb/hid.o 14 | CPPOBJS=test.o 15 | OBJS=$(COBJS) $(CPPOBJS) 16 | CFLAGS=-I../hidapi -I/usr/local/include `fox-config --cflags` -Wall -g -c 17 | LDFLAGS= -L/usr/local/lib 18 | LIBS= -lusb -liconv `fox-config --libs` -pthread 19 | 20 | 21 | testgui: $(OBJS) 22 | $(CXX) -Wall -g $^ $(LDFLAGS) -o $@ $(LIBS) 23 | 24 | $(COBJS): %.o: %.c 25 | $(CC) $(CFLAGS) $< -o $@ 26 | 27 | $(CPPOBJS): %.o: %.cpp 28 | $(CXX) $(CFLAGS) $< -o $@ 29 | 30 | clean: 31 | rm *.o testgui 32 | 33 | .PHONY: clean 34 | -------------------------------------------------------------------------------- /testgui/Makefile.linux: -------------------------------------------------------------------------------- 1 | ########################################### 2 | # Simple Makefile for HIDAPI test program 3 | # 4 | # Alan Ott 5 | # Signal 11 Software 6 | # 2010-06-01 7 | ########################################### 8 | 9 | all: testgui 10 | 11 | CC=gcc 12 | CXX=g++ 13 | COBJS=../libusb/hid.o 14 | CPPOBJS=test.o 15 | OBJS=$(COBJS) $(CPPOBJS) 16 | CFLAGS=-I../hidapi -Wall -g -c `fox-config --cflags` `pkg-config libusb-1.0 --cflags` 17 | LIBS=-ludev -lrt -lpthread `fox-config --libs` `pkg-config libusb-1.0 --libs` 18 | 19 | 20 | testgui: $(OBJS) 21 | g++ -Wall -g $^ $(LIBS) -o testgui 22 | 23 | $(COBJS): %.o: %.c 24 | $(CC) $(CFLAGS) $< -o $@ 25 | 26 | $(CPPOBJS): %.o: %.cpp 27 | $(CXX) $(CFLAGS) $< -o $@ 28 | 29 | clean: 30 | rm *.o testgui 31 | 32 | .PHONY: clean 33 | -------------------------------------------------------------------------------- /testgui/Makefile.mac: -------------------------------------------------------------------------------- 1 | ########################################### 2 | # Simple Makefile for HIDAPI test program 3 | # 4 | # Alan Ott 5 | # Signal 11 Software 6 | # 2010-07-03 7 | ########################################### 8 | 9 | all: hidapi-testgui 10 | 11 | CC=gcc 12 | CXX=g++ 13 | COBJS=../mac/hid.o 14 | CPPOBJS=test.o 15 | OBJCOBJS=mac_support_cocoa.o 16 | OBJS=$(COBJS) $(CPPOBJS) $(OBJCOBJS) 17 | CFLAGS=-I../hidapi -Wall -g -c `fox-config --cflags` 18 | LDFLAGS=-L/usr/X11R6/lib 19 | LIBS=`fox-config --libs` -framework IOKit -framework CoreFoundation -framework Cocoa 20 | 21 | 22 | hidapi-testgui: $(OBJS) TestGUI.app 23 | g++ -Wall -g $(OBJS) $(LIBS) $(LDFLAGS) -o hidapi-testgui 24 | ./copy_to_bundle.sh 25 | #cp TestGUI.app/Contents/MacOS/hidapi-testgui TestGUI.app/Contents/MacOS/tg 26 | #cp start.sh TestGUI.app/Contents/MacOS/hidapi-testgui 27 | 28 | $(COBJS): %.o: %.c 29 | $(CC) $(CFLAGS) $< -o $@ 30 | 31 | $(CPPOBJS): %.o: %.cpp 32 | $(CXX) $(CFLAGS) $< -o $@ 33 | 34 | $(OBJCOBJS): %.o: %.m 35 | $(CXX) $(CFLAGS) -x objective-c++ $< -o $@ 36 | 37 | TestGUI.app: TestGUI.app.in 38 | rm -Rf TestGUI.app 39 | mkdir -p TestGUI.app 40 | cp -R TestGUI.app.in/ TestGUI.app 41 | 42 | clean: 43 | rm -f $(OBJS) hidapi-testgui 44 | rm -Rf TestGUI.app 45 | 46 | .PHONY: clean 47 | -------------------------------------------------------------------------------- /testgui/Makefile.mingw: -------------------------------------------------------------------------------- 1 | ########################################### 2 | # Simple Makefile for HIDAPI test program 3 | # 4 | # Alan Ott 5 | # Signal 11 Software 6 | # 2010-06-01 7 | ########################################### 8 | 9 | all: hidapi-testgui 10 | 11 | CC=gcc 12 | CXX=g++ 13 | COBJS=../windows/hid.o 14 | CPPOBJS=test.o 15 | OBJS=$(COBJS) $(CPPOBJS) 16 | CFLAGS=-I../hidapi -I../../hidapi-externals/fox/include -g -c 17 | LIBS= -mwindows -L../../hidapi-externals/fox/lib -Wl,-Bstatic -lFOX-1.6 -Wl,-Bdynamic -lgdi32 -Wl,--enable-auto-import -static-libgcc -static-libstdc++ -lkernel32 18 | 19 | 20 | hidapi-testgui: $(OBJS) 21 | g++ -g $^ $(LIBS) -o hidapi-testgui 22 | 23 | $(COBJS): %.o: %.c 24 | $(CC) $(CFLAGS) $< -o $@ 25 | 26 | $(CPPOBJS): %.o: %.cpp 27 | $(CXX) $(CFLAGS) $< -o $@ 28 | 29 | clean: 30 | rm -f *.o hidapi-testgui.exe 31 | 32 | .PHONY: clean 33 | -------------------------------------------------------------------------------- /testgui/TestGUI.app.in/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleDisplayName 8 | 9 | CFBundleExecutable 10 | hidapi-testgui 11 | CFBundleIconFile 12 | Signal11.icns 13 | CFBundleIdentifier 14 | us.signal11.hidtestgui 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | testgui 19 | CFBundlePackageType 20 | APPL 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | CSResourcesFileMapped 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /testgui/TestGUI.app.in/Contents/PkgInfo: -------------------------------------------------------------------------------- 1 | APPL???? -------------------------------------------------------------------------------- /testgui/TestGUI.app.in/Contents/Resources/English.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gus33000/hidapi/b516e970480a8d05b1c392d106ca110a9d06d668/testgui/TestGUI.app.in/Contents/Resources/English.lproj/InfoPlist.strings -------------------------------------------------------------------------------- /testgui/TestGUI.app.in/Contents/Resources/Signal11.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gus33000/hidapi/b516e970480a8d05b1c392d106ca110a9d06d668/testgui/TestGUI.app.in/Contents/Resources/Signal11.icns -------------------------------------------------------------------------------- /testgui/copy_to_bundle.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #### Configuration: 4 | # The name of the executable. It is assumed 5 | # that it is in the current working directory. 6 | EXE_NAME=hidapi-testgui 7 | # Path to the executable directory inside the bundle. 8 | # This must be an absolute path, so use $PWD. 9 | EXEPATH=$PWD/TestGUI.app/Contents/MacOS 10 | # Libraries to explicitly bundle, even though they 11 | # may not be in /opt/local. One per line. These 12 | # are used with grep, so only a portion of the name 13 | # is required. eg: libFOX, libz, etc. 14 | LIBS_TO_BUNDLE=libFOX 15 | 16 | 17 | function copydeps { 18 | local file=$1 19 | # echo "Copying deps for $file...." 20 | local BASE_OF_EXE=`basename $file` 21 | 22 | # A will contain the dependencies of this library 23 | local A=`otool -LX $file |cut -f 1 -d " "` 24 | local i 25 | for i in $A; do 26 | local BASE=`basename $i` 27 | 28 | # See if it's a lib we specifically want to bundle 29 | local bundle_this_lib=0 30 | local j 31 | for j in $LIBS_TO_BUNDLE; do 32 | echo $i |grep -q $j 33 | if [ $? -eq 0 ]; then 34 | bundle_this_lib=1 35 | echo "bundling $i because it's in the list." 36 | break; 37 | fi 38 | done 39 | 40 | # See if it's in /opt/local. Bundle all in /opt/local 41 | local isOptLocal=0 42 | echo $i |grep -q /opt/local 43 | if [ $? -eq 0 ]; then 44 | isOptLocal=1 45 | echo "bundling $i because it's in /opt/local." 46 | fi 47 | 48 | # Bundle the library 49 | if [ $isOptLocal -ne 0 ] || [ $bundle_this_lib -ne 0 ]; then 50 | 51 | # Copy the file into the bundle if it exists. 52 | if [ -f $EXEPATH/$BASE ]; then 53 | z=0 54 | else 55 | cp $i $EXEPATH 56 | chmod 755 $EXEPATH/$BASE 57 | fi 58 | 59 | 60 | # echo "$BASE_OF_EXE depends on $BASE" 61 | 62 | # Fix the paths using install_name_tool and then 63 | # call this function recursively for each dependency 64 | # of this library. 65 | if [ $BASE_OF_EXE != $BASE ]; then 66 | 67 | # Fix the paths 68 | install_name_tool -id @executable_path/$BASE $EXEPATH/$BASE 69 | install_name_tool -change $i @executable_path/$BASE $EXEPATH/$BASE_OF_EXE 70 | 71 | # Call this function (recursive) on 72 | # on each dependency of this library. 73 | copydeps $EXEPATH/$BASE 74 | fi 75 | fi 76 | done 77 | } 78 | 79 | rm -f $EXEPATH/* 80 | mkdir -p $EXEPATH 81 | 82 | # Copy the binary into the bundle. Use ../libtool to do this if it's 83 | # available because if $EXE_NAME was built with autotools, it will be 84 | # necessary. If ../libtool not available, just use cp to do the copy, but 85 | # only if $EXE_NAME is a binary. 86 | if [ -x ../libtool ]; then 87 | ../libtool --mode=install cp $EXE_NAME $EXEPATH 88 | else 89 | file -bI $EXE_NAME |grep binary 90 | if [ $? -ne 0 ]; then 91 | echo "There is no ../libtool and $EXE_NAME is not a binary." 92 | echo "I'm not sure what to do." 93 | exit 1 94 | else 95 | cp $EXE_NAME $EXEPATH 96 | fi 97 | fi 98 | copydeps $EXEPATH/$EXE_NAME 99 | -------------------------------------------------------------------------------- /testgui/mac_support.h: -------------------------------------------------------------------------------- 1 | /******************************* 2 | Mac support for HID Test GUI 3 | 4 | Alan Ott 5 | Signal 11 Software 6 | 7 | *******************************/ 8 | 9 | #ifndef MAC_SUPPORT_H__ 10 | #define MAC_SUPPORT_H__ 11 | 12 | extern "C" { 13 | void init_apple_message_system(); 14 | void check_apple_events(); 15 | } 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /testgui/mac_support_cocoa.m: -------------------------------------------------------------------------------- 1 | /******************************* 2 | Mac support for HID Test GUI 3 | 4 | Alan Ott 5 | Signal 11 Software 6 | *******************************/ 7 | 8 | #include 9 | #import 10 | 11 | #ifndef MAC_OS_X_VERSION_10_12 12 | #define MAC_OS_X_VERSION_10_12 101200 13 | #endif 14 | 15 | // macOS 10.12 deprecated NSAnyEventMask in favor of NSEventMaskAny 16 | #if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12 17 | #define NSEventMaskAny NSAnyEventMask 18 | #endif 19 | 20 | extern FXMainWindow *g_main_window; 21 | 22 | 23 | @interface MyAppDelegate : NSObject 24 | { 25 | } 26 | @end 27 | 28 | @implementation MyAppDelegate 29 | - (void) applicationWillBecomeActive:(NSNotification*)notif 30 | { 31 | printf("WillBecomeActive\n"); 32 | g_main_window->show(); 33 | 34 | } 35 | 36 | - (void) applicationWillTerminate:(NSNotification*)notif 37 | { 38 | /* Doesn't get called. Not sure why */ 39 | printf("WillTerminate\n"); 40 | FXApp::instance()->exit(); 41 | } 42 | 43 | - (NSApplicationTerminateReply) applicationShouldTerminate:(NSApplication*)sender 44 | { 45 | /* Doesn't get called. Not sure why */ 46 | printf("ShouldTerminate\n"); 47 | return YES; 48 | } 49 | 50 | - (void) applicationWillHide:(NSNotification*)notif 51 | { 52 | printf("WillHide\n"); 53 | g_main_window->hide(); 54 | } 55 | 56 | - (void) handleQuitEvent:(NSAppleEventDescriptor*)event withReplyEvent:(NSAppleEventDescriptor*)replyEvent 57 | { 58 | printf("QuitEvent\n"); 59 | FXApp::instance()->exit(); 60 | } 61 | 62 | @end 63 | 64 | extern "C" { 65 | 66 | void 67 | init_apple_message_system() 68 | { 69 | static MyAppDelegate *d = [MyAppDelegate new]; 70 | 71 | [[NSApplication sharedApplication] setDelegate:d]; 72 | 73 | /* Register for Apple Events. */ 74 | /* This is from 75 | http://stackoverflow.com/questions/1768497/application-exit-event */ 76 | NSAppleEventManager *aem = [NSAppleEventManager sharedAppleEventManager]; 77 | [aem setEventHandler:d 78 | andSelector:@selector(handleQuitEvent:withReplyEvent:) 79 | forEventClass:kCoreEventClass andEventID:kAEQuitApplication]; 80 | } 81 | 82 | void 83 | check_apple_events() 84 | { 85 | NSApplication *app = [NSApplication sharedApplication]; 86 | 87 | NSAutoreleasePool *pool = [NSAutoreleasePool new]; 88 | while (1) { 89 | NSEvent* event = [NSApp nextEventMatchingMask:NSEventMaskAny 90 | untilDate:nil 91 | inMode:NSDefaultRunLoopMode 92 | dequeue:YES]; 93 | if (event == NULL) 94 | break; 95 | else { 96 | //printf("Event happened: Type: %d\n", event->_type); 97 | [app sendEvent: event]; 98 | } 99 | } 100 | [pool release]; 101 | } 102 | 103 | } /* extern "C" */ 104 | -------------------------------------------------------------------------------- /testgui/testgui.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 10.00 3 | # Visual C++ Express 2008 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testgui", "testgui.vcproj", "{08769AC3-785A-4DDC-BFC7-1775414B7AB7}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {08769AC3-785A-4DDC-BFC7-1775414B7AB7}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {08769AC3-785A-4DDC-BFC7-1775414B7AB7}.Debug|Win32.Build.0 = Debug|Win32 14 | {08769AC3-785A-4DDC-BFC7-1775414B7AB7}.Release|Win32.ActiveCfg = Release|Win32 15 | {08769AC3-785A-4DDC-BFC7-1775414B7AB7}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /testgui/testgui.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 15 | 16 | 17 | 18 | 19 | 26 | 29 | 32 | 35 | 38 | 41 | 53 | 56 | 59 | 62 | 73 | 76 | 79 | 82 | 85 | 88 | 91 | 95 | 96 | 104 | 107 | 110 | 113 | 116 | 119 | 131 | 134 | 137 | 140 | 153 | 156 | 159 | 162 | 165 | 168 | 171 | 175 | 176 | 177 | 178 | 179 | 180 | 185 | 188 | 189 | 192 | 193 | 194 | 199 | 202 | 203 | 204 | 209 | 210 | 213 | 214 | 215 | 216 | 217 | 218 | -------------------------------------------------------------------------------- /udev/69-hid.rules: -------------------------------------------------------------------------------- 1 | # This is a sample udev file for HIDAPI devices which lets unprivileged 2 | # users who are physically present at the system (not remote users) access 3 | # HID devices. 4 | 5 | # If you are using the libusb implementation of hidapi (libusb/hid.c), then 6 | # use something like the following line, substituting the VID and PID with 7 | # those of your device. 8 | 9 | # HIDAPI/libusb 10 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="003f", TAG+="uaccess" 11 | 12 | # If you are using the hidraw implementation (linux/hid.c), then do something 13 | # like the following, substituting the VID and PID with your device. 14 | 15 | # HIDAPI/hidraw 16 | KERNEL=="hidraw*", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="003f", TAG+="uaccess" 17 | 18 | # Once done, optionally rename this file for your application, and drop it into 19 | # /etc/udev/rules.d/. 20 | # NOTE: these rules must have priorty before 73-seat-late.rules. 21 | # (Small discussion/explanation in systemd repo: 22 | # https://github.com/systemd/systemd/issues/4288#issuecomment-348166161) 23 | # for example, name the file /etc/udev/rules.d/70-my-application-hid.rules. 24 | # Then, replug your device or run: 25 | # sudo udevadm control --reload-rules && sudo udevadm trigger 26 | 27 | # Note that the hexadecimal values for VID and PID are case sensitive and 28 | # must be lower case. 29 | 30 | # TAG+="uaccess" only gives permission to physically present users, which 31 | # is appropriate in most scenarios. If you require access to the device 32 | # from a remote session (e.g. over SSH), add 33 | # GROUP="plugdev", MODE="660" 34 | # to the end of the udev rule lines, add your user to the plugdev group with: 35 | # usermod -aG plugdev USERNAME 36 | # then log out and log back in (or restart the system). 37 | -------------------------------------------------------------------------------- /windows/.gitignore: -------------------------------------------------------------------------------- 1 | Debug 2 | Release 3 | .vs/ 4 | *.exp 5 | *.ilk 6 | *.lib 7 | *.suo 8 | *.vcproj.* 9 | *.vcxproj.* 10 | *.ncb 11 | *.suo 12 | *.dll 13 | *.pdb 14 | .deps 15 | .libs 16 | *.lo 17 | *.la 18 | -------------------------------------------------------------------------------- /windows/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | list(APPEND HIDAPI_PUBLIC_HEADERS "hidapi_winapi.h") 2 | 3 | set(SOURCES 4 | hid.c 5 | hidapi_cfgmgr32.h 6 | hidapi_descriptor_reconstruct.c 7 | hidapi_descriptor_reconstruct.h 8 | hidapi_hidclass.h 9 | hidapi_hidpi.h 10 | hidapi_hidsdi.h 11 | ) 12 | 13 | if(BUILD_SHARED_LIBS) 14 | list(APPEND SOURCES hidapi.rc) 15 | endif() 16 | 17 | add_library(hidapi_winapi 18 | ${HIDAPI_PUBLIC_HEADERS} 19 | ${SOURCES} 20 | ) 21 | target_link_libraries(hidapi_winapi 22 | PUBLIC hidapi_include 23 | ) 24 | 25 | if(NOT BUILD_SHARED_LIBS) 26 | target_compile_definitions(hidapi_winapi 27 | # prevent marking functions as __declspec(dllexport) for static library build 28 | # #480: this should be refactored for v1.0 29 | PUBLIC HID_API_NO_EXPORT_DEFINE 30 | ) 31 | endif() 32 | 33 | set_target_properties(hidapi_winapi 34 | PROPERTIES 35 | EXPORT_NAME "winapi" 36 | OUTPUT_NAME "hidapi" 37 | VERSION ${PROJECT_VERSION} 38 | PUBLIC_HEADER "${HIDAPI_PUBLIC_HEADERS}" 39 | ) 40 | 41 | # compatibility with find_package() 42 | add_library(hidapi::winapi ALIAS hidapi_winapi) 43 | # compatibility with raw library link 44 | add_library(hidapi ALIAS hidapi_winapi) 45 | 46 | if(HIDAPI_INSTALL_TARGETS) 47 | install(TARGETS hidapi_winapi EXPORT hidapi 48 | RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" 49 | LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" 50 | ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" 51 | PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/hidapi" 52 | ) 53 | endif() 54 | 55 | hidapi_configure_pc("${PROJECT_ROOT}/pc/hidapi.pc.in") 56 | 57 | if(HIDAPI_WITH_TESTS) 58 | add_subdirectory(test) 59 | endif() 60 | 61 | if(DEFINED HIDAPI_BUILD_PP_DATA_DUMP AND HIDAPI_BUILD_PP_DATA_DUMP) 62 | add_subdirectory(pp_data_dump) 63 | endif() 64 | -------------------------------------------------------------------------------- /windows/Makefile-manual: -------------------------------------------------------------------------------- 1 | 2 | 3 | OS=$(shell uname) 4 | 5 | ifneq (,$(findstring MINGW,$(OS))) 6 | FILE=Makefile.mingw 7 | endif 8 | 9 | ifeq ($(FILE), ) 10 | all: 11 | $(error Your platform ${OS} is not supported at this time.) 12 | endif 13 | 14 | include $(FILE) 15 | -------------------------------------------------------------------------------- /windows/Makefile.am: -------------------------------------------------------------------------------- 1 | lib_LTLIBRARIES = libhidapi.la 2 | libhidapi_la_SOURCES = hid.c 3 | libhidapi_la_LDFLAGS = $(LTLDFLAGS) 4 | AM_CPPFLAGS = -I$(top_srcdir)/hidapi/ 5 | libhidapi_la_LIBADD = $(LIBS) 6 | 7 | hdrdir = $(includedir)/hidapi 8 | hdr_HEADERS = $(top_srcdir)/hidapi/hidapi.h 9 | 10 | EXTRA_DIST = \ 11 | hidapi.vcproj \ 12 | hidtest.vcproj \ 13 | Makefile-manual \ 14 | Makefile.mingw \ 15 | hidapi.sln 16 | -------------------------------------------------------------------------------- /windows/Makefile.mingw: -------------------------------------------------------------------------------- 1 | ########################################### 2 | # Simple Makefile for HIDAPI test program 3 | # 4 | # Alan Ott 5 | # Signal 11 Software 6 | # 2010-06-01 7 | ########################################### 8 | 9 | all: hidtest libhidapi.dll 10 | 11 | CC=gcc 12 | COBJS=hid.o ../hidtest/test.o 13 | OBJS=$(COBJS) 14 | CFLAGS=-I../hidapi -I. -g -c 15 | LIBS= 16 | DLL_LDFLAGS = -mwindows 17 | 18 | hidtest: $(OBJS) 19 | $(CC) -g $^ $(LIBS) -o hidtest 20 | 21 | libhidapi.dll: $(OBJS) 22 | $(CC) -g $^ $(DLL_LDFLAGS) -o libhidapi.dll 23 | 24 | $(COBJS): %.o: %.c 25 | $(CC) $(CFLAGS) $< -o $@ 26 | 27 | clean: 28 | rm *.o ../hidtest/*.o hidtest.exe 29 | 30 | .PHONY: clean 31 | -------------------------------------------------------------------------------- /windows/hidapi.rc: -------------------------------------------------------------------------------- 1 | #include "winresrc.h" 2 | 3 | #include "hidapi.h" 4 | 5 | // English 6 | LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT 7 | VS_VERSION_INFO VERSIONINFO 8 | FILEVERSION HID_API_VERSION_MAJOR,HID_API_VERSION_MINOR,HID_API_VERSION_PATCH,0 9 | PRODUCTVERSION HID_API_VERSION_MAJOR,HID_API_VERSION_MINOR,HID_API_VERSION_PATCH,0 10 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 11 | FILEFLAGS 0 12 | #ifdef _DEBUG 13 | | VS_FF_DEBUG 14 | #endif 15 | FILEOS VOS_NT_WINDOWS32 16 | FILETYPE VFT_DLL 17 | BEGIN 18 | BLOCK "StringFileInfo" 19 | BEGIN 20 | BLOCK "04090000" 21 | BEGIN 22 | VALUE "CompanyName", "libusb/hidapi Team" 23 | VALUE "FileDescription", "A multi-platform library to interface with HID devices (USB, Bluetooth, etc.)" 24 | VALUE "FileVersion", HID_API_VERSION_STR 25 | VALUE "ProductName", "HIDAPI" 26 | VALUE "ProductVersion", HID_API_VERSION_STR 27 | VALUE "Licence", "https://github.com/libusb/hidapi/blob/master/LICENSE.txt" 28 | VALUE "Comments", "https://github.com/libusb/hidapi" 29 | END 30 | END 31 | BLOCK "VarFileInfo" 32 | BEGIN 33 | VALUE "Translation", 0x409, 0 34 | END 35 | END 36 | -------------------------------------------------------------------------------- /windows/hidapi.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.28307.136 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hidapi", "hidapi.vcxproj", "{A107C21C-418A-4697-BB10-20C3AA60E2E4}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hidtest", "hidtest.vcxproj", "{23E9FF6A-49D1-4993-B2B5-BBB992C6C712}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Win32 = Debug|Win32 13 | Debug|x64 = Debug|x64 14 | Release|Win32 = Release|Win32 15 | Release|x64 = Release|x64 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {A107C21C-418A-4697-BB10-20C3AA60E2E4}.Debug|Win32.ActiveCfg = Debug|Win32 19 | {A107C21C-418A-4697-BB10-20C3AA60E2E4}.Debug|Win32.Build.0 = Debug|Win32 20 | {A107C21C-418A-4697-BB10-20C3AA60E2E4}.Debug|x64.ActiveCfg = Debug|x64 21 | {A107C21C-418A-4697-BB10-20C3AA60E2E4}.Debug|x64.Build.0 = Debug|x64 22 | {A107C21C-418A-4697-BB10-20C3AA60E2E4}.Release|Win32.ActiveCfg = Release|Win32 23 | {A107C21C-418A-4697-BB10-20C3AA60E2E4}.Release|Win32.Build.0 = Release|Win32 24 | {A107C21C-418A-4697-BB10-20C3AA60E2E4}.Release|x64.ActiveCfg = Release|x64 25 | {A107C21C-418A-4697-BB10-20C3AA60E2E4}.Release|x64.Build.0 = Release|x64 26 | {23E9FF6A-49D1-4993-B2B5-BBB992C6C712}.Debug|Win32.ActiveCfg = Debug|Win32 27 | {23E9FF6A-49D1-4993-B2B5-BBB992C6C712}.Debug|Win32.Build.0 = Debug|Win32 28 | {23E9FF6A-49D1-4993-B2B5-BBB992C6C712}.Debug|x64.ActiveCfg = Debug|x64 29 | {23E9FF6A-49D1-4993-B2B5-BBB992C6C712}.Debug|x64.Build.0 = Debug|x64 30 | {23E9FF6A-49D1-4993-B2B5-BBB992C6C712}.Release|Win32.ActiveCfg = Release|Win32 31 | {23E9FF6A-49D1-4993-B2B5-BBB992C6C712}.Release|Win32.Build.0 = Release|Win32 32 | {23E9FF6A-49D1-4993-B2B5-BBB992C6C712}.Release|x64.ActiveCfg = Release|x64 33 | {23E9FF6A-49D1-4993-B2B5-BBB992C6C712}.Release|x64.Build.0 = Release|x64 34 | EndGlobalSection 35 | GlobalSection(SolutionProperties) = preSolution 36 | HideSolutionNode = FALSE 37 | EndGlobalSection 38 | GlobalSection(ExtensibilityGlobals) = postSolution 39 | SolutionGuid = {8749E535-9C65-4A89-840E-78D7578C7866} 40 | EndGlobalSection 41 | EndGlobal 42 | -------------------------------------------------------------------------------- /windows/hidapi.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 15 | 16 | 17 | 18 | 19 | 26 | 29 | 32 | 35 | 38 | 41 | 53 | 56 | 59 | 62 | 69 | 72 | 75 | 78 | 81 | 84 | 87 | 90 | 91 | 99 | 102 | 105 | 108 | 111 | 114 | 126 | 129 | 132 | 135 | 145 | 148 | 151 | 154 | 157 | 160 | 163 | 166 | 167 | 168 | 169 | 170 | 171 | 176 | 179 | 180 | 181 | 186 | 189 | 190 | 191 | 196 | 197 | 198 | 199 | 200 | 201 | -------------------------------------------------------------------------------- /windows/hidapi.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | 23 | 24 | Header Files 25 | 26 | 27 | Header Files 28 | 29 | 30 | 31 | 32 | Resource Files 33 | 34 | 35 | -------------------------------------------------------------------------------- /windows/hidapi_cfgmgr32.h: -------------------------------------------------------------------------------- 1 | /******************************************************* 2 | HIDAPI - Multi-Platform library for 3 | communication with HID devices. 4 | 5 | libusb/hidapi Team 6 | 7 | Copyright 2022, All Rights Reserved. 8 | 9 | At the discretion of the user of this library, 10 | this software may be licensed under the terms of the 11 | GNU General Public License v3, a BSD-Style license, or the 12 | original HIDAPI license as outlined in the LICENSE.txt, 13 | LICENSE-gpl3.txt, LICENSE-bsd.txt, and LICENSE-orig.txt 14 | files located at the root of the source distribution. 15 | These files may also be found in the public source 16 | code repository located at: 17 | https://github.com/libusb/hidapi . 18 | ********************************************************/ 19 | 20 | #ifndef HIDAPI_CFGMGR32_H 21 | #define HIDAPI_CFGMGR32_H 22 | 23 | #ifdef HIDAPI_USE_DDK 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #else 31 | 32 | /* This part of the header mimics cfgmgr32.h, 33 | but only what is used by HIDAPI */ 34 | 35 | #include 36 | #include 37 | #include 38 | 39 | typedef DWORD RETURN_TYPE; 40 | typedef RETURN_TYPE CONFIGRET; 41 | typedef DWORD DEVNODE, DEVINST; 42 | typedef DEVNODE* PDEVNODE, * PDEVINST; 43 | typedef WCHAR* DEVNODEID_W, * DEVINSTID_W; 44 | 45 | #define CR_SUCCESS (0x00000000) 46 | #define CR_BUFFER_SMALL (0x0000001A) 47 | #define CR_FAILURE (0x00000013) 48 | 49 | #define CM_LOCATE_DEVNODE_NORMAL 0x00000000 50 | 51 | #define CM_GET_DEVICE_INTERFACE_LIST_PRESENT (0x00000000) 52 | 53 | typedef CONFIGRET(__stdcall* CM_Locate_DevNodeW_)(PDEVINST pdnDevInst, DEVINSTID_W pDeviceID, ULONG ulFlags); 54 | typedef CONFIGRET(__stdcall* CM_Get_Parent_)(PDEVINST pdnDevInst, DEVINST dnDevInst, ULONG ulFlags); 55 | typedef CONFIGRET(__stdcall* CM_Get_DevNode_PropertyW_)(DEVINST dnDevInst, CONST DEVPROPKEY* PropertyKey, DEVPROPTYPE* PropertyType, PBYTE PropertyBuffer, PULONG PropertyBufferSize, ULONG ulFlags); 56 | typedef CONFIGRET(__stdcall* CM_Get_Device_Interface_PropertyW_)(LPCWSTR pszDeviceInterface, CONST DEVPROPKEY* PropertyKey, DEVPROPTYPE* PropertyType, PBYTE PropertyBuffer, PULONG PropertyBufferSize, ULONG ulFlags); 57 | typedef CONFIGRET(__stdcall* CM_Get_Device_Interface_List_SizeW_)(PULONG pulLen, LPGUID InterfaceClassGuid, DEVINSTID_W pDeviceID, ULONG ulFlags); 58 | typedef CONFIGRET(__stdcall* CM_Get_Device_Interface_ListW_)(LPGUID InterfaceClassGuid, DEVINSTID_W pDeviceID, PZZWSTR Buffer, ULONG BufferLen, ULONG ulFlags); 59 | 60 | // from devpkey.h 61 | DEFINE_DEVPROPKEY(DEVPKEY_NAME, 0xb725f130, 0x47ef, 0x101a, 0xa5, 0xf1, 0x02, 0x60, 0x8c, 0x9e, 0xeb, 0xac, 10); // DEVPROP_TYPE_STRING 62 | DEFINE_DEVPROPKEY(DEVPKEY_Device_Manufacturer, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 13); // DEVPROP_TYPE_STRING 63 | DEFINE_DEVPROPKEY(DEVPKEY_Device_InstanceId, 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 256); // DEVPROP_TYPE_STRING 64 | DEFINE_DEVPROPKEY(DEVPKEY_Device_HardwareIds, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 3); // DEVPROP_TYPE_STRING_LIST 65 | DEFINE_DEVPROPKEY(DEVPKEY_Device_CompatibleIds, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 4); // DEVPROP_TYPE_STRING_LIST 66 | DEFINE_DEVPROPKEY(DEVPKEY_Device_ContainerId, 0x8c7ed206, 0x3f8a, 0x4827, 0xb3, 0xab, 0xae, 0x9e, 0x1f, 0xae, 0xfc, 0x6c, 2); // DEVPROP_TYPE_GUID 67 | 68 | // from propkey.h 69 | DEFINE_PROPERTYKEY(PKEY_DeviceInterface_Bluetooth_DeviceAddress, 0x2BD67D8B, 0x8BEB, 0x48D5, 0x87, 0xE0, 0x6C, 0xDA, 0x34, 0x28, 0x04, 0x0A, 1); // DEVPROP_TYPE_STRING 70 | DEFINE_PROPERTYKEY(PKEY_DeviceInterface_Bluetooth_Manufacturer, 0x2BD67D8B, 0x8BEB, 0x48D5, 0x87, 0xE0, 0x6C, 0xDA, 0x34, 0x28, 0x04, 0x0A, 4); // DEVPROP_TYPE_STRING 71 | DEFINE_PROPERTYKEY(PKEY_DeviceInterface_Bluetooth_ModelNumber, 0x2BD67D8B, 0x8BEB, 0x48D5, 0x87, 0xE0, 0x6C, 0xDA, 0x34, 0x28, 0x04, 0x0A, 5); // DEVPROP_TYPE_STRING 72 | 73 | #endif 74 | 75 | #endif /* HIDAPI_CFGMGR32_H */ 76 | -------------------------------------------------------------------------------- /windows/hidapi_hidclass.h: -------------------------------------------------------------------------------- 1 | /******************************************************* 2 | HIDAPI - Multi-Platform library for 3 | communication with HID devices. 4 | 5 | libusb/hidapi Team 6 | 7 | Copyright 2022, All Rights Reserved. 8 | 9 | At the discretion of the user of this library, 10 | this software may be licensed under the terms of the 11 | GNU General Public License v3, a BSD-Style license, or the 12 | original HIDAPI license as outlined in the LICENSE.txt, 13 | LICENSE-gpl3.txt, LICENSE-bsd.txt, and LICENSE-orig.txt 14 | files located at the root of the source distribution. 15 | These files may also be found in the public source 16 | code repository located at: 17 | https://github.com/libusb/hidapi . 18 | ********************************************************/ 19 | 20 | #ifndef HIDAPI_HIDCLASS_H 21 | #define HIDAPI_HIDCLASS_H 22 | 23 | #ifdef HIDAPI_USE_DDK 24 | 25 | #include 26 | 27 | #else 28 | 29 | /* This part of the header mimics hidclass.h, 30 | but only what is used by HIDAPI */ 31 | 32 | #define HID_OUT_CTL_CODE(id) CTL_CODE(FILE_DEVICE_KEYBOARD, (id), METHOD_OUT_DIRECT, FILE_ANY_ACCESS) 33 | #define IOCTL_HID_GET_FEATURE HID_OUT_CTL_CODE(100) 34 | #define IOCTL_HID_GET_INPUT_REPORT HID_OUT_CTL_CODE(104) 35 | 36 | #endif 37 | 38 | #endif /* HIDAPI_HIDCLASS_H */ 39 | -------------------------------------------------------------------------------- /windows/hidapi_hidpi.h: -------------------------------------------------------------------------------- 1 | /******************************************************* 2 | HIDAPI - Multi-Platform library for 3 | communication with HID devices. 4 | 5 | libusb/hidapi Team 6 | 7 | Copyright 2022, All Rights Reserved. 8 | 9 | At the discretion of the user of this library, 10 | this software may be licensed under the terms of the 11 | GNU General Public License v3, a BSD-Style license, or the 12 | original HIDAPI license as outlined in the LICENSE.txt, 13 | LICENSE-gpl3.txt, LICENSE-bsd.txt, and LICENSE-orig.txt 14 | files located at the root of the source distribution. 15 | These files may also be found in the public source 16 | code repository located at: 17 | https://github.com/libusb/hidapi . 18 | ********************************************************/ 19 | 20 | #ifndef HIDAPI_HIDPI_H 21 | #define HIDAPI_HIDPI_H 22 | 23 | #ifdef HIDAPI_USE_DDK 24 | 25 | #include 26 | 27 | #else 28 | 29 | /* This part of the header mimics hidpi.h, 30 | but only what is used by HIDAPI */ 31 | 32 | typedef enum _HIDP_REPORT_TYPE 33 | { 34 | HidP_Input, 35 | HidP_Output, 36 | HidP_Feature 37 | } HIDP_REPORT_TYPE; 38 | 39 | typedef struct _HIDP_PREPARSED_DATA * PHIDP_PREPARSED_DATA; 40 | 41 | typedef struct _HIDP_CAPS 42 | { 43 | USAGE Usage; 44 | USAGE UsagePage; 45 | USHORT InputReportByteLength; 46 | USHORT OutputReportByteLength; 47 | USHORT FeatureReportByteLength; 48 | USHORT Reserved[17]; 49 | 50 | USHORT NumberLinkCollectionNodes; 51 | 52 | USHORT NumberInputButtonCaps; 53 | USHORT NumberInputValueCaps; 54 | USHORT NumberInputDataIndices; 55 | 56 | USHORT NumberOutputButtonCaps; 57 | USHORT NumberOutputValueCaps; 58 | USHORT NumberOutputDataIndices; 59 | 60 | USHORT NumberFeatureButtonCaps; 61 | USHORT NumberFeatureValueCaps; 62 | USHORT NumberFeatureDataIndices; 63 | } HIDP_CAPS, *PHIDP_CAPS; 64 | 65 | #define HIDP_STATUS_SUCCESS 0x00110000 66 | #define HIDP_STATUS_INVALID_PREPARSED_DATA 0xc0110001 67 | 68 | typedef NTSTATUS (__stdcall *HidP_GetCaps_)(PHIDP_PREPARSED_DATA preparsed_data, PHIDP_CAPS caps); 69 | 70 | #endif 71 | 72 | #endif /* HIDAPI_HIDPI_H */ 73 | -------------------------------------------------------------------------------- /windows/hidapi_hidsdi.h: -------------------------------------------------------------------------------- 1 | /******************************************************* 2 | HIDAPI - Multi-Platform library for 3 | communication with HID devices. 4 | 5 | libusb/hidapi Team 6 | 7 | Copyright 2022, All Rights Reserved. 8 | 9 | At the discretion of the user of this library, 10 | this software may be licensed under the terms of the 11 | GNU General Public License v3, a BSD-Style license, or the 12 | original HIDAPI license as outlined in the LICENSE.txt, 13 | LICENSE-gpl3.txt, LICENSE-bsd.txt, and LICENSE-orig.txt 14 | files located at the root of the source distribution. 15 | These files may also be found in the public source 16 | code repository located at: 17 | https://github.com/libusb/hidapi . 18 | ********************************************************/ 19 | 20 | #ifndef HIDAPI_HIDSDI_H 21 | #define HIDAPI_HIDSDI_H 22 | 23 | #ifdef HIDAPI_USE_DDK 24 | 25 | #include 26 | 27 | #else 28 | 29 | /* This part of the header mimics hidsdi.h, 30 | but only what is used by HIDAPI */ 31 | 32 | typedef USHORT USAGE; 33 | 34 | #include "hidapi_hidpi.h" 35 | 36 | typedef struct _HIDD_ATTRIBUTES{ 37 | ULONG Size; 38 | USHORT VendorID; 39 | USHORT ProductID; 40 | USHORT VersionNumber; 41 | } HIDD_ATTRIBUTES, *PHIDD_ATTRIBUTES; 42 | 43 | typedef struct _HIDP_PREPARSED_DATA * PHIDP_PREPARSED_DATA; 44 | 45 | typedef void (__stdcall *HidD_GetHidGuid_)(LPGUID hid_guid); 46 | typedef BOOLEAN (__stdcall *HidD_GetAttributes_)(HANDLE device, PHIDD_ATTRIBUTES attrib); 47 | typedef BOOLEAN (__stdcall *HidD_GetSerialNumberString_)(HANDLE device, PVOID buffer, ULONG buffer_len); 48 | typedef BOOLEAN (__stdcall *HidD_GetManufacturerString_)(HANDLE handle, PVOID buffer, ULONG buffer_len); 49 | typedef BOOLEAN (__stdcall *HidD_GetProductString_)(HANDLE handle, PVOID buffer, ULONG buffer_len); 50 | typedef BOOLEAN (__stdcall *HidD_SetFeature_)(HANDLE handle, PVOID data, ULONG length); 51 | typedef BOOLEAN (__stdcall *HidD_GetFeature_)(HANDLE handle, PVOID data, ULONG length); 52 | typedef BOOLEAN (__stdcall *HidD_GetInputReport_)(HANDLE handle, PVOID data, ULONG length); 53 | typedef BOOLEAN (__stdcall *HidD_GetIndexedString_)(HANDLE handle, ULONG string_index, PVOID buffer, ULONG buffer_len); 54 | typedef BOOLEAN (__stdcall *HidD_GetPreparsedData_)(HANDLE handle, PHIDP_PREPARSED_DATA *preparsed_data); 55 | typedef BOOLEAN (__stdcall *HidD_FreePreparsedData_)(PHIDP_PREPARSED_DATA preparsed_data); 56 | typedef BOOLEAN (__stdcall *HidD_SetNumInputBuffers_)(HANDLE handle, ULONG number_buffers); 57 | 58 | #endif 59 | 60 | #endif /* HIDAPI_HIDSDI_H */ 61 | -------------------------------------------------------------------------------- /windows/hidapi_winapi.h: -------------------------------------------------------------------------------- 1 | /******************************************************* 2 | HIDAPI - Multi-Platform library for 3 | communication with HID devices. 4 | 5 | libusb/hidapi Team 6 | 7 | Copyright 2022, All Rights Reserved. 8 | 9 | At the discretion of the user of this library, 10 | this software may be licensed under the terms of the 11 | GNU General Public License v3, a BSD-Style license, or the 12 | original HIDAPI license as outlined in the LICENSE.txt, 13 | LICENSE-gpl3.txt, LICENSE-bsd.txt, and LICENSE-orig.txt 14 | files located at the root of the source distribution. 15 | These files may also be found in the public source 16 | code repository located at: 17 | https://github.com/libusb/hidapi . 18 | ********************************************************/ 19 | 20 | /** @file 21 | * @defgroup API hidapi API 22 | * 23 | * Since version 0.12.0, @ref HID_API_VERSION >= HID_API_MAKE_VERSION(0, 12, 0) 24 | */ 25 | 26 | #ifndef HIDAPI_WINAPI_H__ 27 | #define HIDAPI_WINAPI_H__ 28 | 29 | #include 30 | 31 | #include 32 | 33 | #include "hidapi.h" 34 | 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | /** @brief Get the container ID for a HID device. 40 | 41 | Since version 0.12.0, @ref HID_API_VERSION >= HID_API_MAKE_VERSION(0, 12, 0) 42 | 43 | This function returns the `DEVPKEY_Device_ContainerId` property of 44 | the given device. This can be used to correlate different 45 | interfaces/ports on the same hardware device. 46 | 47 | @ingroup API 48 | @param dev A device handle returned from hid_open(). 49 | @param guid The device's container ID on return. 50 | 51 | @returns 52 | This function returns 0 on success and -1 on error. 53 | */ 54 | int HID_API_EXPORT_CALL hid_winapi_get_container_id(hid_device *dev, GUID *container_id); 55 | 56 | /** 57 | * @brief Reconstructs a HID Report Descriptor from a Win32 HIDP_PREPARSED_DATA structure. 58 | * This reconstructed report descriptor is logical identical to the real report descriptor, 59 | * but not byte wise identical. 60 | * 61 | * @param[in] hidp_preparsed_data Pointer to the HIDP_PREPARSED_DATA to read, i.e.: the value of PHIDP_PREPARSED_DATA, 62 | * as returned by HidD_GetPreparsedData WinAPI function. 63 | * @param buf Pointer to the buffer where the report descriptor should be stored. 64 | * @param[in] buf_size Size of the buffer. The recommended size for the buffer is @ref HID_API_MAX_REPORT_DESCRIPTOR_SIZE bytes. 65 | * 66 | * @return Returns size of reconstructed report descriptor if successful, -1 for error. 67 | */ 68 | int HID_API_EXPORT_CALL hid_winapi_descriptor_reconstruct_pp_data(void *hidp_preparsed_data, unsigned char *buf, size_t buf_size); 69 | 70 | #ifdef __cplusplus 71 | } 72 | #endif 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /windows/hidtest.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 14 | 15 | 16 | 17 | 18 | 25 | 28 | 31 | 34 | 37 | 40 | 50 | 53 | 56 | 59 | 67 | 70 | 73 | 76 | 79 | 82 | 85 | 90 | 91 | 99 | 102 | 105 | 108 | 111 | 114 | 124 | 127 | 130 | 133 | 143 | 146 | 149 | 152 | 155 | 158 | 161 | 166 | 167 | 168 | 169 | 170 | 171 | 176 | 179 | 180 | 181 | 186 | 187 | 192 | 193 | 194 | 195 | 196 | 197 | -------------------------------------------------------------------------------- /windows/hidtest.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /windows/pp_data_dump/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(pp_data_dump C) 2 | 3 | add_executable(pp_data_dump pp_data_dump.c) 4 | set_target_properties(pp_data_dump 5 | PROPERTIES 6 | C_STANDARD 11 7 | C_STANDARD_REQUIRED TRUE 8 | ) 9 | target_link_libraries(pp_data_dump 10 | PRIVATE hidapi_winapi 11 | ) 12 | 13 | install(TARGETS pp_data_dump 14 | RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" 15 | ) 16 | -------------------------------------------------------------------------------- /windows/pp_data_dump/README.md: -------------------------------------------------------------------------------- 1 | ## pp_data_dump.exe for Windows 2 | 3 | 4 | pp_data_dump.exe is a small command line tool for Windows, which dumps the content of the [Preparsed Data](https://learn.microsoft.com/en-us/windows-hardware/drivers/hid/preparsed-data) structure, provided by the Windows HID subsystem, into a file. 5 | 6 | The generated file is in a text format, which is readable for human, as by the hid_report_reconstructor_test.exe unit test executable of the HIDAPI project. This unit test allows it to test the HIDAPIs report descriptor reconstructor - offline, without the hardware device connected. 7 | 8 | pp_data_dump.exe has no arguments, just connect you HID device and execute pp_data_dump.exe. It will generate one file with the name 9 | ``` 10 | ___.pp_data 11 | ``` 12 | for each top-level collection, of each connected HID device. 13 | 14 | 15 | ## File content 16 | 17 | The content of such a .pp_data file looks like the struct, which HIDAPI uses internally to represent the Preparsed Data. 18 | 19 | *NOTE: 20 | Windows parses HID report descriptors into opaque `_HIDP_PREPARSED_DATA` objects. 21 | The internal structure of `_HIDP_PREPARSED_DATA` is reserved for internal system use.\ 22 | Microsoft doesn't document this structure. [hid_preparsed_data.cc](https://chromium.googlesource.com/chromium/src/+/73fdaaf605bb60caf34d5f30bb84a417688aa528/services/device/hid/hid_preparsed_data.cc) is taken as a reference for its parsing.* 23 | 24 | ``` 25 | # HIDAPI device info struct: 26 | dev->vendor_id = 0x046D 27 | dev->product_id = 0xB010 28 | dev->manufacturer_string = "Logitech" 29 | dev->product_string = "Logitech Bluetooth Wireless Mouse" 30 | dev->release_number = 0x0000 31 | dev->interface_number = -1 32 | dev->usage = 0x0001 33 | dev->usage_page = 0x000C 34 | dev->path = "\\?\hid#{00001124-0000-1000-8000-00805f9b34fb}_vid&0002046d_pid&b010&col02#8&1cf1c1b9&3&0001#{4d1e55b2-f16f-11cf-88cb-001111000030}" 35 | 36 | # Preparsed Data struct: 37 | pp_data->MagicKey = 0x48696450204B4452 38 | pp_data->Usage = 0x0001 39 | pp_data->UsagePage = 0x000C 40 | pp_data->Reserved = 0x00000000 41 | # Input caps_info struct: 42 | pp_data->caps_info[0]->FirstCap = 0 43 | pp_data->caps_info[0]->LastCap = 1 44 | pp_data->caps_info[0]->NumberOfCaps = 1 45 | pp_data->caps_info[0]->ReportByteLength = 2 46 | # Output caps_info struct: 47 | pp_data->caps_info[1]->FirstCap = 1 48 | pp_data->caps_info[1]->LastCap = 1 49 | pp_data->caps_info[1]->NumberOfCaps = 0 50 | pp_data->caps_info[1]->ReportByteLength = 0 51 | # Feature caps_info struct: 52 | pp_data->caps_info[2]->FirstCap = 1 53 | pp_data->caps_info[2]->LastCap = 1 54 | pp_data->caps_info[2]->NumberOfCaps = 0 55 | pp_data->caps_info[2]->ReportByteLength = 0 56 | # LinkCollectionArray Offset & Size: 57 | pp_data->FirstByteOfLinkCollectionArray = 0x0068 58 | pp_data->NumberLinkCollectionNodes = 1 59 | # Input hid_pp_cap struct: 60 | pp_data->cap[0]->UsagePage = 0x0006 61 | pp_data->cap[0]->ReportID = 0x03 62 | pp_data->cap[0]->BitPosition = 0 63 | pp_data->cap[0]->BitSize = 8 64 | pp_data->cap[0]->ReportCount = 1 65 | pp_data->cap[0]->BytePosition = 0x0001 66 | pp_data->cap[0]->BitCount = 8 67 | pp_data->cap[0]->BitField = 0x02 68 | pp_data->cap[0]->NextBytePosition = 0x0002 69 | pp_data->cap[0]->LinkCollection = 0x0000 70 | pp_data->cap[0]->LinkUsagePage = 0x000C 71 | pp_data->cap[0]->LinkUsage = 0x0001 72 | pp_data->cap[0]->IsMultipleItemsForArray = 0 73 | pp_data->cap[0]->IsButtonCap = 0 74 | pp_data->cap[0]->IsPadding = 0 75 | pp_data->cap[0]->IsAbsolute = 1 76 | pp_data->cap[0]->IsRange = 0 77 | pp_data->cap[0]->IsAlias = 0 78 | pp_data->cap[0]->IsStringRange = 0 79 | pp_data->cap[0]->IsDesignatorRange = 0 80 | pp_data->cap[0]->Reserved1 = 0x000000 81 | pp_data->cap[0]->pp_cap->UnknownTokens[0].Token = 0x00 82 | pp_data->cap[0]->pp_cap->UnknownTokens[0].Reserved = 0x000000 83 | pp_data->cap[0]->pp_cap->UnknownTokens[0].BitField = 0x00000000 84 | pp_data->cap[0]->pp_cap->UnknownTokens[1].Token = 0x00 85 | pp_data->cap[0]->pp_cap->UnknownTokens[1].Reserved = 0x000000 86 | pp_data->cap[0]->pp_cap->UnknownTokens[1].BitField = 0x00000000 87 | pp_data->cap[0]->pp_cap->UnknownTokens[2].Token = 0x00 88 | pp_data->cap[0]->pp_cap->UnknownTokens[2].Reserved = 0x000000 89 | pp_data->cap[0]->pp_cap->UnknownTokens[2].BitField = 0x00000000 90 | pp_data->cap[0]->pp_cap->UnknownTokens[3].Token = 0x00 91 | pp_data->cap[0]->pp_cap->UnknownTokens[3].Reserved = 0x000000 92 | pp_data->cap[0]->pp_cap->UnknownTokens[3].BitField = 0x00000000 93 | pp_data->cap[0]->NotRange.Usage = 0x0020 94 | pp_data->cap[0]->NotRange.Reserved1 = 0x0020 95 | pp_data->cap[0]->NotRange.StringIndex = 0 96 | pp_data->cap[0]->NotRange.Reserved2 = 0 97 | pp_data->cap[0]->NotRange.DesignatorIndex = 0 98 | pp_data->cap[0]->NotRange.Reserved3 = 0 99 | pp_data->cap[0]->NotRange.DataIndex = 0 100 | pp_data->cap[0]->NotRange.Reserved4 = 0 101 | pp_data->cap[0]->NotButton.HasNull = 0 102 | pp_data->cap[0]->NotButton.Reserved4 = 0x000000 103 | pp_data->cap[0]->NotButton.LogicalMin = 0 104 | pp_data->cap[0]->NotButton.LogicalMax = 100 105 | pp_data->cap[0]->NotButton.PhysicalMin = 0 106 | pp_data->cap[0]->NotButton.PhysicalMax = 0 107 | pp_data->cap[0]->Units = 0 108 | pp_data->cap[0]->UnitsExp = 0 109 | 110 | # Output hid_pp_cap struct: 111 | # Feature hid_pp_cap struct: 112 | # Link Collections: 113 | pp_data->LinkCollectionArray[0]->LinkUsage = 0x0001 114 | pp_data->LinkCollectionArray[0]->LinkUsagePage = 0x000C 115 | pp_data->LinkCollectionArray[0]->Parent = 0 116 | pp_data->LinkCollectionArray[0]->NumberOfChildren = 0 117 | pp_data->LinkCollectionArray[0]->NextSibling = 0 118 | pp_data->LinkCollectionArray[0]->FirstChild = 0 119 | pp_data->LinkCollectionArray[0]->CollectionType = 1 120 | pp_data->LinkCollectionArray[0]->IsAlias = 0 121 | pp_data->LinkCollectionArray[0]->Reserved = 0x00000000 122 | ``` -------------------------------------------------------------------------------- /windows/test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(hid_report_reconstructor_test hid_report_reconstructor_test.c) 2 | set_target_properties(hid_report_reconstructor_test 3 | PROPERTIES 4 | C_STANDARD 11 5 | C_STANDARD_REQUIRED TRUE 6 | ) 7 | 8 | target_link_libraries(hid_report_reconstructor_test 9 | PRIVATE hidapi_include hidapi_winapi 10 | ) 11 | 12 | # Each test case requires 2 files: 13 | # .pp_data - textual representation of HIDP_PREPARSED_DATA; 14 | # _expected.rpt_desc - reconstructed HID Report Descriptor out of .pp_data file; 15 | # 16 | # (Non-required by test): 17 | # _real.dpt_desc - the original report rescriptor used to create a test case; 18 | set(HID_DESCRIPTOR_RECONSTRUCT_TEST_CASES 19 | 046D_C52F_0001_000C 20 | 046D_C52F_0001_FF00 21 | 046D_C52F_0002_0001 22 | 046D_C52F_0002_FF00 23 | 17CC_1130_0000_FF01 24 | 046D_0A37_0001_000C 25 | 046A_0011_0006_0001 26 | 046D_C077_0002_0001 27 | 046D_C283_0004_0001 28 | 046D_B010_0006_0001 29 | 046D_B010_0002_FF00 30 | 046D_B010_0002_0001 31 | 046D_B010_0001_FF00 32 | 046D_B010_0001_000C 33 | 046D_C534_0001_000C 34 | 046D_C534_0001_FF00 35 | 046D_C534_0002_0001 36 | 046D_C534_0002_FF00 37 | 046D_C534_0006_0001 38 | 046D_C534_0080_0001 39 | 047F_C056_0001_000C 40 | 047F_C056_0003_FFA0 41 | 047F_C056_0005_000B 42 | 045E_02FF_0005_0001 43 | ) 44 | 45 | set(CMAKE_VERSION_SUPPORTS_ENVIRONMENT_MODIFICATION "3.22") 46 | 47 | if(HIDAPI_ENABLE_ASAN AND MSVC) 48 | if(CMAKE_VERSION VERSION_LESS CMAKE_VERSION_SUPPORTS_ENVIRONMENT_MODIFICATION) 49 | message("CTest/ASAN: Make sure to run ctest from MSVC Command Prompt") 50 | endif() 51 | endif() 52 | 53 | foreach(TEST_CASE ${HID_DESCRIPTOR_RECONSTRUCT_TEST_CASES}) 54 | set(TEST_PP_DATA "${CMAKE_CURRENT_LIST_DIR}/data/${TEST_CASE}.pp_data") 55 | if(NOT EXISTS "${TEST_PP_DATA}") 56 | message(FATAL_ERROR "Missing '${TEST_PP_DATA}' file for '${TEST_CASE}' test case") 57 | endif() 58 | set(TEST_EXPECTED_DESCRIPTOR "${CMAKE_CURRENT_LIST_DIR}/data/${TEST_CASE}_expected.rpt_desc") 59 | if(NOT EXISTS "${TEST_EXPECTED_DESCRIPTOR}") 60 | message(FATAL_ERROR "Missing '${TEST_EXPECTED_DESCRIPTOR}' file for '${TEST_CASE}' test case") 61 | endif() 62 | 63 | add_test(NAME "WinHidReportReconstructTest_${TEST_CASE}" 64 | COMMAND hid_report_reconstructor_test "${TEST_PP_DATA}" "${TEST_EXPECTED_DESCRIPTOR}" 65 | WORKING_DIRECTORY "$" 66 | ) 67 | if(HIDAPI_ENABLE_ASAN) 68 | if(MSVC) 69 | if(NOT CMAKE_VERSION VERSION_LESS CMAKE_VERSION_SUPPORTS_ENVIRONMENT_MODIFICATION) 70 | get_filename_component(MSVC_BUILD_TOOLS_DIR "${CMAKE_LINKER}" DIRECTORY) 71 | set_property(TEST "WinHidReportReconstructTest_${TEST_CASE}" PROPERTY ENVIRONMENT_MODIFICATION "PATH=path_list_append:${MSVC_BUILD_TOOLS_DIR}") 72 | endif() 73 | endif() 74 | set_property(TEST "WinHidReportReconstructTest_${TEST_CASE}" PROPERTY ENVIRONMENT "ASAN_SAVE_DUMPS=AsanDump_${TEST_CASE}.dmp") 75 | endif() 76 | endforeach() 77 | -------------------------------------------------------------------------------- /windows/test/data/045E_02FF_0005_0001_expected.rpt_desc: -------------------------------------------------------------------------------- 1 | 0x05, 0x01, 0x09, 0x05, 0xA1, 0x01, 0x09, 0x00, 0xA1, 0x00, 2 | 0x09, 0x30, 0x09, 0x31, 0x15, 0x00, 0x25, 0xFF, 0x35, 0x00, 3 | 0x45, 0xFF, 0x75, 0x10, 0x95, 0x02, 0x81, 0x02, 0xC0, 0x09, 4 | 0x00, 0xA1, 0x00, 0x09, 0x33, 0x09, 0x34, 0x15, 0x00, 0x25, 5 | 0xFF, 0x75, 0x10, 0x95, 0x02, 0x81, 0x02, 0xC0, 0x09, 0x00, 6 | 0xA1, 0x00, 0x09, 0x32, 0x15, 0x00, 0x25, 0xFF, 0x75, 0x10, 7 | 0x95, 0x01, 0x81, 0x02, 0xC0, 0x05, 0x09, 0x19, 0x01, 0x29, 8 | 0x10, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x10, 0x45, 9 | 0x00, 0x81, 0x02, 0x05, 0x01, 0x09, 0x39, 0x15, 0x01, 0x25, 10 | 0x08, 0x35, 0x00, 0x46, 0x3B, 0x10, 0x65, 0x0E, 0x75, 0x04, 11 | 0x95, 0x01, 0x81, 0x42, 0x75, 0x04, 0x95, 0x01, 0x81, 0x03, 12 | 0xC0, -------------------------------------------------------------------------------- /windows/test/data/045E_02FF_0005_0001_real.rpt_desc: -------------------------------------------------------------------------------- 1 | // Special cases of this device: 2 | // 2 full padding bytes at the end 3 | // Multiple child collections inside of the same report (byte position of Input items defines collection order) 4 | 5 | 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) 6 | 0x09, 0x05, // Usage (Game Pad) 7 | 0xA1, 0x01, // Collection (Application) 8 | 0xA1, 0x00, // Collection (Physical) 9 | 0x09, 0x30, // Usage (X) 10 | 0x09, 0x31, // Usage (Y) 11 | 0x15, 0x00, // Logical Minimum (0) 12 | 0x26, 0xFF, 0xFF, // Logical Maximum (-1) 13 | 0x35, 0x00, // Physical Minimum (0) 14 | 0x46, 0xFF, 0xFF, // Physical Maximum (-1) 15 | 0x95, 0x02, // Report Count (2) 16 | 0x75, 0x10, // Report Size (16) 17 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 18 | 0xC0, // End Collection 19 | 0xA1, 0x00, // Collection (Physical) 20 | 0x09, 0x33, // Usage (Rx) 21 | 0x09, 0x34, // Usage (Ry) 22 | 0x15, 0x00, // Logical Minimum (0) 23 | 0x26, 0xFF, 0xFF, // Logical Maximum (-1) 24 | 0x35, 0x00, // Physical Minimum (0) 25 | 0x46, 0xFF, 0xFF, // Physical Maximum (-1) 26 | 0x95, 0x02, // Report Count (2) 27 | 0x75, 0x10, // Report Size (16) 28 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 29 | 0xC0, // End Collection 30 | 0xA1, 0x00, // Collection (Physical) 31 | 0x09, 0x32, // Usage (Z) 32 | 0x15, 0x00, // Logical Minimum (0) 33 | 0x26, 0xFF, 0xFF, // Logical Maximum (-1) 34 | 0x35, 0x00, // Physical Minimum (0) 35 | 0x46, 0xFF, 0xFF, // Physical Maximum (-1) 36 | 0x95, 0x01, // Report Count (1) 37 | 0x75, 0x10, // Report Size (16) 38 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 39 | 0xC0, // End Collection 40 | 0x05, 0x09, // Usage Page (Button) 41 | 0x19, 0x01, // Usage Minimum (0x01) 42 | 0x29, 0x10, // Usage Maximum (0x10) 43 | 0x95, 0x10, // Report Count (16) 44 | 0x75, 0x01, // Report Size (1) 45 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 46 | 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) 47 | 0x09, 0x39, // Usage (Hat switch) 48 | 0x15, 0x01, // Logical Minimum (1) 49 | 0x25, 0x08, // Logical Maximum (8) 50 | 0x35, 0x00, // Physical Minimum (0) 51 | 0x46, 0x3B, 0x10, // Physical Maximum (4155) 52 | 0x66, 0x0E, 0x00, // Unit (None) 53 | 0x75, 0x04, // Report Size (4) 54 | 0x95, 0x01, // Report Count (1) 55 | 0x81, 0x42, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,Null State) 56 | 0x75, 0x04, // Report Size (4) 57 | 0x95, 0x01, // Report Count (1) 58 | 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 59 | 0x75, 0x08, // Report Size (8) 60 | 0x95, 0x02, // Report Count (2) 61 | 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 62 | 0xC0, // End Collection 63 | 64 | // 120 bytes -------------------------------------------------------------------------------- /windows/test/data/046A_0011_0006_0001_expected.rpt_desc: -------------------------------------------------------------------------------- 1 | 0x05, 0x01, 0x09, 0x06, 0xA1, 0x01, 0x05, 0x07, 0x19, 0xE0, 2 | 0x29, 0xE7, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 3 | 0x81, 0x02, 0x75, 0x08, 0x95, 0x01, 0x81, 0x03, 0x19, 0x00, 4 | 0x29, 0xDD, 0x15, 0x00, 0x26, 0xDD, 0x00, 0x75, 0x08, 0x95, 5 | 0x06, 0x81, 0x00, 0x05, 0x08, 0x19, 0x01, 0x29, 0x03, 0x15, 6 | 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x03, 0x91, 0x02, 0x75, 7 | 0x05, 0x95, 0x01, 0x91, 0x03, 0xC0, -------------------------------------------------------------------------------- /windows/test/data/046A_0011_0006_0001_real.rpt_desc: -------------------------------------------------------------------------------- 1 | 0x05, 0x01, 0x09, 0x06, 0xA1, 0x01, 0x05, 0x07, 0x19, 0xE0, 2 | 0x29, 0xE7, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 3 | 0x81, 0x02, 0x75, 0x08, 0x95, 0x01, 0x81, 0x03, 0x19, 0x00, 4 | 0x29, 0xDD, 0x15, 0x00, 0x26, 0xDD, 0x00, 0x75, 0x08, 0x95, 5 | 0x06, 0x81, 0x00, 0x05, 0x08, 0x19, 0x01, 0x29, 0x03, 0x15, 6 | 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x03, 0x91, 0x02, 0x75, 7 | 0x05, 0x95, 0x01, 0x91, 0x03, 0xC0, -------------------------------------------------------------------------------- /windows/test/data/046D_0A37_0001_000C_expected.rpt_desc: -------------------------------------------------------------------------------- 1 | 0x05, 0x0C, 0x09, 0x01, 0xA1, 0x01, 0x85, 0x01, 0x09, 0xE9, 2 | 0x09, 0xEA, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x02, 3 | 0x81, 0x02, 0x09, 0xE2, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 4 | 0x95, 0x01, 0x81, 0x06, 0x75, 0x02, 0x95, 0x01, 0x81, 0x03, 5 | 0x09, 0x36, 0xA1, 0x02, 0x05, 0x09, 0x19, 0x01, 0x29, 0x02, 6 | 0x15, 0x01, 0x25, 0x02, 0x75, 0x02, 0x95, 0x01, 0x81, 0x40, 7 | 0x75, 0x01, 0x95, 0x01, 0x81, 0x03, 0xC0, 0x85, 0x02, 0x05, 8 | 0x0C, 0x09, 0x00, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 9 | 0x10, 0x81, 0x02, 0x85, 0x05, 0x09, 0x00, 0x15, 0x00, 0x25, 10 | 0x01, 0x75, 0x08, 0x95, 0x20, 0x81, 0x02, 0x85, 0x07, 0x09, 11 | 0x00, 0x15, 0x00, 0x25, 0x01, 0x75, 0x08, 0x95, 0x20, 0x81, 12 | 0x02, 0x85, 0x03, 0x09, 0x00, 0x15, 0x00, 0x25, 0x01, 0x75, 13 | 0x01, 0x95, 0x10, 0x91, 0x02, 0x85, 0x04, 0x09, 0x00, 0x15, 14 | 0x00, 0x25, 0x01, 0x75, 0x08, 0x95, 0x24, 0x91, 0x02, 0x85, 15 | 0x06, 0x09, 0x00, 0x15, 0x00, 0x25, 0x01, 0x75, 0x08, 0x95, 16 | 0x24, 0x91, 0x02, 0xC0, -------------------------------------------------------------------------------- /windows/test/data/046D_0A37_0001_000C_real.rpt_desc: -------------------------------------------------------------------------------- 1 | Usage Page (Consumer Devices) 05 0C 2 | Usage (Consumer Control) 09 01 3 | Collection (Application) A1 01 4 | Report ID (1) 85 01 5 | Logical Minimum (0) 15 00 6 | Logical Maximum (1) 25 01 7 | Usage (Volume Increment) 09 E9 8 | Usage (Volume Decrement) 09 EA 9 | Report Size (1) 75 01 10 | Report Count (2) 95 02 11 | Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 02 12 | Usage (Mute) 09 E2 13 | Report Count (1) 95 01 14 | Input (Data,Var,Rel,NWrp,Lin,Pref,NNul,Bit) 81 06 15 | Usage (Undefined) 09 00 16 | Report Count (2) 95 02 17 | Input (Cnst,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 03 18 | Usage (Function Buttons) 09 36 19 | Collection (Logical) A1 02 20 | Usage Page (Button) 05 09 21 | Usage Minimum (Button 1) 19 01 22 | Usage Maximum (Button 2) 29 02 23 | Report Size (2) 75 02 24 | Report Count (1) 95 01 25 | Logical Minimum (1) 15 01 26 | Logical Maximum (2) 25 02 27 | Input (Data,Ary,Abs) 81 40 28 | End Collection C0 29 | Usage Page (Consumer Devices) 05 0C 30 | Usage (Undefined) 09 00 31 | Logical Minimum (0) 15 00 32 | Logical Maximum (1) 25 01 33 | Report Size (1) 75 01 34 | Report Count (1) 95 01 35 | Input (Cnst,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 03 36 | Report ID (2) 85 02 37 | Usage Page (Consumer Devices) 05 0C 38 | Usage (Undefined) 09 00 39 | Report Count (16) 95 10 40 | Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 02 41 | Report ID (3) 85 03 42 | Usage (Undefined) 09 00 43 | Output (Data,Var,Abs,NWrp,Lin,Pref,NNul,NVol,Bit) 91 02 44 | Report ID (4) 85 04 45 | Usage (Undefined) 09 00 46 | Report Size (8) 75 08 47 | Report Count (36) 95 24 48 | Output (Data,Var,Abs,NWrp,Lin,Pref,NNul,NVol,Bit) 91 02 49 | Report ID (5) 85 05 50 | Usage (Undefined) 09 00 51 | Report Count (32) 95 20 52 | Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 02 53 | Report ID (6) 85 06 54 | Usage (Undefined) 09 00 55 | Report Count (36) 95 24 56 | Output (Data,Var,Abs,NWrp,Lin,Pref,NNul,NVol,Bit) 91 02 57 | Report ID (7) 85 07 58 | Usage (Undefined) 09 00 59 | Report Count (32) 95 20 60 | Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 02 61 | End Collection C0 62 | -------------------------------------------------------------------------------- /windows/test/data/046D_B010_0001_000C.pp_data: -------------------------------------------------------------------------------- 1 | # HIDAPI device info struct: 2 | dev->vendor_id = 0x046D 3 | dev->product_id = 0xB010 4 | dev->manufacturer_string = "Logitech" 5 | dev->product_string = "Logitech Bluetooth Wireless Mouse" 6 | dev->release_number = 0x0000 7 | dev->interface_number = -1 8 | dev->usage = 0x0001 9 | dev->usage_page = 0x000C 10 | dev->path = "\\?\hid#{00001124-0000-1000-8000-00805f9b34fb}_vid&0002046d_pid&b010&col02#8&1cf1c1b9&3&0001#{4d1e55b2-f16f-11cf-88cb-001111000030}" 11 | 12 | # Preparsed Data struct: 13 | pp_data->MagicKey = 0x48696450204B4452 14 | pp_data->Usage = 0x0001 15 | pp_data->UsagePage = 0x000C 16 | pp_data->Reserved = 0x00000000 17 | # Input caps_info struct: 18 | pp_data->caps_info[0]->FirstCap = 0 19 | pp_data->caps_info[0]->LastCap = 1 20 | pp_data->caps_info[0]->NumberOfCaps = 1 21 | pp_data->caps_info[0]->ReportByteLength = 2 22 | # Output caps_info struct: 23 | pp_data->caps_info[1]->FirstCap = 1 24 | pp_data->caps_info[1]->LastCap = 1 25 | pp_data->caps_info[1]->NumberOfCaps = 0 26 | pp_data->caps_info[1]->ReportByteLength = 0 27 | # Feature caps_info struct: 28 | pp_data->caps_info[2]->FirstCap = 1 29 | pp_data->caps_info[2]->LastCap = 1 30 | pp_data->caps_info[2]->NumberOfCaps = 0 31 | pp_data->caps_info[2]->ReportByteLength = 0 32 | # LinkCollectionArray Offset & Size: 33 | pp_data->FirstByteOfLinkCollectionArray = 0x0068 34 | pp_data->NumberLinkCollectionNodes = 1 35 | # Input hid_pp_cap struct: 36 | pp_data->cap[0]->UsagePage = 0x0006 37 | pp_data->cap[0]->ReportID = 0x03 38 | pp_data->cap[0]->BitPosition = 0 39 | pp_data->cap[0]->BitSize = 8 40 | pp_data->cap[0]->ReportCount = 1 41 | pp_data->cap[0]->BytePosition = 0x0001 42 | pp_data->cap[0]->BitCount = 8 43 | pp_data->cap[0]->BitField = 0x02 44 | pp_data->cap[0]->NextBytePosition = 0x0002 45 | pp_data->cap[0]->LinkCollection = 0x0000 46 | pp_data->cap[0]->LinkUsagePage = 0x000C 47 | pp_data->cap[0]->LinkUsage = 0x0001 48 | pp_data->cap[0]->IsMultipleItemsForArray = 0 49 | pp_data->cap[0]->IsButtonCap = 0 50 | pp_data->cap[0]->IsPadding = 0 51 | pp_data->cap[0]->IsAbsolute = 1 52 | pp_data->cap[0]->IsRange = 0 53 | pp_data->cap[0]->IsAlias = 0 54 | pp_data->cap[0]->IsStringRange = 0 55 | pp_data->cap[0]->IsDesignatorRange = 0 56 | pp_data->cap[0]->Reserved1 = 0x000000 57 | pp_data->cap[0]->pp_cap->UnknownTokens[0].Token = 0x00 58 | pp_data->cap[0]->pp_cap->UnknownTokens[0].Reserved = 0x000000 59 | pp_data->cap[0]->pp_cap->UnknownTokens[0].BitField = 0x00000000 60 | pp_data->cap[0]->pp_cap->UnknownTokens[1].Token = 0x00 61 | pp_data->cap[0]->pp_cap->UnknownTokens[1].Reserved = 0x000000 62 | pp_data->cap[0]->pp_cap->UnknownTokens[1].BitField = 0x00000000 63 | pp_data->cap[0]->pp_cap->UnknownTokens[2].Token = 0x00 64 | pp_data->cap[0]->pp_cap->UnknownTokens[2].Reserved = 0x000000 65 | pp_data->cap[0]->pp_cap->UnknownTokens[2].BitField = 0x00000000 66 | pp_data->cap[0]->pp_cap->UnknownTokens[3].Token = 0x00 67 | pp_data->cap[0]->pp_cap->UnknownTokens[3].Reserved = 0x000000 68 | pp_data->cap[0]->pp_cap->UnknownTokens[3].BitField = 0x00000000 69 | pp_data->cap[0]->NotRange.Usage = 0x0020 70 | pp_data->cap[0]->NotRange.Reserved1 = 0x0020 71 | pp_data->cap[0]->NotRange.StringIndex = 0 72 | pp_data->cap[0]->NotRange.Reserved2 = 0 73 | pp_data->cap[0]->NotRange.DesignatorIndex = 0 74 | pp_data->cap[0]->NotRange.Reserved3 = 0 75 | pp_data->cap[0]->NotRange.DataIndex = 0 76 | pp_data->cap[0]->NotRange.Reserved4 = 0 77 | pp_data->cap[0]->NotButton.HasNull = 0 78 | pp_data->cap[0]->NotButton.Reserved4 = 0x000000 79 | pp_data->cap[0]->NotButton.LogicalMin = 0 80 | pp_data->cap[0]->NotButton.LogicalMax = 100 81 | pp_data->cap[0]->NotButton.PhysicalMin = 0 82 | pp_data->cap[0]->NotButton.PhysicalMax = 0 83 | pp_data->cap[0]->Units = 0 84 | pp_data->cap[0]->UnitsExp = 0 85 | 86 | # Output hid_pp_cap struct: 87 | # Feature hid_pp_cap struct: 88 | # Link Collections: 89 | pp_data->LinkCollectionArray[0]->LinkUsage = 0x0001 90 | pp_data->LinkCollectionArray[0]->LinkUsagePage = 0x000C 91 | pp_data->LinkCollectionArray[0]->Parent = 0 92 | pp_data->LinkCollectionArray[0]->NumberOfChildren = 0 93 | pp_data->LinkCollectionArray[0]->NextSibling = 0 94 | pp_data->LinkCollectionArray[0]->FirstChild = 0 95 | pp_data->LinkCollectionArray[0]->CollectionType = 1 96 | pp_data->LinkCollectionArray[0]->IsAlias = 0 97 | pp_data->LinkCollectionArray[0]->Reserved = 0x00000000 98 | -------------------------------------------------------------------------------- /windows/test/data/046D_B010_0001_000C_expected.rpt_desc: -------------------------------------------------------------------------------- 1 | 0x05, 0x0C, 0x09, 0x01, 0xA1, 0x01, 0x85, 0x03, 0x05, 0x06, 2 | 0x09, 0x20, 0x15, 0x00, 0x25, 0x64, 0x75, 0x08, 0x95, 0x01, 3 | 0x81, 0x02, 0xC0, -------------------------------------------------------------------------------- /windows/test/data/046D_B010_0001_000C_real.rpt_desc: -------------------------------------------------------------------------------- 1 | 2 | mac-hid-dump on  main ❯ ./mac-hid-dump 3 | mac-hid-dump: 4 | ... 5 | 046D B010: Unknown - Bluetooth Mouse M557 6 | DESCRIPTOR: 7 | 05 01 09 02 a1 01 85 02 09 01 a1 00 05 09 19 01 8 | 29 08 15 00 25 01 75 01 95 08 81 02 05 01 09 30 9 | 09 31 16 01 f8 26 ff 07 75 0c 95 02 81 06 09 38 10 | 15 81 25 7f 75 08 95 01 81 06 05 0c 0a 38 02 75 11 | 08 95 01 81 06 c0 c0 05 0c 09 01 a1 01 85 03 05 12 | 06 09 20 15 00 26 64 00 75 08 95 01 81 02 c0 06 13 | 00 ff 09 01 a1 01 85 10 75 08 95 06 15 00 26 ff 14 | 00 09 01 81 00 09 01 91 00 c0 06 00 ff 09 02 a1 15 | 01 85 11 75 08 95 13 15 00 26 ff 00 09 02 81 00 16 | 09 02 91 00 c0 05 01 09 06 a1 01 85 04 75 01 95 17 | 08 05 07 19 e0 29 e7 15 00 25 01 81 02 95 01 75 18 | 08 81 03 95 05 75 01 05 08 19 01 29 05 91 02 95 19 | 01 75 03 91 03 95 06 75 08 15 00 26 ff 00 05 07 20 | 19 00 29 ff 81 00 c0 05 0c 09 01 a1 01 85 05 15 21 | 00 25 01 75 01 95 02 0a 25 02 0a 24 02 81 02 95 22 | 01 75 06 81 03 c0 23 | (246 bytes) 24 | 25 | Parser output: 26 | 27 | 0x05, 0x0C, // Usage Page (Consumer) 28 | 0x09, 0x01, // Usage (Consumer Control) 29 | 0xA1, 0x01, // Collection (Application) 30 | 0x85, 0x03, // Report ID (3) 31 | 0x05, 0x06, // Usage Page (Generic Dev Ctrls) 32 | 0x09, 0x20, // Usage (Battery Strength) 33 | 0x15, 0x00, // Logical Minimum (0) 34 | 0x26, 0x64, 0x00, // Logical Maximum (100) 35 | 0x75, 0x08, // Report Size (8) 36 | 0x95, 0x01, // Report Count (1) 37 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 38 | 0xC0, // End Collection 39 | -------------------------------------------------------------------------------- /windows/test/data/046D_B010_0001_FF00_expected.rpt_desc: -------------------------------------------------------------------------------- 1 | 0x06, 0x00, 0xFF, 0x09, 0x01, 0xA1, 0x01, 0x85, 0x10, 0x09, 2 | 0x01, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 0x08, 0x95, 0x06, 3 | 0x81, 0x00, 0x09, 0x01, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 4 | 0x08, 0x95, 0x06, 0x91, 0x00, 0xC0, -------------------------------------------------------------------------------- /windows/test/data/046D_B010_0001_FF00_real.rpt_desc: -------------------------------------------------------------------------------- 1 | 2 | mac-hid-dump on  main ❯ ./mac-hid-dump 3 | mac-hid-dump: 4 | ... 5 | 046D B010: Unknown - Bluetooth Mouse M557 6 | DESCRIPTOR: 7 | 05 01 09 02 a1 01 85 02 09 01 a1 00 05 09 19 01 8 | 29 08 15 00 25 01 75 01 95 08 81 02 05 01 09 30 9 | 09 31 16 01 f8 26 ff 07 75 0c 95 02 81 06 09 38 10 | 15 81 25 7f 75 08 95 01 81 06 05 0c 0a 38 02 75 11 | 08 95 01 81 06 c0 c0 05 0c 09 01 a1 01 85 03 05 12 | 06 09 20 15 00 26 64 00 75 08 95 01 81 02 c0 06 13 | 00 ff 09 01 a1 01 85 10 75 08 95 06 15 00 26 ff 14 | 00 09 01 81 00 09 01 91 00 c0 06 00 ff 09 02 a1 15 | 01 85 11 75 08 95 13 15 00 26 ff 00 09 02 81 00 16 | 09 02 91 00 c0 05 01 09 06 a1 01 85 04 75 01 95 17 | 08 05 07 19 e0 29 e7 15 00 25 01 81 02 95 01 75 18 | 08 81 03 95 05 75 01 05 08 19 01 29 05 91 02 95 19 | 01 75 03 91 03 95 06 75 08 15 00 26 ff 00 05 07 20 | 19 00 29 ff 81 00 c0 05 0c 09 01 a1 01 85 05 15 21 | 00 25 01 75 01 95 02 0a 25 02 0a 24 02 81 02 95 22 | 01 75 06 81 03 c0 23 | (246 bytes) 24 | 25 | Parser output: 26 | 27 | 0x06, 0x00, 0xFF, // Usage Page (Vendor Defined 0xFF00) 28 | 0x09, 0x01, // Usage (0x01) 29 | 0xA1, 0x01, // Collection (Application) 30 | 0x85, 0x10, // Report ID (16) 31 | 0x75, 0x08, // Report Size (8) 32 | 0x95, 0x06, // Report Count (6) 33 | 0x15, 0x00, // Logical Minimum (0) 34 | 0x26, 0xFF, 0x00, // Logical Maximum (255) 35 | 0x09, 0x01, // Usage (0x01) 36 | 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) 37 | 0x09, 0x01, // Usage (0x01) 38 | 0x91, 0x00, // Output (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 39 | 0xC0, // End Collection -------------------------------------------------------------------------------- /windows/test/data/046D_B010_0002_0001_expected.rpt_desc: -------------------------------------------------------------------------------- 1 | 0x05, 0x01, 0x09, 0x02, 0xA1, 0x01, 0x09, 0x01, 0xA1, 0x00, 2 | 0x85, 0x02, 0x05, 0x09, 0x19, 0x01, 0x29, 0x08, 0x15, 0x00, 3 | 0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x81, 0x02, 0x05, 0x01, 4 | 0x09, 0x30, 0x09, 0x31, 0x16, 0x01, 0xF8, 0x26, 0xFF, 0x07, 5 | 0x75, 0x0C, 0x95, 0x02, 0x81, 0x06, 0x09, 0x38, 0x15, 0x81, 6 | 0x25, 0x7F, 0x75, 0x08, 0x95, 0x01, 0x81, 0x06, 0x05, 0x0C, 7 | 0x0A, 0x38, 0x02, 0x15, 0x81, 0x25, 0x7F, 0x75, 0x08, 0x95, 8 | 0x01, 0x81, 0x06, 0xC0, 0xC0, -------------------------------------------------------------------------------- /windows/test/data/046D_B010_0002_0001_real.rpt_desc: -------------------------------------------------------------------------------- 1 | 2 | mac-hid-dump on  main ❯ ./mac-hid-dump 3 | mac-hid-dump: 4 | ... 5 | 046D B010: Unknown - Bluetooth Mouse M557 6 | DESCRIPTOR: 7 | 05 01 09 02 a1 01 85 02 09 01 a1 00 05 09 19 01 8 | 29 08 15 00 25 01 75 01 95 08 81 02 05 01 09 30 9 | 09 31 16 01 f8 26 ff 07 75 0c 95 02 81 06 09 38 10 | 15 81 25 7f 75 08 95 01 81 06 05 0c 0a 38 02 75 11 | 08 95 01 81 06 c0 c0 05 0c 09 01 a1 01 85 03 05 12 | 06 09 20 15 00 26 64 00 75 08 95 01 81 02 c0 06 13 | 00 ff 09 01 a1 01 85 10 75 08 95 06 15 00 26 ff 14 | 00 09 01 81 00 09 01 91 00 c0 06 00 ff 09 02 a1 15 | 01 85 11 75 08 95 13 15 00 26 ff 00 09 02 81 00 16 | 09 02 91 00 c0 05 01 09 06 a1 01 85 04 75 01 95 17 | 08 05 07 19 e0 29 e7 15 00 25 01 81 02 95 01 75 18 | 08 81 03 95 05 75 01 05 08 19 01 29 05 91 02 95 19 | 01 75 03 91 03 95 06 75 08 15 00 26 ff 00 05 07 20 | 19 00 29 ff 81 00 c0 05 0c 09 01 a1 01 85 05 15 21 | 00 25 01 75 01 95 02 0a 25 02 0a 24 02 81 02 95 22 | 01 75 06 81 03 c0 23 | (246 bytes) 24 | 25 | Parser output: 26 | 27 | 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) 28 | 0x09, 0x02, // Usage (Mouse) 29 | 0xA1, 0x01, // Collection (Application) 30 | 0x85, 0x02, // Report ID (2) 31 | 0x09, 0x01, // Usage (Pointer) 32 | 0xA1, 0x00, // Collection (Physical) 33 | 0x05, 0x09, // Usage Page (Button) 34 | 0x19, 0x01, // Usage Minimum (0x01) 35 | 0x29, 0x08, // Usage Maximum (0x08) 36 | 0x15, 0x00, // Logical Minimum (0) 37 | 0x25, 0x01, // Logical Maximum (1) 38 | 0x75, 0x01, // Report Size (1) 39 | 0x95, 0x08, // Report Count (8) 40 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 41 | 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) 42 | 0x09, 0x30, // Usage (X) 43 | 0x09, 0x31, // Usage (Y) 44 | 0x16, 0x01, 0xF8, // Logical Minimum (-2047) 45 | 0x26, 0xFF, 0x07, // Logical Maximum (2047) 46 | 0x75, 0x0C, // Report Size (12) 47 | 0x95, 0x02, // Report Count (2) 48 | 0x81, 0x06, // Input (Data,Var,Rel,No Wrap,Linear,Preferred State,No Null Position) 49 | 0x09, 0x38, // Usage (Wheel) 50 | 0x15, 0x81, // Logical Minimum (-127) 51 | 0x25, 0x7F, // Logical Maximum (127) 52 | 0x75, 0x08, // Report Size (8) 53 | 0x95, 0x01, // Report Count (1) 54 | 0x81, 0x06, // Input (Data,Var,Rel,No Wrap,Linear,Preferred State,No Null Position) 55 | 0x05, 0x0C, // Usage Page (Consumer) 56 | 0x0A, 0x38, 0x02, // Usage (AC Pan) 57 | 0x75, 0x08, // Report Size (8) 58 | 0x95, 0x01, // Report Count (1) 59 | 0x81, 0x06, // Input (Data,Var,Rel,No Wrap,Linear,Preferred State,No Null Position) 60 | 0xC0, // End Collection 61 | 0xC0, // End Collection 62 | -------------------------------------------------------------------------------- /windows/test/data/046D_B010_0002_FF00_expected.rpt_desc: -------------------------------------------------------------------------------- 1 | 0x06, 0x00, 0xFF, 0x09, 0x02, 0xA1, 0x01, 0x85, 0x11, 0x09, 2 | 0x02, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 0x08, 0x95, 0x13, 3 | 0x81, 0x00, 0x09, 0x02, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 4 | 0x08, 0x95, 0x13, 0x91, 0x00, 0xC0, -------------------------------------------------------------------------------- /windows/test/data/046D_B010_0002_FF00_real.rpt_desc: -------------------------------------------------------------------------------- 1 | 2 | mac-hid-dump on  main ❯ ./mac-hid-dump 3 | mac-hid-dump: 4 | ... 5 | 046D B010: Unknown - Bluetooth Mouse M557 6 | DESCRIPTOR: 7 | 05 01 09 02 a1 01 85 02 09 01 a1 00 05 09 19 01 8 | 29 08 15 00 25 01 75 01 95 08 81 02 05 01 09 30 9 | 09 31 16 01 f8 26 ff 07 75 0c 95 02 81 06 09 38 10 | 15 81 25 7f 75 08 95 01 81 06 05 0c 0a 38 02 75 11 | 08 95 01 81 06 c0 c0 05 0c 09 01 a1 01 85 03 05 12 | 06 09 20 15 00 26 64 00 75 08 95 01 81 02 c0 06 13 | 00 ff 09 01 a1 01 85 10 75 08 95 06 15 00 26 ff 14 | 00 09 01 81 00 09 01 91 00 c0 06 00 ff 09 02 a1 15 | 01 85 11 75 08 95 13 15 00 26 ff 00 09 02 81 00 16 | 09 02 91 00 c0 05 01 09 06 a1 01 85 04 75 01 95 17 | 08 05 07 19 e0 29 e7 15 00 25 01 81 02 95 01 75 18 | 08 81 03 95 05 75 01 05 08 19 01 29 05 91 02 95 19 | 01 75 03 91 03 95 06 75 08 15 00 26 ff 00 05 07 20 | 19 00 29 ff 81 00 c0 05 0c 09 01 a1 01 85 05 15 21 | 00 25 01 75 01 95 02 0a 25 02 0a 24 02 81 02 95 22 | 01 75 06 81 03 c0 23 | (246 bytes) 24 | 25 | Parser output: 26 | 27 | 0x06, 0x00, 0xFF, // Usage Page (Vendor Defined 0xFF00) 28 | 0x09, 0x02, // Usage (0x02) 29 | 0xA1, 0x01, // Collection (Application) 30 | 0x85, 0x11, // Report ID (17) 31 | 0x75, 0x08, // Report Size (8) 32 | 0x95, 0x13, // Report Count (19) 33 | 0x15, 0x00, // Logical Minimum (0) 34 | 0x26, 0xFF, 0x00, // Logical Maximum (255) 35 | 0x09, 0x02, // Usage (0x02) 36 | 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) 37 | 0x09, 0x02, // Usage (0x02) 38 | 0x91, 0x00, // Output (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 39 | 0xC0, // End Collection -------------------------------------------------------------------------------- /windows/test/data/046D_B010_0006_0001_expected.rpt_desc: -------------------------------------------------------------------------------- 1 | 0x05, 0x01, 0x09, 0x06, 0xA1, 0x01, 0x85, 0x04, 0x05, 0x07, 2 | 0x19, 0xE0, 0x29, 0xE7, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 3 | 0x95, 0x08, 0x81, 0x02, 0x75, 0x08, 0x95, 0x01, 0x81, 0x03, 4 | 0x19, 0x00, 0x29, 0xFF, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 5 | 0x08, 0x95, 0x06, 0x81, 0x00, 0x05, 0x08, 0x19, 0x01, 0x29, 6 | 0x05, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x05, 0x91, 7 | 0x02, 0x75, 0x03, 0x95, 0x01, 0x91, 0x03, 0xC0, -------------------------------------------------------------------------------- /windows/test/data/046D_B010_0006_0001_real.rpt_desc: -------------------------------------------------------------------------------- 1 | 2 | mac-hid-dump on  main ❯ ./mac-hid-dump 3 | mac-hid-dump: 4 | ... 5 | 046D B010: Unknown - Bluetooth Mouse M557 6 | DESCRIPTOR: 7 | 05 01 09 02 a1 01 85 02 09 01 a1 00 05 09 19 01 8 | 29 08 15 00 25 01 75 01 95 08 81 02 05 01 09 30 9 | 09 31 16 01 f8 26 ff 07 75 0c 95 02 81 06 09 38 10 | 15 81 25 7f 75 08 95 01 81 06 05 0c 0a 38 02 75 11 | 08 95 01 81 06 c0 c0 05 0c 09 01 a1 01 85 03 05 12 | 06 09 20 15 00 26 64 00 75 08 95 01 81 02 c0 06 13 | 00 ff 09 01 a1 01 85 10 75 08 95 06 15 00 26 ff 14 | 00 09 01 81 00 09 01 91 00 c0 06 00 ff 09 02 a1 15 | 01 85 11 75 08 95 13 15 00 26 ff 00 09 02 81 00 16 | 09 02 91 00 c0 05 01 09 06 a1 01 85 04 75 01 95 17 | 08 05 07 19 e0 29 e7 15 00 25 01 81 02 95 01 75 18 | 08 81 03 95 05 75 01 05 08 19 01 29 05 91 02 95 19 | 01 75 03 91 03 95 06 75 08 15 00 26 ff 00 05 07 20 | 19 00 29 ff 81 00 c0 05 0c 09 01 a1 01 85 05 15 21 | 00 25 01 75 01 95 02 0a 25 02 0a 24 02 81 02 95 22 | 01 75 06 81 03 c0 23 | (246 bytes) 24 | 25 | Parser output: 26 | 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) 27 | 0x09, 0x06, // Usage (Keyboard) 28 | 0xA1, 0x01, // Collection (Application) 29 | 0x85, 0x04, // Report ID (4) 30 | 0x75, 0x01, // Report Size (1) 31 | 0x95, 0x08, // Report Count (8) 32 | 0x05, 0x07, // Usage Page (Kbrd/Keypad) 33 | 0x19, 0xE0, // Usage Minimum (0xE0) 34 | 0x29, 0xE7, // Usage Maximum (0xE7) 35 | 0x15, 0x00, // Logical Minimum (0) 36 | 0x25, 0x01, // Logical Maximum (1) 37 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 38 | 0x95, 0x01, // Report Count (1) 39 | 0x75, 0x08, // Report Size (8) 40 | 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 41 | 0x95, 0x05, // Report Count (5) 42 | 0x75, 0x01, // Report Size (1) 43 | 0x05, 0x08, // Usage Page (LEDs) 44 | 0x19, 0x01, // Usage Minimum (Num Lock) 45 | 0x29, 0x05, // Usage Maximum (Kana) 46 | 0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 47 | 0x95, 0x01, // Report Count (1) 48 | 0x75, 0x03, // Report Size (3) 49 | 0x91, 0x03, // Output (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 50 | 0x95, 0x06, // Report Count (6) 51 | 0x75, 0x08, // Report Size (8) 52 | 0x15, 0x00, // Logical Minimum (0) 53 | 0x26, 0xFF, 0x00, // Logical Maximum (255) 54 | 0x05, 0x07, // Usage Page (Kbrd/Keypad) 55 | 0x19, 0x00, // Usage Minimum (0x00) 56 | 0x29, 0xFF, // Usage Maximum (0xFF) 57 | 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) 58 | 0xC0, // End Collection -------------------------------------------------------------------------------- /windows/test/data/046D_C077_0002_0001_expected.rpt_desc: -------------------------------------------------------------------------------- 1 | 0x05, 0x01, 0x09, 0x02, 0xA1, 0x01, 0x09, 0x01, 0xA1, 0x00, 2 | 0x05, 0x09, 0x19, 0x01, 0x29, 0x03, 0x15, 0x00, 0x25, 0x01, 3 | 0x75, 0x01, 0x95, 0x08, 0x81, 0x02, 0x05, 0x01, 0x09, 0x30, 4 | 0x09, 0x31, 0x09, 0x38, 0x15, 0x81, 0x25, 0x7F, 0x75, 0x08, 5 | 0x95, 0x03, 0x81, 0x06, 0xC0, 0xC0, -------------------------------------------------------------------------------- /windows/test/data/046D_C077_0002_0001_real.rpt_desc: -------------------------------------------------------------------------------- 1 | Usage Page (Generic Desktop) 05 01 2 | Usage (Mouse) 09 02 3 | Collection (Application) A1 01 4 | Usage (Pointer) 09 01 5 | Collection (Physical) A1 00 6 | Usage Page (Button) 05 09 7 | Usage Minimum (Button 1) 19 01 8 | Usage Maximum (Button 3) 29 03 9 | Logical Minimum (0) 15 00 10 | Logical Maximum (1) 25 01 11 | Report Count (8) 95 08 12 | Report Size (1) 75 01 13 | Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 02 14 | Usage Page (Generic Desktop) 05 01 15 | Usage (X) 09 30 16 | Usage (Y) 09 31 17 | Usage (Wheel) 09 38 18 | Logical Minimum (-127) 15 81 19 | Logical Maximum (127) 25 7F 20 | Report Size (8) 75 08 21 | Report Count (3) 95 03 22 | Input (Data,Var,Rel,NWrp,Lin,Pref,NNul,Bit) 81 06 23 | End Collection C0 24 | End Collection C0 25 | -------------------------------------------------------------------------------- /windows/test/data/046D_C283_0004_0001_expected.rpt_desc: -------------------------------------------------------------------------------- 1 | 0x05, 0x01, 0x09, 0x04, 0xA1, 0x01, 0x09, 0x00, 0xA1, 0x02, 2 | 0x09, 0x01, 0xA1, 0x00, 0x09, 0x30, 0x09, 0x31, 0x15, 0x00, 3 | 0x26, 0xFF, 0x00, 0x35, 0x00, 0x46, 0xFF, 0x00, 0x75, 0x08, 4 | 0x95, 0x02, 0x81, 0x02, 0x06, 0x00, 0xFF, 0x09, 0x01, 0x15, 5 | 0x00, 0x25, 0x0F, 0x75, 0x04, 0x95, 0x01, 0x81, 0x02, 0x05, 6 | 0x01, 0x09, 0x39, 0x15, 0x00, 0x25, 0x07, 0x35, 0x00, 0x46, 7 | 0x3B, 0x01, 0x65, 0x14, 0x75, 0x04, 0x95, 0x01, 0x81, 0x42, 8 | 0x09, 0x35, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x35, 0x00, 0x46, 9 | 0xFF, 0x00, 0x75, 0x08, 0x95, 0x01, 0x81, 0x02, 0xC0, 0x05, 10 | 0x09, 0x19, 0x01, 0x29, 0x07, 0x15, 0x00, 0x25, 0x01, 0x75, 11 | 0x01, 0x95, 0x07, 0x45, 0x00, 0x65, 0x00, 0x81, 0x02, 0x75, 12 | 0x01, 0x95, 0x01, 0x81, 0x03, 0x05, 0x01, 0x09, 0x36, 0x15, 13 | 0x00, 0x26, 0xFF, 0x00, 0x35, 0x00, 0x46, 0xFF, 0x00, 0x75, 14 | 0x08, 0x95, 0x01, 0x81, 0x02, 0x06, 0x00, 0xFF, 0x09, 0x01, 15 | 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 0x08, 0x95, 0x01, 0x81, 16 | 0x02, 0xC0, 0x09, 0x00, 0xA1, 0x02, 0x09, 0x02, 0x15, 0x00, 17 | 0x26, 0xFF, 0x00, 0x75, 0x08, 0x95, 0x08, 0x91, 0x02, 0xC0, 18 | 0xC0, -------------------------------------------------------------------------------- /windows/test/data/046D_C283_0004_0001_real.rpt_desc: -------------------------------------------------------------------------------- 1 | 0x05, 0x01, 0x09, 0x04, 0xA1, 0x01, 0x09, 0x00, 0xA1, 0x02, 2 | 0x09, 0x01, 0xA1, 0x00, 0x09, 0x30, 0x09, 0x31, 0x15, 0x00, 3 | 0x26, 0xFF, 0x00, 0x35, 0x00, 0x46, 0xFF, 0x00, 0x75, 0x08, 4 | 0x95, 0x02, 0x81, 0x02, 0x06, 0x00, 0xFF, 0x09, 0x01, 0x15, 5 | 0x00, 0x25, 0x0F, 0x75, 0x04, 0x95, 0x01, 0x81, 0x02, 0x05, 6 | 0x01, 0x09, 0x39, 0x15, 0x00, 0x25, 0x07, 0x35, 0x00, 0x46, 7 | 0x3B, 0x01, 0x65, 0x14, 0x75, 0x04, 0x95, 0x01, 0x81, 0x42, 8 | 0x09, 0x35, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x35, 0x00, 0x46, 9 | 0xFF, 0x00, 0x75, 0x08, 0x95, 0x01, 0x81, 0x02, 0xC0, 0x05, 10 | 0x09, 0x19, 0x01, 0x29, 0x07, 0x15, 0x00, 0x25, 0x01, 0x75, 11 | 0x01, 0x95, 0x07, 0x45, 0x00, 0x65, 0x00, 0x81, 0x02, 0x75, 12 | 0x01, 0x95, 0x01, 0x81, 0x03, 0x05, 0x01, 0x09, 0x36, 0x15, 13 | 0x00, 0x26, 0xFF, 0x00, 0x35, 0x00, 0x46, 0xFF, 0x00, 0x75, 14 | 0x08, 0x95, 0x01, 0x81, 0x02, 0x06, 0x00, 0xFF, 0x09, 0x01, 15 | 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 0x08, 0x95, 0x01, 0x81, 16 | 0x02, 0xC0, 0x09, 0x00, 0xA1, 0x02, 0x09, 0x02, 0x15, 0x00, 17 | 0x26, 0xFF, 0x00, 0x75, 0x08, 0x95, 0x08, 0x91, 0x02, 0xC0, 18 | 0xC0, -------------------------------------------------------------------------------- /windows/test/data/046D_C52F_0001_000C.pp_data: -------------------------------------------------------------------------------- 1 | # HIDAPI device info struct: 2 | dev->vendor_id = 0x046D 3 | dev->product_id = 0xC52F 4 | dev->manufacturer_string = "Logitech" 5 | dev->product_string = "USB Receiver" 6 | dev->release_number = 0x2200 7 | dev->interface_number = 1 8 | dev->usage = 0x0001 9 | dev->usage_page = 0x000C 10 | dev->path = "\\?\hid#vid_046d&pid_c52f&mi_01&col01#8&28ca146b&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}" 11 | 12 | # Preparsed Data struct: 13 | pp_data->MagicKey = 0x48696450204B4452 14 | pp_data->Usage = 0x0001 15 | pp_data->UsagePage = 0x000C 16 | pp_data->Reserved = 0x00000000 17 | # Input caps_info struct: 18 | pp_data->caps_info[0]->FirstCap = 0 19 | pp_data->caps_info[0]->LastCap = 1 20 | pp_data->caps_info[0]->NumberOfCaps = 1 21 | pp_data->caps_info[0]->ReportByteLength = 5 22 | # Output caps_info struct: 23 | pp_data->caps_info[1]->FirstCap = 1 24 | pp_data->caps_info[1]->LastCap = 1 25 | pp_data->caps_info[1]->NumberOfCaps = 0 26 | pp_data->caps_info[1]->ReportByteLength = 0 27 | # Feature caps_info struct: 28 | pp_data->caps_info[2]->FirstCap = 1 29 | pp_data->caps_info[2]->LastCap = 1 30 | pp_data->caps_info[2]->NumberOfCaps = 0 31 | pp_data->caps_info[2]->ReportByteLength = 0 32 | # LinkCollectionArray Offset & Size: 33 | pp_data->FirstByteOfLinkCollectionArray = 0x0068 34 | pp_data->NumberLinkCollectionNodes = 1 35 | # Input hid_pp_cap struct: 36 | pp_data->cap[0]->UsagePage = 0x000C 37 | pp_data->cap[0]->ReportID = 0x03 38 | pp_data->cap[0]->BitPosition = 0 39 | pp_data->cap[0]->BitSize = 16 40 | pp_data->cap[0]->ReportCount = 2 41 | pp_data->cap[0]->BytePosition = 0x0001 42 | pp_data->cap[0]->BitCount = 32 43 | pp_data->cap[0]->BitField = 0x00 44 | pp_data->cap[0]->NextBytePosition = 0x0005 45 | pp_data->cap[0]->LinkCollection = 0x0000 46 | pp_data->cap[0]->LinkUsagePage = 0x000C 47 | pp_data->cap[0]->LinkUsage = 0x0001 48 | pp_data->cap[0]->IsMultipleItemsForArray = 0 49 | pp_data->cap[0]->IsButtonCap = 1 50 | pp_data->cap[0]->IsPadding = 0 51 | pp_data->cap[0]->IsAbsolute = 1 52 | pp_data->cap[0]->IsRange = 1 53 | pp_data->cap[0]->IsAlias = 0 54 | pp_data->cap[0]->IsStringRange = 0 55 | pp_data->cap[0]->IsDesignatorRange = 0 56 | pp_data->cap[0]->Reserved1 = 0x000000 57 | pp_data->cap[0]->pp_cap->UnknownTokens[0].Token = 0x00 58 | pp_data->cap[0]->pp_cap->UnknownTokens[0].Reserved = 0x000000 59 | pp_data->cap[0]->pp_cap->UnknownTokens[0].BitField = 0x00000000 60 | pp_data->cap[0]->pp_cap->UnknownTokens[1].Token = 0x00 61 | pp_data->cap[0]->pp_cap->UnknownTokens[1].Reserved = 0x000000 62 | pp_data->cap[0]->pp_cap->UnknownTokens[1].BitField = 0x00000000 63 | pp_data->cap[0]->pp_cap->UnknownTokens[2].Token = 0x00 64 | pp_data->cap[0]->pp_cap->UnknownTokens[2].Reserved = 0x000000 65 | pp_data->cap[0]->pp_cap->UnknownTokens[2].BitField = 0x00000000 66 | pp_data->cap[0]->pp_cap->UnknownTokens[3].Token = 0x00 67 | pp_data->cap[0]->pp_cap->UnknownTokens[3].Reserved = 0x000000 68 | pp_data->cap[0]->pp_cap->UnknownTokens[3].BitField = 0x00000000 69 | pp_data->cap[0]->Range.UsageMin = 0x0001 70 | pp_data->cap[0]->Range.UsageMax = 0x028C 71 | pp_data->cap[0]->Range.StringMin = 0 72 | pp_data->cap[0]->Range.StringMax = 0 73 | pp_data->cap[0]->Range.DesignatorMin = 0 74 | pp_data->cap[0]->Range.DesignatorMax = 0 75 | pp_data->cap[0]->Range.DataIndexMin = 0 76 | pp_data->cap[0]->Range.DataIndexMax = 651 77 | pp_data->cap[0]->Button.LogicalMin = 1 78 | pp_data->cap[0]->Button.LogicalMax = 652 79 | pp_data->cap[0]->Units = 0 80 | pp_data->cap[0]->UnitsExp = 0 81 | 82 | # Output hid_pp_cap struct: 83 | # Feature hid_pp_cap struct: 84 | # Link Collections: 85 | pp_data->LinkCollectionArray[0]->LinkUsage = 0x0001 86 | pp_data->LinkCollectionArray[0]->LinkUsagePage = 0x000C 87 | pp_data->LinkCollectionArray[0]->Parent = 0 88 | pp_data->LinkCollectionArray[0]->NumberOfChildren = 0 89 | pp_data->LinkCollectionArray[0]->NextSibling = 0 90 | pp_data->LinkCollectionArray[0]->FirstChild = 0 91 | pp_data->LinkCollectionArray[0]->CollectionType = 1 92 | pp_data->LinkCollectionArray[0]->IsAlias = 0 93 | pp_data->LinkCollectionArray[0]->Reserved = 0x00000000 94 | -------------------------------------------------------------------------------- /windows/test/data/046D_C52F_0001_000C_expected.rpt_desc: -------------------------------------------------------------------------------- 1 | 0x05, 0x0C, 0x09, 0x01, 0xA1, 0x01, 0x85, 0x03, 0x19, 0x01, 2 | 0x2A, 0x8C, 0x02, 0x15, 0x01, 0x26, 0x8C, 0x02, 0x75, 0x10, 3 | 0x95, 0x02, 0x81, 0x00, 0xC0, -------------------------------------------------------------------------------- /windows/test/data/046D_C52F_0001_000C_real.rpt_desc: -------------------------------------------------------------------------------- 1 | Usage Page (Consumer Devices) 05 0C 2 | Usage (Consumer Control) 09 01 3 | Collection (Application) A1 01 4 | Report ID (3) 85 03 5 | Report Size (16) 75 10 6 | Report Count (2) 95 02 7 | Logical Minimum (1) 15 01 8 | Logical Maximum (652) 26 8C 02 9 | Usage Minimum (Consumer Control) 19 01 10 | Usage Maximum (AC Send) 2A 8C 02 11 | Input (Data,Ary,Abs) 81 00 12 | End Collection C0 13 | -------------------------------------------------------------------------------- /windows/test/data/046D_C52F_0001_FF00_expected.rpt_desc: -------------------------------------------------------------------------------- 1 | 0x06, 0x00, 0xFF, 0x09, 0x01, 0xA1, 0x01, 0x85, 0x10, 0x09, 2 | 0x01, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 0x08, 0x95, 0x06, 3 | 0x81, 0x00, 0x09, 0x01, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 4 | 0x08, 0x95, 0x06, 0x91, 0x00, 0xC0, -------------------------------------------------------------------------------- /windows/test/data/046D_C52F_0001_FF00_real.rpt_desc: -------------------------------------------------------------------------------- 1 | Usage Page (Vendor-Defined 1) 06 00 FF 2 | Usage (Vendor-Defined 1) 09 01 3 | Collection (Application) A1 01 4 | Report ID (16) 85 10 5 | Report Size (8) 75 08 6 | Report Count (6) 95 06 7 | Logical Minimum (0) 15 00 8 | Logical Maximum (255) 26 FF 00 9 | Usage (Vendor-Defined 1) 09 01 10 | Input (Data,Ary,Abs) 81 00 11 | Usage (Vendor-Defined 1) 09 01 12 | Output (Data,Ary,Abs,NWrp,Lin,Pref,NNul,NVol,Bit) 91 00 13 | End Collection C0 14 | -------------------------------------------------------------------------------- /windows/test/data/046D_C52F_0002_0001_expected.rpt_desc: -------------------------------------------------------------------------------- 1 | 0x05, 0x01, 0x09, 0x02, 0xA1, 0x01, 0x09, 0x01, 0xA1, 0x00, 2 | 0x05, 0x09, 0x19, 0x01, 0x29, 0x10, 0x15, 0x00, 0x25, 0x01, 3 | 0x75, 0x01, 0x95, 0x10, 0x81, 0x02, 0x05, 0x01, 0x09, 0x30, 4 | 0x09, 0x31, 0x16, 0x01, 0x80, 0x26, 0xFF, 0x7F, 0x75, 0x10, 5 | 0x95, 0x02, 0x81, 0x06, 0x09, 0x38, 0x15, 0x81, 0x25, 0x7F, 6 | 0x75, 0x08, 0x95, 0x01, 0x81, 0x06, 0x05, 0x0C, 0x0A, 0x38, 7 | 0x02, 0x15, 0x81, 0x25, 0x7F, 0x75, 0x08, 0x95, 0x01, 0x81, 8 | 0x06, 0xC0, 0xC0, -------------------------------------------------------------------------------- /windows/test/data/046D_C52F_0002_0001_real.rpt_desc: -------------------------------------------------------------------------------- 1 | Usage Page (Generic Desktop) 05 01 2 | Usage (Mouse) 09 02 3 | Collection (Application) A1 01 4 | Usage (Pointer) 09 01 5 | Collection (Physical) A1 00 6 | Usage Page (Button) 05 09 7 | Usage Minimum (Button 1) 19 01 8 | Usage Maximum (Button 16) 29 10 9 | Logical Minimum (0) 15 00 10 | Logical Maximum (1) 25 01 11 | Report Count (16) 95 10 12 | Report Size (1) 75 01 13 | Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 02 14 | Usage Page (Generic Desktop) 05 01 15 | Logical Minimum (-32767) 16 01 80 16 | Logical Maximum (32767) 26 FF 7F 17 | Report Size (16) 75 10 18 | Report Count (2) 95 02 19 | Usage (X) 09 30 20 | Usage (Y) 09 31 21 | Input (Data,Var,Rel,NWrp,Lin,Pref,NNul,Bit) 81 06 22 | Logical Minimum (-127) 15 81 23 | Logical Maximum (127) 25 7F 24 | Report Size (8) 75 08 25 | Report Count (1) 95 01 26 | Usage (Wheel) 09 38 27 | Input (Data,Var,Rel,NWrp,Lin,Pref,NNul,Bit) 81 06 28 | Usage Page (Consumer Devices) 05 0C 29 | Usage (AC Pan) 0A 38 02 30 | Report Count (1) 95 01 31 | Input (Data,Var,Rel,NWrp,Lin,Pref,NNul,Bit) 81 06 32 | End Collection C0 33 | End Collection C0 34 | -------------------------------------------------------------------------------- /windows/test/data/046D_C52F_0002_FF00_expected.rpt_desc: -------------------------------------------------------------------------------- 1 | 0x06, 0x00, 0xFF, 0x09, 0x02, 0xA1, 0x01, 0x85, 0x11, 0x09, 2 | 0x02, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 0x08, 0x95, 0x13, 3 | 0x81, 0x00, 0x09, 0x02, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 4 | 0x08, 0x95, 0x13, 0x91, 0x00, 0xC0, -------------------------------------------------------------------------------- /windows/test/data/046D_C52F_0002_FF00_real.rpt_desc: -------------------------------------------------------------------------------- 1 | Usage Page (Vendor-Defined 1) 06 00 FF 2 | Usage (Vendor-Defined 2) 09 02 3 | Collection (Application) A1 01 4 | Report ID (17) 85 11 5 | Report Size (8) 75 08 6 | Report Count (19) 95 13 7 | Logical Minimum (0) 15 00 8 | Logical Maximum (255) 26 FF 00 9 | Usage (Vendor-Defined 2) 09 02 10 | Input (Data,Ary,Abs) 81 00 11 | Usage (Vendor-Defined 2) 09 02 12 | Output (Data,Ary,Abs,NWrp,Lin,Pref,NNul,NVol,Bit) 91 00 13 | End Collection C0 14 | -------------------------------------------------------------------------------- /windows/test/data/046D_C534_0001_000C.pp_data: -------------------------------------------------------------------------------- 1 | # HIDAPI device info struct: 2 | dev->vendor_id = 0x046D 3 | dev->product_id = 0xC534 4 | dev->manufacturer_string = "Logitech" 5 | dev->product_string = "USB Receiver" 6 | dev->release_number = 0x2901 7 | dev->interface_number = 1 8 | dev->usage = 0x0001 9 | dev->usage_page = 0x000C 10 | dev->path = "\\?\hid#vid_046d&pid_c534&mi_01&col02#7&1ebb799e&0&0001#{4d1e55b2-f16f-11cf-88cb-001111000030}" 11 | 12 | # Preparsed Data struct: 13 | pp_data->MagicKey = 0x48696450204B4452 14 | pp_data->Usage = 0x0001 15 | pp_data->UsagePage = 0x000C 16 | pp_data->Reserved = 0x00000000 17 | # Input caps_info struct: 18 | pp_data->caps_info[0]->FirstCap = 0 19 | pp_data->caps_info[0]->LastCap = 1 20 | pp_data->caps_info[0]->NumberOfCaps = 1 21 | pp_data->caps_info[0]->ReportByteLength = 5 22 | # Output caps_info struct: 23 | pp_data->caps_info[1]->FirstCap = 1 24 | pp_data->caps_info[1]->LastCap = 1 25 | pp_data->caps_info[1]->NumberOfCaps = 0 26 | pp_data->caps_info[1]->ReportByteLength = 0 27 | # Feature caps_info struct: 28 | pp_data->caps_info[2]->FirstCap = 1 29 | pp_data->caps_info[2]->LastCap = 1 30 | pp_data->caps_info[2]->NumberOfCaps = 0 31 | pp_data->caps_info[2]->ReportByteLength = 0 32 | # LinkCollectionArray Offset & Size: 33 | pp_data->FirstByteOfLinkCollectionArray = 0x0068 34 | pp_data->NumberLinkCollectionNodes = 1 35 | # Input hid_pp_cap struct: 36 | pp_data->cap[0]->UsagePage = 0x000C 37 | pp_data->cap[0]->ReportID = 0x03 38 | pp_data->cap[0]->BitPosition = 0 39 | pp_data->cap[0]->BitSize = 16 40 | pp_data->cap[0]->ReportCount = 2 41 | pp_data->cap[0]->BytePosition = 0x0001 42 | pp_data->cap[0]->BitCount = 32 43 | pp_data->cap[0]->BitField = 0x00 44 | pp_data->cap[0]->NextBytePosition = 0x0005 45 | pp_data->cap[0]->LinkCollection = 0x0000 46 | pp_data->cap[0]->LinkUsagePage = 0x000C 47 | pp_data->cap[0]->LinkUsage = 0x0001 48 | pp_data->cap[0]->IsMultipleItemsForArray = 0 49 | pp_data->cap[0]->IsButtonCap = 1 50 | pp_data->cap[0]->IsPadding = 0 51 | pp_data->cap[0]->IsAbsolute = 1 52 | pp_data->cap[0]->IsRange = 1 53 | pp_data->cap[0]->IsAlias = 0 54 | pp_data->cap[0]->IsStringRange = 0 55 | pp_data->cap[0]->IsDesignatorRange = 0 56 | pp_data->cap[0]->Reserved1 = 0x000000 57 | pp_data->cap[0]->pp_cap->UnknownTokens[0].Token = 0x00 58 | pp_data->cap[0]->pp_cap->UnknownTokens[0].Reserved = 0x000000 59 | pp_data->cap[0]->pp_cap->UnknownTokens[0].BitField = 0x00000000 60 | pp_data->cap[0]->pp_cap->UnknownTokens[1].Token = 0x00 61 | pp_data->cap[0]->pp_cap->UnknownTokens[1].Reserved = 0x000000 62 | pp_data->cap[0]->pp_cap->UnknownTokens[1].BitField = 0x00000000 63 | pp_data->cap[0]->pp_cap->UnknownTokens[2].Token = 0x00 64 | pp_data->cap[0]->pp_cap->UnknownTokens[2].Reserved = 0x000000 65 | pp_data->cap[0]->pp_cap->UnknownTokens[2].BitField = 0x00000000 66 | pp_data->cap[0]->pp_cap->UnknownTokens[3].Token = 0x00 67 | pp_data->cap[0]->pp_cap->UnknownTokens[3].Reserved = 0x000000 68 | pp_data->cap[0]->pp_cap->UnknownTokens[3].BitField = 0x00000000 69 | pp_data->cap[0]->Range.UsageMin = 0x0001 70 | pp_data->cap[0]->Range.UsageMax = 0x028C 71 | pp_data->cap[0]->Range.StringMin = 0 72 | pp_data->cap[0]->Range.StringMax = 0 73 | pp_data->cap[0]->Range.DesignatorMin = 0 74 | pp_data->cap[0]->Range.DesignatorMax = 0 75 | pp_data->cap[0]->Range.DataIndexMin = 0 76 | pp_data->cap[0]->Range.DataIndexMax = 651 77 | pp_data->cap[0]->Button.LogicalMin = 1 78 | pp_data->cap[0]->Button.LogicalMax = 652 79 | pp_data->cap[0]->Units = 0 80 | pp_data->cap[0]->UnitsExp = 0 81 | 82 | # Output hid_pp_cap struct: 83 | # Feature hid_pp_cap struct: 84 | # Link Collections: 85 | pp_data->LinkCollectionArray[0]->LinkUsage = 0x0001 86 | pp_data->LinkCollectionArray[0]->LinkUsagePage = 0x000C 87 | pp_data->LinkCollectionArray[0]->Parent = 0 88 | pp_data->LinkCollectionArray[0]->NumberOfChildren = 0 89 | pp_data->LinkCollectionArray[0]->NextSibling = 0 90 | pp_data->LinkCollectionArray[0]->FirstChild = 0 91 | pp_data->LinkCollectionArray[0]->CollectionType = 1 92 | pp_data->LinkCollectionArray[0]->IsAlias = 0 93 | pp_data->LinkCollectionArray[0]->Reserved = 0x00000000 94 | -------------------------------------------------------------------------------- /windows/test/data/046D_C534_0001_000C_expected.rpt_desc: -------------------------------------------------------------------------------- 1 | 0x05, 0x0C, 0x09, 0x01, 0xA1, 0x01, 0x85, 0x03, 0x19, 0x01, 2 | 0x2A, 0x8C, 0x02, 0x15, 0x01, 0x26, 0x8C, 0x02, 0x75, 0x10, 3 | 0x95, 0x02, 0x81, 0x00, 0xC0, -------------------------------------------------------------------------------- /windows/test/data/046D_C534_0001_000C_real.rpt_desc: -------------------------------------------------------------------------------- 1 | macOS USB prober output for Logitech USB Receiver 2 | 05 0C 09 01 A1 01 3 | 85 03 75 10 95 02 15 01 26 8C 02 19 01 2A 8C 02 81 00 4 | C0 5 | 6 | Parser output: 7 | 0x05, 0x0C, // Usage Page (Consumer) 8 | 0x09, 0x01, // Usage (Consumer Control) 9 | 0xA1, 0x01, // Collection (Application) 10 | 0x85, 0x03, // Report ID (3) 11 | 0x75, 0x10, // Report Size (16) 12 | 0x95, 0x02, // Report Count (2) 13 | 0x15, 0x01, // Logical Minimum (1) 14 | 0x26, 0x8C, 0x02, // Logical Maximum (652) 15 | 0x19, 0x01, // Usage Minimum (Consumer Control) 16 | 0x2A, 0x8C, 0x02, // Usage Maximum (AC Send) 17 | 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) 18 | 0xC0, // End Collection -------------------------------------------------------------------------------- /windows/test/data/046D_C534_0001_FF00_expected.rpt_desc: -------------------------------------------------------------------------------- 1 | 0x06, 0x00, 0xFF, 0x09, 0x01, 0xA1, 0x01, 0x85, 0x10, 0x09, 2 | 0x01, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 0x08, 0x95, 0x06, 3 | 0x81, 0x00, 0x09, 0x01, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 4 | 0x08, 0x95, 0x06, 0x91, 0x00, 0xC0, -------------------------------------------------------------------------------- /windows/test/data/046D_C534_0001_FF00_real.rpt_desc: -------------------------------------------------------------------------------- 1 | macOS USB prober output for Logitech USB Receiver 2 | 3 | 06 00 FF 09 01 A1 01 85 10 75 08 95 06 4 | 15 00 26 FF 00 09 01 81 5 | 00 09 01 91 00 C0 6 | 7 | Parser Output: 8 | 0x06, 0x00, 0xFF, // Usage Page (Vendor Defined 0xFF00) 9 | 0x09, 0x01, // Usage (0x01) 10 | 0xA1, 0x01, // Collection (Application) 11 | 0x85, 0x10, // Report ID (16) 12 | 0x75, 0x08, // Report Size (8) 13 | 0x95, 0x06, // Report Count (6) 14 | 0x15, 0x00, // Logical Minimum (0) 15 | 0x26, 0xFF, 0x00, // Logical Maximum (255) 16 | 0x09, 0x01, // Usage (0x01) 17 | 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) 18 | 0x09, 0x01, // Usage (0x01) 19 | 0x91, 0x00, // Output (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 20 | 0xC0, // End Collection 21 | -------------------------------------------------------------------------------- /windows/test/data/046D_C534_0002_0001_expected.rpt_desc: -------------------------------------------------------------------------------- 1 | 0x05, 0x01, 0x09, 0x02, 0xA1, 0x01, 0x09, 0x01, 0xA1, 0x00, 2 | 0x85, 0x02, 0x05, 0x09, 0x19, 0x01, 0x29, 0x10, 0x15, 0x00, 3 | 0x25, 0x01, 0x75, 0x01, 0x95, 0x10, 0x81, 0x02, 0x05, 0x01, 4 | 0x09, 0x30, 0x09, 0x31, 0x16, 0x01, 0xF8, 0x26, 0xFF, 0x07, 5 | 0x75, 0x0C, 0x95, 0x02, 0x81, 0x06, 0x09, 0x38, 0x15, 0x81, 6 | 0x25, 0x7F, 0x75, 0x08, 0x95, 0x01, 0x81, 0x06, 0x05, 0x0C, 7 | 0x0A, 0x38, 0x02, 0x15, 0x81, 0x25, 0x7F, 0x75, 0x08, 0x95, 8 | 0x01, 0x81, 0x06, 0xC0, 0xC0, -------------------------------------------------------------------------------- /windows/test/data/046D_C534_0002_0001_real.rpt_desc: -------------------------------------------------------------------------------- 1 | 2 | 05 01 09 02 A1 01 85 02 09 01 A1 00 05 09 19 01 3 | 29 10 15 00 25 01 95 10 75 01 81 02 05 01 16 01 4 | F8 26 FF 07 75 0C 95 02 09 30 09 31 81 06 15 81 5 | 25 7F 75 08 95 01 09 38 81 06 05 0C 0A 38 02 95 6 | 01 81 06 C0 C0 7 | 8 | Parser Output: 9 | 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) 10 | 0x09, 0x02, // Usage (Mouse) 11 | 0xA1, 0x01, // Collection (Application) 12 | 0x85, 0x02, // Report ID (2) 13 | 0x09, 0x01, // Usage (Pointer) 14 | 0xA1, 0x00, // Collection (Physical) 15 | 0x05, 0x09, // Usage Page (Button) 16 | 0x19, 0x01, // Usage Minimum (0x01) 17 | 0x29, 0x10, // Usage Maximum (0x10) 18 | 0x15, 0x00, // Logical Minimum (0) 19 | 0x25, 0x01, // Logical Maximum (1) 20 | 0x95, 0x10, // Report Count (16) 21 | 0x75, 0x01, // Report Size (1) 22 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 23 | 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) 24 | 0x16, 0x01, 0xF8, // Logical Minimum (-2047) 25 | 0x26, 0xFF, 0x07, // Logical Maximum (2047) 26 | 0x75, 0x0C, // Report Size (12) 27 | 0x95, 0x02, // Report Count (2) 28 | 0x09, 0x30, // Usage (X) 29 | 0x09, 0x31, // Usage (Y) 30 | 0x81, 0x06, // Input (Data,Var,Rel,No Wrap,Linear,Preferred State,No Null Position) 31 | 0x15, 0x81, // Logical Minimum (-127) 32 | 0x25, 0x7F, // Logical Maximum (127) 33 | 0x75, 0x08, // Report Size (8) 34 | 0x95, 0x01, // Report Count (1) 35 | 0x09, 0x38, // Usage (Wheel) 36 | 0x81, 0x06, // Input (Data,Var,Rel,No Wrap,Linear,Preferred State,No Null Position) 37 | 0x05, 0x0C, // Usage Page (Consumer) 38 | 0x0A, 0x38, 0x02, // Usage (AC Pan) 39 | 0x95, 0x01, // Report Count (1) 40 | 0x81, 0x06, // Input (Data,Var,Rel,No Wrap,Linear,Preferred State,No Null Position) 41 | 0xC0, // End Collection 42 | 0xC0, // End Collection 43 | 44 | // 69 bytes 45 | -------------------------------------------------------------------------------- /windows/test/data/046D_C534_0002_FF00_expected.rpt_desc: -------------------------------------------------------------------------------- 1 | 0x06, 0x00, 0xFF, 0x09, 0x02, 0xA1, 0x01, 0x85, 0x11, 0x09, 2 | 0x02, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 0x08, 0x95, 0x13, 3 | 0x81, 0x00, 0x09, 0x02, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 4 | 0x08, 0x95, 0x13, 0x91, 0x00, 0xC0, -------------------------------------------------------------------------------- /windows/test/data/046D_C534_0002_FF00_real.rpt_desc: -------------------------------------------------------------------------------- 1 | macOS USB prober output for Logitech USB Receiver 2 | 3 | 06 00 FF 09 02 A1 01 85 11 4 | 75 08 95 13 15 00 26 FF 5 | 00 09 02 81 00 09 02 91 00 C0 6 | 7 | Parser output: 8 | 0x06, 0x00, 0xFF, // Usage Page (Vendor Defined 0xFF00) 9 | 0x09, 0x02, // Usage (0x02) 10 | 0xA1, 0x01, // Collection (Application) 11 | 0x85, 0x11, // Report ID (17) 12 | 0x75, 0x08, // Report Size (8) 13 | 0x95, 0x13, // Report Count (19) 14 | 0x15, 0x00, // Logical Minimum (0) 15 | 0x26, 0xFF, 0x00, // Logical Maximum (255) 16 | 0x09, 0x02, // Usage (0x02) 17 | 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) 18 | 0x09, 0x02, // Usage (0x02) 19 | 0x91, 0x00, // Output (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 20 | 0xC0, // End Collection 21 | 22 | // 27 bytes 23 | -------------------------------------------------------------------------------- /windows/test/data/046D_C534_0006_0001_expected.rpt_desc: -------------------------------------------------------------------------------- 1 | 0x05, 0x01, 0x09, 0x06, 0xA1, 0x01, 0x05, 0x07, 0x19, 0xE0, 2 | 0x29, 0xE7, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 3 | 0x81, 0x02, 0x75, 0x08, 0x95, 0x01, 0x81, 0x03, 0x19, 0x00, 4 | 0x29, 0xA4, 0x15, 0x00, 0x26, 0xA4, 0x00, 0x75, 0x08, 0x95, 5 | 0x06, 0x81, 0x00, 0x05, 0x08, 0x19, 0x01, 0x29, 0x05, 0x15, 6 | 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x05, 0x91, 0x02, 0x75, 7 | 0x03, 0x95, 0x01, 0x91, 0x03, 0xC0, -------------------------------------------------------------------------------- /windows/test/data/046D_C534_0006_0001_real.rpt_desc: -------------------------------------------------------------------------------- 1 | macOS USB prober output for Logitech USB Receiver 2 | 3 | 4 | Type: 0x22 (Report Descriptor) 5 | Length (and contents): 59 6 | Raw Descriptor (hex) 0000: 05 01 09 06 A1 01 05 07 19 E0 29 E7 15 00 25 01 7 | Raw Descriptor (hex) 0010: 75 01 95 08 81 02 81 03 95 05 05 08 19 01 29 05 8 | Raw Descriptor (hex) 0020: 91 02 95 01 75 03 91 01 95 06 75 08 15 00 26 A4 9 | Raw Descriptor (hex) 0030: 00 05 07 19 00 2A A4 00 81 00 C0 10 | 11 | Parser output: 12 | 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) 13 | 0x09, 0x06, // Usage (Keyboard) 14 | 0xA1, 0x01, // Collection (Application) 15 | 0x05, 0x07, // Usage Page (Kbrd/Keypad) 16 | 0x19, 0xE0, // Usage Minimum (0xE0) 17 | 0x29, 0xE7, // Usage Maximum (0xE7) 18 | 0x15, 0x00, // Logical Minimum (0) 19 | 0x25, 0x01, // Logical Maximum (1) 20 | 0x75, 0x01, // Report Size (1) 21 | 0x95, 0x08, // Report Count (8) 22 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 23 | 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 24 | 0x95, 0x05, // Report Count (5) 25 | 0x05, 0x08, // Usage Page (LEDs) 26 | 0x19, 0x01, // Usage Minimum (Num Lock) 27 | 0x29, 0x05, // Usage Maximum (Kana) 28 | 0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 29 | 0x95, 0x01, // Report Count (1) 30 | 0x75, 0x03, // Report Size (3) 31 | 0x91, 0x01, // Output (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 32 | 0x95, 0x06, // Report Count (6) 33 | 0x75, 0x08, // Report Size (8) 34 | 0x15, 0x00, // Logical Minimum (0) 35 | 0x26, 0xA4, 0x00, // Logical Maximum (164) 36 | 0x05, 0x07, // Usage Page (Kbrd/Keypad) 37 | 0x19, 0x00, // Usage Minimum (0x00) 38 | 0x2A, 0xA4, 0x00, // Usage Maximum (0xA4) 39 | 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) 40 | 0xC0, // End Collection 41 | 42 | // 59 bytes 43 | -------------------------------------------------------------------------------- /windows/test/data/046D_C534_0080_0001_expected.rpt_desc: -------------------------------------------------------------------------------- 1 | 0x05, 0x01, 0x09, 0x80, 0xA1, 0x01, 0x85, 0x04, 0x09, 0x82, 2 | 0x09, 0x81, 0x09, 0x83, 0x15, 0x01, 0x25, 0x03, 0x75, 0x02, 3 | 0x95, 0x01, 0x81, 0x60, 0x75, 0x06, 0x95, 0x01, 0x81, 0x03, 4 | 0xC0, -------------------------------------------------------------------------------- /windows/test/data/046D_C534_0080_0001_real.rpt_desc: -------------------------------------------------------------------------------- 1 | 2 | 05 01 09 80 A1 01 85 04 75 02 95 01 15 01 25 03 3 | 09 82 09 81 09 83 81 60 75 06 81 03 C0 4 | 5 | Parser output: 6 | 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) 7 | 0x09, 0x80, // Usage (Sys Control) 8 | 0xA1, 0x01, // Collection (Application) 9 | 0x85, 0x04, // Report ID (4) 10 | 0x75, 0x02, // Report Size (2) 11 | 0x95, 0x01, // Report Count (1) 12 | 0x15, 0x01, // Logical Minimum (1) 13 | 0x25, 0x03, // Logical Maximum (3) 14 | 0x09, 0x82, // Usage (Sys Sleep) 15 | 0x09, 0x81, // Usage (Sys Power Down) 16 | 0x09, 0x83, // Usage (Sys Wake Up) 17 | 0x81, 0x60, // Input (Data,Array,Abs,No Wrap,Linear,No Preferred State,Null State) 18 | 0x75, 0x06, // Report Size (6) 19 | 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 20 | 0xC0, // End Collection 21 | 22 | // 29 bytes 23 | -------------------------------------------------------------------------------- /windows/test/data/047F_C056_0001_000C_expected.rpt_desc: -------------------------------------------------------------------------------- 1 | 0x05, 0x0C, 0x09, 0x01, 0xA1, 0x01, 0x85, 0x01, 0x09, 0xE9, 2 | 0x09, 0xEA, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x02, 3 | 0x81, 0x06, 0x75, 0x06, 0x95, 0x01, 0x81, 0x03, 0x85, 0x02, 4 | 0x09, 0x00, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x10, 5 | 0x81, 0x02, 0x85, 0x05, 0x09, 0x00, 0x15, 0x00, 0x25, 0x01, 6 | 0x75, 0x08, 0x95, 0x20, 0x81, 0x02, 0x85, 0x07, 0x09, 0x00, 7 | 0x15, 0x00, 0x25, 0x01, 0x75, 0x08, 0x95, 0x20, 0x81, 0x02, 8 | 0x85, 0x04, 0x09, 0x00, 0x15, 0x00, 0x25, 0x01, 0x75, 0x08, 9 | 0x95, 0x24, 0x91, 0x02, 0x85, 0x06, 0x09, 0x00, 0x15, 0x00, 10 | 0x25, 0x01, 0x75, 0x08, 0x95, 0x24, 0x91, 0x02, 0xC0, -------------------------------------------------------------------------------- /windows/test/data/047F_C056_0001_000C_real.rpt_desc: -------------------------------------------------------------------------------- 1 | macOS USB Prober about 0x047F/0xC056 "Plantronics Blackwire 3220 Series" 2 | 05 0C 09 01 A1 01 85 01 15 00 25 01 09 E9 09 EA 3 | 75 01 95 02 81 06 95 06 81 01 85 02 05 0C 09 00 4 | 95 10 81 02 85 04 09 00 75 08 95 24 91 02 85 05 5 | 09 00 95 20 81 02 85 06 09 00 95 24 91 02 85 07 6 | 09 00 95 20 81 02 C0 7 | 8 | # Parser output: 9 | 10 | 0x05, 0x0C, // Usage Page (Consumer) 11 | 0x09, 0x01, // Usage (Consumer Control) 12 | 0xA1, 0x01, // Collection (Application) 13 | 0x85, 0x01, // Report ID (1) 14 | 0x15, 0x00, // Logical Minimum (0) 15 | 0x25, 0x01, // Logical Maximum (1) 16 | 0x09, 0xE9, // Usage (Volume Increment) 17 | 0x09, 0xEA, // Usage (Volume Decrement) 18 | 0x75, 0x01, // Report Size (1) 19 | 0x95, 0x02, // Report Count (2) 20 | 0x81, 0x06, // Input (Data,Var,Rel,No Wrap,Linear,Preferred State,No Null Position) 21 | 0x95, 0x06, // Report Count (6) 22 | 0x81, 0x01, // Input (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) 23 | 0x85, 0x02, // Report ID (2) 24 | 0x05, 0x0C, // Usage Page (Consumer) 25 | 0x09, 0x00, // Usage (Unassigned) 26 | 0x95, 0x10, // Report Count (16) 27 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 28 | 0x85, 0x04, // Report ID (4) 29 | 0x09, 0x00, // Usage (Unassigned) 30 | 0x75, 0x08, // Report Size (8) 31 | 0x95, 0x24, // Report Count (36) 32 | 0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 33 | 0x85, 0x05, // Report ID (5) 34 | 0x09, 0x00, // Usage (Unassigned) 35 | 0x95, 0x20, // Report Count (32) 36 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 37 | 0x85, 0x06, // Report ID (6) 38 | 0x09, 0x00, // Usage (Unassigned) 39 | 0x95, 0x24, // Report Count (36) 40 | 0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 41 | 0x85, 0x07, // Report ID (7) 42 | 0x09, 0x00, // Usage (Unassigned) 43 | 0x95, 0x20, // Report Count (32) 44 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 45 | 0xC0, // End Collection 46 | 47 | // 71 bytes 48 | -------------------------------------------------------------------------------- /windows/test/data/047F_C056_0003_FFA0_expected.rpt_desc: -------------------------------------------------------------------------------- 1 | 0x06, 0xA0, 0xFF, 0x09, 0x03, 0xA1, 0x01, 0x85, 0x03, 0x09, 2 | 0x30, 0x15, 0x00, 0x25, 0x01, 0x75, 0x08, 0x95, 0x20, 0x81, 3 | 0x02, 0x85, 0x14, 0x09, 0xB1, 0x09, 0xB2, 0x09, 0xB5, 0x09, 4 | 0xB7, 0x09, 0xB3, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 5 | 0x05, 0x81, 0x06, 0x75, 0x03, 0x95, 0x01, 0x81, 0x03, 0x85, 6 | 0x15, 0x09, 0x8C, 0x15, 0x00, 0x27, 0xFF, 0xFF, 0x00, 0x00, 7 | 0x75, 0x10, 0x95, 0x01, 0x81, 0x22, 0x85, 0x1F, 0x09, 0x9C, 8 | 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x01, 0x81, 0x06, 9 | 0x75, 0x07, 0x95, 0x01, 0x81, 0x03, 0x85, 0x03, 0x09, 0x30, 10 | 0x15, 0x00, 0x25, 0x01, 0x75, 0x08, 0x95, 0x20, 0x91, 0x02, 11 | 0x85, 0x19, 0x09, 0x8D, 0x09, 0x8F, 0x09, 0x9E, 0x09, 0xDC, 12 | 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x04, 0x91, 0x22, 13 | 0x09, 0xD2, 0x09, 0xD9, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 14 | 0x95, 0x02, 0x91, 0x06, 0x75, 0x02, 0x95, 0x01, 0x91, 0x03, 15 | 0x85, 0x1A, 0x09, 0xB5, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 16 | 0x95, 0x01, 0x91, 0x22, 0x75, 0x07, 0x95, 0x01, 0x91, 0x03, 17 | 0x85, 0x1B, 0x09, 0xCF, 0x09, 0xB5, 0x15, 0x00, 0x25, 0x01, 18 | 0x75, 0x01, 0x95, 0x02, 0xB1, 0x22, 0x09, 0xDE, 0x15, 0x00, 19 | 0x25, 0x01, 0x75, 0x01, 0x95, 0x01, 0xB1, 0x23, 0x09, 0xD8, 20 | 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x01, 0xB1, 0x22, 21 | 0x75, 0x04, 0x95, 0x01, 0xB1, 0x03, 0x09, 0x09, 0x09, 0x17, 22 | 0x09, 0x18, 0x09, 0x1E, 0x09, 0x20, 0x09, 0x2A, 0x15, 0x00, 23 | 0x25, 0x01, 0x75, 0x01, 0x95, 0x06, 0xB1, 0x22, 0x75, 0x02, 24 | 0x95, 0x01, 0xB1, 0x03, 0xC0, -------------------------------------------------------------------------------- /windows/test/data/047F_C056_0003_FFA0_real.rpt_desc: -------------------------------------------------------------------------------- 1 | macOS USB Prober about 0x047F/0xC056 "Plantronics Blackwire 3220 Series" 2 | 06 A0 FF 09 03 A1 01 85 03 09 30 75 3 | 08 95 20 91 02 85 03 09 30 75 08 95 20 81 02 85 4 | 14 09 B1 09 B2 09 B5 09 B7 09 B3 15 00 25 01 75 5 | 01 95 05 81 06 95 03 81 01 85 15 09 8C 15 00 27 6 | FF FF 00 00 75 10 95 01 81 22 85 19 09 8D 09 8F 7 | 09 9E 09 DC 15 00 25 01 75 01 95 04 91 22 09 D2 8 | 09 D9 15 00 25 01 75 01 95 02 91 06 95 02 91 01 9 | 85 1A 09 B5 15 00 25 01 75 01 95 01 91 22 95 07 10 | 91 01 85 1B 09 CF 09 B5 75 01 95 02 B1 22 09 DE 11 | 75 01 95 01 B1 23 09 D8 95 01 B1 22 95 04 B1 01 12 | 09 09 09 17 09 18 09 1E 09 20 09 2A 75 01 95 06 13 | B1 22 95 02 B1 01 85 1F 09 9C 75 01 95 01 81 06 14 | 95 07 81 01 C0 15 | 16 | Parser output: 17 | 0x06, 0xA0, 0xFF, // Usage Page (Vendor Defined 0xFFA0) 18 | 0x09, 0x03, // Usage (0x03) 19 | 0xA1, 0x01, // Collection (Application) 20 | 0x85, 0x03, // Report ID (3) 21 | 0x09, 0x30, // Usage (0x30) 22 | 0x75, 0x08, // Report Size (8) 23 | 0x95, 0x20, // Report Count (32) 24 | 0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 25 | 0x85, 0x03, // Report ID (3) 26 | 0x09, 0x30, // Usage (0x30) 27 | 0x75, 0x08, // Report Size (8) 28 | 0x95, 0x20, // Report Count (32) 29 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 30 | 0x85, 0x14, // Report ID (20) 31 | 0x09, 0xB1, // Usage (0xB1) 32 | 0x09, 0xB2, // Usage (0xB2) 33 | 0x09, 0xB5, // Usage (0xB5) 34 | 0x09, 0xB7, // Usage (0xB7) 35 | 0x09, 0xB3, // Usage (0xB3) 36 | 0x15, 0x00, // Logical Minimum (0) 37 | 0x25, 0x01, // Logical Maximum (1) 38 | 0x75, 0x01, // Report Size (1) 39 | 0x95, 0x05, // Report Count (5) 40 | 0x81, 0x06, // Input (Data,Var,Rel,No Wrap,Linear,Preferred State,No Null Position) 41 | 0x95, 0x03, // Report Count (3) 42 | 0x81, 0x01, // Input (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) 43 | 0x85, 0x15, // Report ID (21) 44 | 0x09, 0x8C, // Usage (0x8C) 45 | 0x15, 0x00, // Logical Minimum (0) 46 | 0x27, 0xFF, 0xFF, 0x00, 0x00, // Logical Maximum (65534) 47 | 0x75, 0x10, // Report Size (16) 48 | 0x95, 0x01, // Report Count (1) 49 | 0x81, 0x22, // Input (Data,Var,Abs,No Wrap,Linear,No Preferred State,No Null Position) 50 | 0x85, 0x19, // Report ID (25) 51 | 0x09, 0x8D, // Usage (0x8D) 52 | 0x09, 0x8F, // Usage (0x8F) 53 | 0x09, 0x9E, // Usage (0x9E) 54 | 0x09, 0xDC, // Usage (0xDC) 55 | 0x15, 0x00, // Logical Minimum (0) 56 | 0x25, 0x01, // Logical Maximum (1) 57 | 0x75, 0x01, // Report Size (1) 58 | 0x95, 0x04, // Report Count (4) 59 | 0x91, 0x22, // Output (Data,Var,Abs,No Wrap,Linear,No Preferred State,No Null Position,Non-volatile) 60 | 0x09, 0xD2, // Usage (0xD2) 61 | 0x09, 0xD9, // Usage (0xD9) 62 | 0x15, 0x00, // Logical Minimum (0) 63 | 0x25, 0x01, // Logical Maximum (1) 64 | 0x75, 0x01, // Report Size (1) 65 | 0x95, 0x02, // Report Count (2) 66 | 0x91, 0x06, // Output (Data,Var,Rel,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 67 | 0x95, 0x02, // Report Count (2) 68 | 0x91, 0x01, // Output (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 69 | 0x85, 0x1A, // Report ID (26) 70 | 0x09, 0xB5, // Usage (0xB5) 71 | 0x15, 0x00, // Logical Minimum (0) 72 | 0x25, 0x01, // Logical Maximum (1) 73 | 0x75, 0x01, // Report Size (1) 74 | 0x95, 0x01, // Report Count (1) 75 | 0x91, 0x22, // Output (Data,Var,Abs,No Wrap,Linear,No Preferred State,No Null Position,Non-volatile) 76 | 0x95, 0x07, // Report Count (7) 77 | 0x91, 0x01, // Output (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 78 | 0x85, 0x1B, // Report ID (27) 79 | 0x09, 0xCF, // Usage (0xCF) 80 | 0x09, 0xB5, // Usage (0xB5) 81 | 0x75, 0x01, // Report Size (1) 82 | 0x95, 0x02, // Report Count (2) 83 | 0xB1, 0x22, // Feature (Data,Var,Abs,No Wrap,Linear,No Preferred State,No Null Position,Non-volatile) 84 | 0x09, 0xDE, // Usage (0xDE) 85 | 0x75, 0x01, // Report Size (1) 86 | 0x95, 0x01, // Report Count (1) 87 | 0xB1, 0x23, // Feature (Const,Var,Abs,No Wrap,Linear,No Preferred State,No Null Position,Non-volatile) 88 | 0x09, 0xD8, // Usage (0xD8) 89 | 0x95, 0x01, // Report Count (1) 90 | 0xB1, 0x22, // Feature (Data,Var,Abs,No Wrap,Linear,No Preferred State,No Null Position,Non-volatile) 91 | 0x95, 0x04, // Report Count (4) 92 | 0xB1, 0x01, // Feature (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 93 | 0x09, 0x09, // Usage (0x09) 94 | 0x09, 0x17, // Usage (0x17) 95 | 0x09, 0x18, // Usage (0x18) 96 | 0x09, 0x1E, // Usage (0x1E) 97 | 0x09, 0x20, // Usage (0x20) 98 | 0x09, 0x2A, // Usage (0x2A) 99 | 0x75, 0x01, // Report Size (1) 100 | 0x95, 0x06, // Report Count (6) 101 | 0xB1, 0x22, // Feature (Data,Var,Abs,No Wrap,Linear,No Preferred State,No Null Position,Non-volatile) 102 | 0x95, 0x02, // Report Count (2) 103 | 0xB1, 0x01, // Feature (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 104 | 0x85, 0x1F, // Report ID (31) 105 | 0x09, 0x9C, // Usage (0x9C) 106 | 0x75, 0x01, // Report Size (1) 107 | 0x95, 0x01, // Report Count (1) 108 | 0x81, 0x06, // Input (Data,Var,Rel,No Wrap,Linear,Preferred State,No Null Position) 109 | 0x95, 0x07, // Report Count (7) 110 | 0x81, 0x01, // Input (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) 111 | 0xC0, // End Collection 112 | 113 | // 193 bytes 114 | -------------------------------------------------------------------------------- /windows/test/data/047F_C056_0005_000B_expected.rpt_desc: -------------------------------------------------------------------------------- 1 | 0x05, 0x0B, 0x09, 0x05, 0xA1, 0x01, 0x85, 0x08, 0x09, 0x2F, 2 | 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x01, 0x81, 0x06, 3 | 0x09, 0x20, 0x09, 0x21, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 4 | 0x95, 0x02, 0x81, 0x22, 0x75, 0x05, 0x95, 0x01, 0x81, 0x03, 5 | 0x85, 0x09, 0x05, 0x08, 0x09, 0x09, 0x15, 0x00, 0x25, 0x01, 6 | 0x75, 0x01, 0x95, 0x01, 0x91, 0x22, 0x75, 0x07, 0x95, 0x01, 7 | 0x91, 0x03, 0x85, 0x17, 0x09, 0x17, 0x15, 0x00, 0x25, 0x01, 8 | 0x75, 0x01, 0x95, 0x01, 0x91, 0x22, 0x75, 0x07, 0x95, 0x01, 9 | 0x91, 0x03, 0x85, 0x18, 0x09, 0x18, 0x15, 0x00, 0x25, 0x01, 10 | 0x75, 0x01, 0x95, 0x01, 0x91, 0x22, 0x75, 0x07, 0x95, 0x01, 11 | 0x91, 0x03, 0x85, 0x1E, 0x09, 0x1E, 0x15, 0x00, 0x25, 0x01, 12 | 0x75, 0x01, 0x95, 0x01, 0x91, 0x22, 0x75, 0x07, 0x95, 0x01, 13 | 0x91, 0x03, 0x85, 0x20, 0x09, 0x20, 0x15, 0x00, 0x25, 0x01, 14 | 0x75, 0x01, 0x95, 0x01, 0x91, 0x22, 0x75, 0x07, 0x95, 0x01, 15 | 0x91, 0x03, 0x85, 0x2A, 0x09, 0x2A, 0x15, 0x00, 0x25, 0x01, 16 | 0x75, 0x01, 0x95, 0x01, 0x91, 0x22, 0x75, 0x07, 0x95, 0x01, 17 | 0x91, 0x03, 0xC0, -------------------------------------------------------------------------------- /windows/test/data/047F_C056_0005_000B_real.rpt_desc: -------------------------------------------------------------------------------- 1 | macOS USB Prober about 0x047F/0xC056 "Plantronics Blackwire 3220 Series" 2 | 05 0B 09 05 A1 01 85 08 15 3 | 00 25 01 09 2F 75 01 95 01 81 06 09 20 09 21 75 4 | 01 95 02 81 22 95 05 81 01 05 08 85 09 09 09 95 5 | 01 91 22 95 07 91 01 85 17 09 17 95 01 91 22 95 6 | 07 91 01 85 18 09 18 95 01 91 22 95 07 91 01 85 7 | 1E 09 1E 95 01 91 22 95 07 91 01 85 20 09 20 95 8 | 01 91 22 95 07 91 01 85 2A 09 2A 95 01 91 22 95 9 | 07 91 01 C0 10 | 11 | Parser output: 12 | 0x05, 0x0B, // Usage Page (Telephony) 13 | 0x09, 0x05, // Usage (Headset) 14 | 0xA1, 0x01, // Collection (Application) 15 | 0x85, 0x08, // Report ID (8) 16 | 0x15, 0x00, // Logical Minimum (0) 17 | 0x25, 0x01, // Logical Maximum (1) 18 | 0x09, 0x2F, // Usage (Phone Mute) 19 | 0x75, 0x01, // Report Size (1) 20 | 0x95, 0x01, // Report Count (1) 21 | 0x81, 0x06, // Input (Data,Var,Rel,No Wrap,Linear,Preferred State,No Null Position) 22 | 0x09, 0x20, // Usage (Hook Switch) 23 | 0x09, 0x21, // Usage (Flash) 24 | 0x75, 0x01, // Report Size (1) 25 | 0x95, 0x02, // Report Count (2) 26 | 0x81, 0x22, // Input (Data,Var,Abs,No Wrap,Linear,No Preferred State,No Null Position) 27 | 0x95, 0x05, // Report Count (5) 28 | 0x81, 0x01, // Input (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) 29 | 0x05, 0x08, // Usage Page (LEDs) 30 | 0x85, 0x09, // Report ID (9) 31 | 0x09, 0x09, // Usage (Mute) 32 | 0x95, 0x01, // Report Count (1) 33 | 0x91, 0x22, // Output (Data,Var,Abs,No Wrap,Linear,No Preferred State,No Null Position,Non-volatile) 34 | 0x95, 0x07, // Report Count (7) 35 | 0x91, 0x01, // Output (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 36 | 0x85, 0x17, // Report ID (23) 37 | 0x09, 0x17, // Usage (Off-Hook) 38 | 0x95, 0x01, // Report Count (1) 39 | 0x91, 0x22, // Output (Data,Var,Abs,No Wrap,Linear,No Preferred State,No Null Position,Non-volatile) 40 | 0x95, 0x07, // Report Count (7) 41 | 0x91, 0x01, // Output (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 42 | 0x85, 0x18, // Report ID (24) 43 | 0x09, 0x18, // Usage (Ring) 44 | 0x95, 0x01, // Report Count (1) 45 | 0x91, 0x22, // Output (Data,Var,Abs,No Wrap,Linear,No Preferred State,No Null Position,Non-volatile) 46 | 0x95, 0x07, // Report Count (7) 47 | 0x91, 0x01, // Output (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 48 | 0x85, 0x1E, // Report ID (30) 49 | 0x09, 0x1E, // Usage (Speaker) 50 | 0x95, 0x01, // Report Count (1) 51 | 0x91, 0x22, // Output (Data,Var,Abs,No Wrap,Linear,No Preferred State,No Null Position,Non-volatile) 52 | 0x95, 0x07, // Report Count (7) 53 | 0x91, 0x01, // Output (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 54 | 0x85, 0x20, // Report ID (32) 55 | 0x09, 0x20, // Usage (Hold) 56 | 0x95, 0x01, // Report Count (1) 57 | 0x91, 0x22, // Output (Data,Var,Abs,No Wrap,Linear,No Preferred State,No Null Position,Non-volatile) 58 | 0x95, 0x07, // Report Count (7) 59 | 0x91, 0x01, // Output (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 60 | 0x85, 0x2A, // Report ID (42) 61 | 0x09, 0x2A, // Usage (On-Line) 62 | 0x95, 0x01, // Report Count (1) 63 | 0x91, 0x22, // Output (Data,Var,Abs,No Wrap,Linear,No Preferred State,No Null Position,Non-volatile) 64 | 0x95, 0x07, // Report Count (7) 65 | 0x91, 0x01, // Output (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 66 | 0xC0, // End Collection 67 | 68 | // 109 bytes 69 | -------------------------------------------------------------------------------- /windows/test/data/17CC_1130_0000_FF01_expected.rpt_desc: -------------------------------------------------------------------------------- 1 | 0x06, 0x01, 0xFF, 0x09, 0x00, 0xA1, 0x01, 0x09, 0x01, 0xA1, 2 | 0x02, 0x85, 0x01, 0x09, 0x03, 0x09, 0x03, 0x09, 0x03, 0x09, 3 | 0x03, 0x15, 0x00, 0x25, 0x0F, 0x75, 0x04, 0x95, 0x04, 0x81, 4 | 0x02, 0x09, 0x02, 0x09, 0x02, 0x09, 0x02, 0x09, 0x02, 0x09, 5 | 0x02, 0x09, 0x02, 0x09, 0x02, 0x09, 0x02, 0x09, 0x02, 0x09, 6 | 0x02, 0x09, 0x02, 0x09, 0x02, 0x09, 0x02, 0x09, 0x02, 0x09, 7 | 0x02, 0x09, 0x02, 0x09, 0x02, 0x09, 0x02, 0x09, 0x02, 0x09, 8 | 0x02, 0x09, 0x02, 0x09, 0x02, 0x09, 0x02, 0x09, 0x02, 0x09, 9 | 0x02, 0x09, 0x02, 0x09, 0x02, 0x09, 0x02, 0x09, 0x02, 0x09, 10 | 0x02, 0x09, 0x02, 0x09, 0x02, 0x09, 0x02, 0x09, 0x02, 0x09, 11 | 0x02, 0x09, 0x02, 0x09, 0x02, 0x09, 0x02, 0x09, 0x02, 0x09, 12 | 0x02, 0x09, 0x02, 0x09, 0x02, 0x09, 0x02, 0x09, 0x02, 0x09, 13 | 0x02, 0x09, 0x02, 0x09, 0x02, 0x09, 0x02, 0x09, 0x0B, 0x09, 14 | 0x0B, 0x09, 0x0B, 0x09, 0x0B, 0x09, 0x0B, 0x09, 0x0B, 0x09, 15 | 0x0B, 0x09, 0x0B, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 16 | 0x38, 0x81, 0x02, 0xC0, 0x09, 0x02, 0xA1, 0x02, 0x85, 0x02, 17 | 0x09, 0x04, 0x09, 0x04, 0x09, 0x04, 0x09, 0x04, 0x09, 0x04, 18 | 0x09, 0x04, 0x09, 0x04, 0x09, 0x04, 0x09, 0x04, 0x09, 0x04, 19 | 0x09, 0x04, 0x09, 0x04, 0x09, 0x04, 0x09, 0x04, 0x09, 0x04, 20 | 0x09, 0x04, 0x09, 0x04, 0x09, 0x04, 0x09, 0x04, 0x09, 0x04, 21 | 0x09, 0x04, 0x09, 0x04, 0x09, 0x04, 0x09, 0x04, 0x09, 0x04, 22 | 0x09, 0x04, 0x15, 0x00, 0x26, 0xFF, 0x0F, 0x75, 0x10, 0x95, 23 | 0x1A, 0x81, 0x02, 0xC0, 0x09, 0x80, 0xA1, 0x02, 0x85, 0x80, 24 | 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 25 | 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 26 | 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 27 | 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 28 | 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 29 | 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 30 | 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 31 | 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 32 | 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 33 | 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 34 | 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 35 | 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 36 | 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 37 | 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 38 | 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 39 | 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 40 | 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 41 | 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 42 | 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x15, 0x00, 43 | 0x25, 0x7F, 0x75, 0x08, 0x95, 0x5E, 0x91, 0x02, 0xC0, 0x09, 44 | 0x80, 0xA1, 0x02, 0x85, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 45 | 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 46 | 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 47 | 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 48 | 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 49 | 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 50 | 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 51 | 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 0x81, 0x09, 52 | 0x81, 0x09, 0x81, 0x09, 0x81, 0x15, 0x00, 0x25, 0x7F, 0x75, 53 | 0x08, 0x95, 0x28, 0x91, 0x02, 0xC0, 0x09, 0xD0, 0xA1, 0x02, 54 | 0x85, 0xD0, 0x09, 0xD1, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 55 | 0x08, 0x95, 0x20, 0xB1, 0x82, 0xC0, 0x09, 0xD0, 0xA1, 0x02, 56 | 0x85, 0xD1, 0x09, 0xD1, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 57 | 0x08, 0x95, 0x20, 0xB1, 0x82, 0xC0, 0x09, 0xD0, 0xA1, 0x02, 58 | 0x85, 0xD2, 0x09, 0xD1, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 59 | 0x08, 0x95, 0x20, 0xB1, 0x82, 0xC0, 0x09, 0xD0, 0xA1, 0x02, 60 | 0x85, 0xD3, 0x09, 0xD1, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 61 | 0x08, 0x95, 0x20, 0xB1, 0x82, 0xC0, 0x09, 0xD0, 0xA1, 0x02, 62 | 0x85, 0xD4, 0x09, 0xD1, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 63 | 0x08, 0x95, 0x20, 0xB1, 0x82, 0xC0, 0x09, 0xD0, 0xA1, 0x02, 64 | 0x85, 0xD5, 0x09, 0xD1, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 65 | 0x08, 0x95, 0x20, 0xB1, 0x82, 0xC0, 0x09, 0xD0, 0xA1, 0x02, 66 | 0x85, 0xD6, 0x09, 0xD1, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 67 | 0x08, 0x95, 0x20, 0xB1, 0x82, 0xC0, 0x09, 0xD0, 0xA1, 0x02, 68 | 0x85, 0xD8, 0x09, 0xD1, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 69 | 0x08, 0x95, 0x20, 0xB1, 0x82, 0xC0, 0x09, 0xD0, 0xA1, 0x02, 70 | 0x85, 0xD9, 0x09, 0xD1, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 71 | 0x08, 0x95, 0x20, 0xB1, 0x82, 0xC0, 0x09, 0xD0, 0xA1, 0x02, 72 | 0x85, 0xF1, 0x09, 0xD1, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 73 | 0x08, 0x95, 0x02, 0xB1, 0x82, 0xC0, 0x09, 0xD0, 0xA1, 0x02, 74 | 0x85, 0xF3, 0x09, 0xD1, 0x15, 0x00, 0x25, 0x7F, 0x75, 0x08, 75 | 0x95, 0x02, 0xB1, 0x82, 0xC0, 0xC0, --------------------------------------------------------------------------------