{"id":14761687,"url":"https://github.com/todbot/hidapitester","last_synced_at":"2025-04-06T07:14:09.935Z","repository":{"id":39911227,"uuid":"190811985","full_name":"todbot/hidapitester","owner":"todbot","description":"Simple command-line program to test HIDAPI","archived":false,"fork":false,"pushed_at":"2024-05-20T20:26:26.000Z","size":754,"stargazers_count":289,"open_issues_count":9,"forks_count":34,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-03-30T06:06:35.845Z","etag":null,"topics":["hid","hidapi","usb"],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/todbot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-07T21:40:10.000Z","updated_at":"2025-03-25T06:04:07.000Z","dependencies_parsed_at":"2024-05-20T21:42:28.136Z","dependency_job_id":"8d35a99a-0a74-4515-b4e0-6627d58403a2","html_url":"https://github.com/todbot/hidapitester","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/todbot%2Fhidapitester","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/todbot%2Fhidapitester/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/todbot%2Fhidapitester/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/todbot%2Fhidapitester/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/todbot","download_url":"https://codeload.github.com/todbot/hidapitester/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247445680,"owners_count":20939961,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hid","hidapi","usb"],"created_at":"2024-09-15T21:01:00.566Z","updated_at":"2025-04-06T07:14:09.916Z","avatar_url":"https://github.com/todbot.png","language":"C","funding_links":[],"categories":["HarmonyOS","C"],"sub_categories":["Windows Manager"],"readme":"# hidapitester\n\nSimple command-line program to exercise HIDAPI\n\n[![Build Status linux](https://github.com/todbot/hidapitester/actions/workflows/linux.yml/badge.svg)](https://github.com/todbot/hidapitester/actions?query=workflow%3Alinux)\n[![Build Status macos](https://github.com/todbot/hidapitester/actions/workflows/macos.yml/badge.svg)](https://github.com/todbot/hidapitester/actions?query=workflow%3Amacos)\n[![Build Status windows](https://github.com/todbot/hidapitester/actions/workflows/windows.yml/badge.svg)](https://github.com/todbot/hidapitester/actions?query=workflow%3Awindows)\n\n\nThe goal of the `hidapitester` program is to provide a simple,\nlow-dependency command-line tool to test out every API call in\n[hidapi](https://github.com/libusb/hidapi).\nDefault builds are fully-static with no requirements on a system-installed `hidapi`.\n\n\u003cimg src=\"./docs/screencast1a.gif\" width=\"500\"\u003e\n\n## Table of Contents\n\n  * [Prebuilt binaries](#prebuilt-binaries)\n  * [Usage](#usage)\n     * [Listing Devices](#listing-devices)\n     * [Opening Devices](#opening-devices)\n     * [Reading and Writing Reports](#reading-and-writing-reports)\n  * [Examples](#examples)\n     * [Test Hardware](#test-hardware)\n  * [Compiling](#compiling)\n     * [Platform-specific requirements](#platform-specific-requirements)\n        * [Mac](#mac)\n        * [Windows](#windows)\n        * [Linux](#linux)\n\n## Prebuilt binaries\n\nSee the [hidapitester releases page](https://github.com/todbot/hidapitester/releases)\nfor builds for:\n\n- Mac OS X (Intel and M1)\n- Linux (Ubuntu x64 and Raspberry Pi)\n- Windows 64-bit\n\n## Usage\n\n`hidapitester` works by parsing a list of arguments as commands it executes in order.\nThose commands are:\n\n```text\n  --vidpid \u003cvid/pid\u003e          Filter by vendorId/productId (comma/slash delim)\n  --usagePage \u003cnumber\u003e        Filter by usagePage\n  --usage \u003cnumber\u003e            Filter by usage\n  --list                      List HID devices (by filters)\n  --list-usages               List HID devices w/ usages (by filters)\n  --list-detail               List HID devices w/ details (by filters)\n  --open                      Open device with previously selected filters\n  --open-path \u003cpathstr\u003e       Open device by path (as in --list-detail)\n  --close                     Close currently open device\n  --get-report-descriptor     Get the report descriptor\n  --send-feature \u003cdatalist\u003e   Send Feature report (1st byte reportId, if used)\n  --read-feature \u003creportId\u003e   Read Feature report (w/ reportId, 0 if unused)\n  --send-output \u003cdatalist\u003e    Send Ouput report to device\n  --read-input                Read Input reports\n  --read-input-forever        Read Input reports in a loop forever\n  --read-input-report \u003creportId\u003e  Read Input report from specific reportId\n  --length \u003clen\u003e, -l \u003clen\u003e    Set buffer length in bytes of report to send/read\n  --timeout \u003cmsecs\u003e           Timeout in millisecs to wait for input reads\n  --base \u003cbase\u003e, -b \u003cbase\u003e    Set decimal or hex buffer print mode\n  --quiet, -q                 Print out nothing except when reading data\n  --verbose, -v               Print out extra information\n```\n\n### Listing Devices\n\n* `--list` shows devices similar to `lsusb`\n* `--list-usages` includes usagePage and usage attributes\n* `--list-detail` shows all available information,\nincluding usagePage, usage, path, and more\n* Use `--vidpid`, `--usagePage`, or `--usage` to filter the output\n\n* The `--vidpid` commmand allows full or partial specification of the\nVendor Id and Product Id.  These are all valid:\n\n```text\n  --vidpid 16C0:FFAB  # specify both vid 0x16C0 and pid 0xFFAB\n  --vidpid 16C0       # just specify the vid\n  --vidpid 0:FFAB     # just specify the pid\n  --vidpid 16C0:FFAB  # use colon instead of slash\n```\n\n### Opening Devices\n\nYou must `--open` before you can `--read-input`. You can also `--read-input`\nmultiple times, or `--open` one device, `--close` it, and `--open` another.\n\nThe `--open` command will take whichever of VID, PID, usagePage, and usage are\nspecified.  So these are valid:\n\n```text\nhidapitester --vidpid 16C0 --usagePage FFAB --open      # specify vid and usagePage\nhidapitester --usage FFAB --open                        # specify only usagePage\nhidapitester --0/0486  --open                           # specify only pid\nhidapitester --vidpid 16C0/486 --usagePage FFAB --open  # specify vid,pid,usagePage\n```\n\n### Reading and Writing Reports\n\nGet the report descriptor with `--get-report-descriptor`.\n\nSend Output reports to devices with `--send-output`. The argument to the command\nis the data to send: `--send-output 1,2,0xff,30,40,0x50`.\nIf using reportIds, the first byte is the reportId.\nIf not using reportIds, the first byte should be `0`.\nThe length of the actual report is set by `--length \u003cnum\u003e`.\n\nThus to send a 16-byte report on reportId 3 with only the 1st byte set to \"42\":\n\n```text\nhidapitester [...] --length 16 --send-output 3,42\n```\n\nSend Feature reports the same way with `--send-feature`.\n\nRead Input reports from device with `--read-input`.  If using reportIds,\nuse `--read-input-report n` where the `n` argument is the reportId number:\ne.g.  `--read-input 1`.  The length to read is specified by the `--length` argument.\nIf using reportIds, this length should be one more than the buffer to read\n(e.g. if the report is 16-bytes, length is 17).\n\nSo to read a 16-byte report on reportId 3:\n\n```text\nhidapitester [...] --length 17 --read-input-report 3\n```\n\n## Examples\n\nGet version info from a blink(1):\n\n```text\nhidapitester --vidpid 0x27b8/0x1ed --open --length 9 --send-feature 1,99,0,255,0  --read-feature 1 --close\nOpening device at vid/pid 27b8/1ed\nSet buflen to 9\nWriting 9-byte feature report...wrote 9 bytes\nReading 9-byte feature report, report_id 1...read 8 bytes\nReport:\n0x0, 0x63, 0x0, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0,\nClosing device\n```\n\nSend data to/from \"TeensyRawHid\" sketch:\n\n```text\nhidapitester --vidpid 16C0 --usagePage 0xFFAB --open --send-output 0x4f,33,22,0xff  --read-input\nOpening device, vid/pid:0x16C0/0x0000, usagePage/usage: FFAB/0\nDevice opened\nWriting output report of 64-bytes...wrote 64 bytes:\n 4F 21 16 FF 00 00 00 00 00 00 00 00 00 00 00 00\n 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\nReading 64-byte input report, 250 msec timeout...read 64 bytes:\n AB CD 01 67 01 6F 01 93 01 94 01 A6 01 AA 01 67\n 01 82 01 7D 01 79 01 18 01 0B 00 00 00 00 00 00\n 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n 00 00 00 00 00 00 00 00 00 00 00 00 00 00 09 91\nClosing device\n```\n\n### Test Hardware\n\n- The \"TeensyRawHid\" directory contains an Arduino sketch for\n[Teensy microcontrollers](https://www.pjrc.com/teensy/).\nThe sketch sends 64-byte Input reports every second, with no reportId.\nThe sketch receives 64-byte Output reports, and prints them to Serial Monitor.\n\n- The \"ProMicroRawHID\" directory contains an Arduino sketch for any microcontroller\nboard supported by NicoHood's [HID Project](https://github.com/NicoHood/HID)\nThis sketch sends a 64-byte Input report every 2 seconds, with no reportId.\nThe sketch recives 64-byte Output or Feature reports, and prints them\nto Serial Monitor\n\n## Compiling\n\nBuilding `hidapitester` is done via a very simple Makefile.\n\n```text\ngit clone https://github.com/libusb/hidapi\ngit clone https://github.com/todbot/hidapitester\ncd hidapitester\nmake\n```\n\n`hidapitester` will use a copy of `hidapi` located next to it in the directory hierarchy.\nIf you install `hidapi` in a different directory, you can set the Makefile\nvariable `HIDAPI_DIR` before invoking `make`:\n\n```text\n# hidapi is in dir 'hidapi-libusb-test'\ncd hidapitester\nHIDAPI_DIR=../hidapi-libusb-test make clean\nHIDAPI_DIR=../hidapi-libusb-test make\n./hidapitester --list\n```\n\n### Platform-specific requirements\n\n#### Mac\n\n- Install XCode\n- Specifically, Command-line Tools\n\n```text\nsudo xcode-select --install\n```\n\n#### Windows\n\n- Install MSYS2\n- Build in a MinGW / MSYS2 window\n\n#### Linux\n\n- Install udev, pkg-config\n\n```text\nsudo apt install libudev1 libudev-dev pkg-config\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftodbot%2Fhidapitester","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftodbot%2Fhidapitester","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftodbot%2Fhidapitester/lists"}