Provided by: linuxcnc-uspace_2.9.4-2ubuntu1_amd64 bug

NAME

       sendkeys - send input events based on pins or scancodes from HAL

SYNOPSIS

       loadusr sendkeys config=s8t5, 16, t12

DESCRIPTION

       This component is intended as a partner component to matrix_kb or the hostmot2 7i73 driver. It accepts
       the key-up and key-down event codes from either of these and converts them to keystrokes sent from a
       virtual keyboard.

       It also allows for keystrokes to be generated by individual HAL pins.

       The config parameter to the loadusr HAL command defines how many scancodes will be supported and how many
       individual pins are created. config=s16 would support the 16 scancodes of a 4x4 matrix. config=t10 would
       create 10 individual HAL pin triggers. config=s16t10 would create one instance with both the above.

       Multiple configs separated by commas will create multiple instances of the component. The accepted codes
       can be seen in the extract from the linux headers here:
       https://wiki.linuxcnc.org/cgi-bin/wiki.pl?Scancodes

       The component requires the user to have write permissions to /dev/uinput which is not available by
       default. 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. You can test that is has 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.

       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).

       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.

       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

LICENSE

       GPL-2.0+

LinuxCNC                                           06/19/2025                                        SENDKEYS(1)