项目作者: tschiemer

项目描述 :
USB HID external for PureData (PD)
高级语言: C
项目地址: git://github.com/tschiemer/hid-pd-external.git
创建时间: 2021-03-18T15:34:59Z
项目社区:https://github.com/tschiemer/hid-pd-external

开源协议:GNU General Public License v3.0

下载


hid-pd-external

An USB HID external for PureData (PD)

Note the current version only outputs raw values as received from the HID -
HID descriptor input item specifics (such as min/max, units, exponentials, etc)
are not respected. This is not yet implemented in the underlaying USB-HID-Report-Parser.

Built and tested on macos 10.15.7.
Tested RPi 4 (5.10.17-v7l+), in principle works but is suboptimal.

hid-example.pd

Todos

  • Add output report support
  • Feature reports?
  • Use hidraw instead of libusb (see note under linux)

Binaries

See https://github.com/tschiemer/hid-pd-external/releases

Building

macos

Install dependencies:

  1. brew install libusb hidapi

Compile:

  1. git clone --recursive https://github.com/tschiemer/hid-pd-external
  2. cd hid-pd-external/
  3. make -f Makefile.macos && make -f Makefile.macos install

linux (Raspberry Pi)

NOTE as it is, using libusb (in this external) on linux is somewhat invasive on USB devices as kernel
drivers might be detached for this to work. Using hidraw (as offered by hidapi) this seems to work without
further problem, but this is something that remains to be done.

Make sure to install required libraries:

  1. sudo apt install libusb-1.0-0-dev libhidapi-dev
  1. git clone --recursive https://github.com/tschiemer/hid-pd-external
  2. cd hid-pd-external/
  3. make -f Makefile.linux
  4. sudo make -f Makefile.linux install

NOTE Your user will have to get direct access to HID devices, if you know which device it is, you can do something like

  1. sudo chmod 777 /dev/bus/usb/001/003

In principle you could set up udev to do this for you (but didn’t work for me).

hid object interface

  • list [vendorid <vendor-id>] [productid <product-id>] [serial <serial-str>] [usage_page <usage-page>] [usage <usage>]

Output any HID devices matching the given criteria in the form of:

device <usage-page> <usage> <vendor-id> <product-id> <serial-str> <manufacturer-str> <product-str>

If serial-str, manufacturer-str or product-str is not defined by the device will return a dash -.

  • open [vendorid <vendor-id>] [productid <product-id>] [serial <serial-str>] [usage_page <usage-page>] [usage <usage>]

Attempts to open first device matching given criteria for interaction.

Outputs opened message on success.

  • close

Closes previously opened device.

  • bang / poll <msec>

Output/process incoming reports and output changed values in the form of

value <usage-page> <usage> <value>

If polling (<msec> > 0) is enabled banging is not possible, to disable polling set <msec> equal zero.

License

Copyright 2021 ICST Institute for Computer Music and Sound
Technology, Zurich University of the Arts
All rights reserved.

GNU General Public License v3

Author Philip Tschiemer, https://github.com/tschiemer

Relies on (also see deps):