[PD] hid objects on linux/mac/win? hidraw on linux? hidraw parsing?

Albert Rafetseder albert.rafetseder at univie.ac.at
Wed Mar 13 08:11:04 CET 2024


Dear Peter & all,

> On Linux I can install [hidraw] 0.1.0 via Deken. The external loads
> without errors, but I am not getting any response clicking the
> "listdevices" message.

As Lucas reported in the other thread, this works just fine for me. (Do 
you see any USB devices, HID or not, when you `lsusb -v` on the command 
line?)



> Colleagues have tried to find [hid] for their newer apple cpu's
> without success unless they start Pd under the Rosetta emulation and
> install Albert's amd64-32 package.

Good to know, and sorry for making you depend on Rosetta. I don't have 
much time to finally get the build system for [hid] updated, nor have 
access to Apple Silicon. Some kind soul on this list even offered to 
compile things for me -- I've gotten nowhere with the required thinking 
and coding since, I apologize!



> Interestingly there exists a hid Deken package for Darwin-arm64-32
> http://deken.puredata.info/library/hid/0.1.0
> but it is not displayed in Pd's built-in search engine on OS X as far 
> as
> I can remember (maybe someone can check this?).

Deken on pd 0.52.1 (a self-built version IIRC) on Linux, when configured 
to *not* hide packages for foreign platforms, gives me this:

hid[v0.1.0](Darwin-arm64-32).dek
	Uploaded by critapec @ 2022-11-09 00:32:28

> On Windows there is only [hidraw], correct?

At least there is no [hid]. The sources and makefile include mentions of 
"cygwin", but I don't have a Windows machine either. Even if I could 
build it with mingw, I couldn't test.



> General question:
> What would be a reason to prefer [hidraw] over [hid]?

Quoting a previous thread on this list, 
https://lists.puredata.info/pipermail/pd-list/2022-11/131618.html

"""
My comparison AFAICT (from working on [hid] a little [...]):

[hidraw]
* is more cross-platform, including Windows
* has a way more modern code base and build system
* offers less "semantic" output -- in the sense that [hidraw] gives you
event codes that you process in your patch yourself, whereas [hid]
decodes many of the possible button presses and other events
* uses an external library, libusb/hidabi, for its functions -- [hid]
only uses OS functions and headers iirc
"""

The mail goes on to suggest the creation of a wiki page "or other 
documentation item [...] listing the different possibilities of working 
with USB HID devices in Pd."

I sat down and tried my hand at this, what do you think? 
https://puredata.info/Members/albert/USB

Suggestions welcome, both content-wise and in terms where to best put 
this.



> How do I parse the output of [hidraw]?

My own dabblings with [hidraw] have followed this approximate path:
* Try to get data off the USB device at all
* Then play around and see what values the different buttons, knobs, 
.... will send
* Construct a patch to translate from raw HID data to useful Pure Data 
control lines.

Best regards,
   Albert.





More information about the Pd-list mailing list