As the trackball on the uConsole can be tricky, i used the YXBA buttons to move the cursor for more refined movements. This is done via ydotool and ydotoold in order to work with wayland.
References
Important to know that ydotool should be built from source in order to provide relative mouse movements.
Once built and installed, ydotoold should be started as root listening to a socket file, but changing socket ownershop to a target user. I added the following to rc.local
/usr/local/bin/ydotoold --socket-path="/tmp/.ydotool_socket" --socket-own="1002:1002" &
The user is also added to the input user group to ensure that the events can be read from the device correctly.
An app (keyscan) that listens to the input events from the keyboard then maps the keys to move the mouse cursor. The select key is also mapped to toggle a larger mouse movement via another script mousemove_m.sh.
my $device = "/dev/input/by-id/usb-ClockworkPI_uConsole_20230713-event-joystick";
[...some code ...]
288 => 'mousemove.sh up',
289 => 'mousemove.sh right',
290 => 'mousemove.sh down',
291 => 'mousemove.sh left',
296 => 'mousemove_m.sh',
The mousemove.sh script is used to actually move the mouse.
#!/bin/bash
if [ -e "/tmp/mousekey.tmp" ]; then
MM=40
else
MM=8
fi
case "$1" in
up)
# echo "You chose UP"
# Put your actual command here
ydotool mousemove -x 0 -y -$MM
;;
down)
# echo "You chose DOWN"
# Put your actual command here
ydotool mousemove -x 0 -y $MM
;;
left)
# echo "You chose LEFT"
# Put your actual command here
ydotool mousemove -x -$MM -y 0
;;
right)
# echo "You chose RIGHT"
# Put your actual command here
ydotool mousemove -x $MM -y 0
;;
*)
echo "Usage: $0 {up|down|left|right}"
exit 1
;;
esac