A Crystal interface to HIDAPI library.
It works on Linux and macOS.
-
Add the dependency to your
shard.yml
:dependencies: crystal-hidapi: github: mamantoha/crystal-hidapi
-
Run
shards install
You need to install the development package for hidapi
- macOS:
brew install hidapi
- Arch Linux:
pacman -S hidapi
- Ubuntu:
apt install libhidapi-dev
require "crystal-hidapi"
Explore the following examples:
- Retrieve battery level for Sony PlayStation 5 DualSense controller
- Fetch battery capacity and status for Sony DualShock4 (2nd gen) controller
crystal ./lib/crystal_lib/src/main.cr src/hidapi/lib_hidapi.cr.in > src/hidapi/lib_hidapi.cr
- Fork it (https://github.com/mamantoha/crystal-hidapi/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
- Anton Maminov - creator and maintainer