New HAL-component: rawhid (component and firmware for talking to an Arduino)

27 Jan 2021 14:27 #196765 by TOLP2
I'm currently developing a new hal userspace component: rawhid. The goal of this component is to provide access to diy USB HID RAW devices. One can easily create their own HID device using a cheap Arduino and some buttons or encoders to suit their needs, with minimal coding required. The hal component comes with an Arduino sketch with easy-configurable firmware.

Why another HID interface component when LinuxCNC already has hidcomp, hal_input and hal_joystick?
  • rawhid was written to support my home made USB pendant for my gantry router and the control panel for my Emco 5 CNC Retrofit. Both applications have a different number of inputs, while I still want to only maintain one codebase.
  • rawhid supports digital inputs, buttons with built-in debounce, quadrature encoders, digital output (both direct and with a 74HC595 shift/latch register), analog in and analog out (PWM). Configuration is done using a simple Arduino sketch, defining the number and type of inputs and their pins. Future expansions can be easily made by creating new data-packages and code in the component to create the required pins.
  • rawhid exports only pins which are available on the device.
  • rawhid makes it easy to find and configure HID devices. Only the VID and PID of the device are required. NOTE: at this moment multiple devices with the same VID and PID are not supported yet. In the future the Arduino sketch will be expanded with a Serial Number, to prevent awkward changing the VID and PID for the board.
  • rawhid does not rely on any external library (easy to install).[/i]

rawhid is based on the assumption that you create your own pendant based on an Arduino or compatible platform. To connect existing products, such as joysticks, gamepads, multimedia controllers (like the Shuttle Pro), please consider to use hidcomp.

I'll post the progress in this thread. The hal component and the firmware can be found on GitlabGitLab .
The following user(s) said Thank You: andypugh, phillc54, nkp, tommylight, Arpad, aleksamc, Aciera, Bidul, Haarie

Please Log in or Create an account to join the conversation.

15 Jul 2021 11:16 #214843 by JAMSys
I try to install the HAL component but it looks like the component is installed as a library.

I used the following command:
pi@linuxcnc:sudo halcompile --install rawhid.c
Compiling realtime rawhid.c
cp /usr/lib/linuxcnc/modules/

Please advice.

Please Log in or Create an account to join the conversation.

15 Jul 2021 12:15 #214855 by JAMSys
I found a solution, I need to compile with the --userspace flag:

sudo halcompile --install --userspace rawhid.c

Please Log in or Create an account to join the conversation.

15 Jul 2021 12:16 - 15 Jul 2021 12:17 #214856 by Aciera
Last edit: 15 Jul 2021 12:17 by Aciera. Reason: obsolete post

Please Log in or Create an account to join the conversation.

Time to create page: 0.080 seconds
Powered by Kunena Forum