SENDKEYS(1)

πŸ“¦
version 2.9.4 Β· 3 versions
, in ubuntu resolute, ubuntu stonking

πŸ’– SENDKEYS(1) β€” LinuxCNC Documentation πŸ’–

okay bestie, gather round, because this one is so useful and also a little bit extra. welcome to sendkeys, a page from the LinuxCNC docs, and yes we're gonna get through all of it together. grab a snack. πŸ“

✨ NAME ✨

sendkeys β€” send input events based on pins or scancodes from HAL. that's the whole vibe. πŸ¦‹

🌸 SYNOPSIS 🌸

loadusr sendkeys config=s8t5, 16, t12

πŸ‘‘ DESCRIPTION πŸ‘‘

So basically, this component is designed to be the little partner-in-crime to matrix_kb or the hostmot2 7i73 driver. It takes the key-up and key-down event codes from either of those and turns them into actual keystrokes, sent out from a virtual keyboard. it's giving translator, it's giving bridge. πŸ’…

It also lets you generate keystrokes straight from individual HAL pins, which is honestly so handy.

The config parameter on the loadusr HAL command is the main character here β€” it decides how many scancodes get supported and how many individual pins get created. Let's break it down:

  • config=s16 would support the 16 scancodes of a 4x4 matrix. slay.
  • config=t10 would create 10 individual HAL pin triggers. also slay.
  • config=s16t10 creates one instance with both of the above combined. iconic.

Multiple configs separated by commas will create multiple instances of the component. and if you want to see the accepted codes, they're in the extract from the linux headers right here: https://wiki.linuxcnc.org/cgi-bin/wiki.pl?Scancodes


🚨 permissions check, bestie 🚨

The component needs you to have write permissions to /dev/uinput, which you do NOT have by default. no cap. To give access:

Create the uinput group and add the LinuxCNC user to it:

sudo groupadd -f uinput
sudo gpasswd -a username uinput

Create a new entry in .B/etc/udev/rules.d/99-input.rules

sudo echo KERNEL=="uinput", GROUP="uinput", MODE:="0660" | sudo tee /etc/udev/rules.d/88-input.rules

Then reboot the machine. yes really. and you can test that it worked:

ls -l /dev/uinput
crw-rw---- 1 root uinput 10, 223 Nov 11 15:35 /dev/uinput

It is possible to link the 7i73 codes to both the matrix_kb comp and this comp, so that some codes operate HAL pins and some send keystrokes. Where the option exists it is MUCH better to use HAL pins for things like jogging and machine control. This component should really be used only for text entry and GUI operations. fr fr, don't come for me, that's just what the docs say. 🫢

Each key on the matrix is allocated a scan code. The simplest way to configure the component is to load the component and open a halmeter showing sendkeys.0.current-event. Note the code for each physical key. (If keys do not give consistent results then you probably need to toggle the value of the matrix_kb.0.negative-logic pin and/or invert io pins). classic troubleshooting moment, you got this. πŸ™ˆ

Then edit the HAL file to assign a key event to each scancode. For example:

setp sendkeys.0.scan-event-21 34

To set a button to type the letter "G" β€” the key events related to each physical key need to be set up prior to the component activating, but after the component is loaded. yes, that specific window. πŸŽ€

To achieve this there is a pin sendkeys./N/.init which should be set to "true" once the events to be sent for each scancode and pin have been set up.

To generate keystrokes from other sources, note that a keydown is simply 0xC0 & keycode and keyup is 0x80 & keycode.

✨ PINS ✨

  • sendkeys.N.keycode u32 in β€” Connect to scancode generator.
  • sendkeys.N.current-event s32 out β€” shows the current scancode without keyup / keydown markers.
  • sendkeys.N.init bit in β€” set this pin TRUE once all the event parameters have been set.

πŸ’œ PARAMETERS πŸ’œ

  • sendkeys.N.scan-event-MM u32 in β€” assign the uinput event codes associated with each scancode.
  • sendkeys.N.pin-event-MM u32 in β€” assign the uinput codes associated with each HAL bit pin.

🌈 EXAMPLE 🌈

loadusr -W sendkeys config=16t2
net scancodes hm2_7i73.0.0.keycode => sendkeys.0.keycode

setp sendkeys.0.scan-event-00 34 # Key G
setp sendkeys.0.scan-event-01  2 # Key 1
setp sendkeys.0.scan-event-02  3 # Key 2
setp sendkeys.0.scan-event-03  4 # Key 3
setp sendkeys.0.scan-event-04 50 # Key M
setp sendkeys.0.scan-event-05 05 # Key 4
setp sendkeys.0.scan-event-06 06 # Key 5
setp sendkeys.0.scan-event-07 07 # Key 6
setp sendkeys.0.scan-event-08 31 # Key S
setp sendkeys.0.scan-event-09  8 # Key 7
setp sendkeys.0.scan-event-10  9 # Key 8
setp sendkeys.0.scan-event-11 10 # Key 9
setp sendkeys.0.scan-event-12 20 # Key T
setp sendkeys.0.scan-event-13 11 # Key 0
setp sendkeys.0.scan-event-14 52 # Key Dot
setp sendkeys.0.scan-event-15 14 # Backspace
setp sendkeys.0.pin-event-00 29 # Left Ctrl
setp sendkeys.0.pin-event-01 57 # Space
setp sendkeys.0.init 1

#Send Ctl + Space from one trigger
net clear-errors parport.0.pin.00.in sendkeys.0.trigger-00 sendkeys.0.trigger-01

🫢 AUTHOR 🫢

Andy Pugh β€” thank you for your service, king. πŸ‘‘

⭐ LICENSE ⭐

GPL-2.0+ β€” free as in freedom, bestie.


and that's the whole page! this one came out with the LinuxCNC docs, dated 03/17/2026, and it's living in the SENDKEYS(1) section of the manual. go forth and send some keys. πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from