How to configure keyboard and mouse input for a Raspberry Pi 4

It can be useful to have an external keyboard and mouse connected to a Raspberry Pi to use as input to drive the Storyboard application.

I typically use a USB wireless mouse enumerates as both a mouse device and in eventx device.

pi@raspberrypi4:~ $ ls /dev/input

by-id  by-path  event0  event1  event2  event3  event4  event5  mice  mouse0 

Note: You must use the associated eventx and not the mouse0 device.

I can test the mouse input device is what we think simply by using cat to the console and moving the mouse:

pi@raspberrypi4:~ $ cat /dev/input/event1

.9| }(|ý(oî(Uå(/Þ(!à(á(ã(

The keyboard appears as one of the input event devices and can be tested similarly by pressing keys to generate events:

pi@raspberrypi4:~/Crank $ cat /dev/input/event0

Ë;¡e$Ë;¡eË;¡eaF¡e±´

To pass these devices to Storyboard engine you use the dev-input plugin and options:

export OPTIONS=-vvv

$SBENGINE $OPTIONS -odev-input,mouse=/dev/input/event1,kbd=/dev/input/event0 -orender_mgr,fullscreen,scale $SB_APP

Now when Storyboard starts we can see the dev-input plugin options being set and now the keyboard keypresses and mouse clicks can be seen to generate events detected by storyboard.

You can see the associated keyboard and mouse events being logged but in console mode you don't have the default to have the system mouse cursor without a window manager such as Wayland.

However, you should be able to enable it by adding the screen manager option for a software cursor to the launcher command line:

-oscreen_mgr,swcursor

The full command line based on my previous script example above would be as follows to use hardware scaling to full screen, keyboard and mouse input with visible software cursor:

$SBENGINE $OPTIONS -odev-input,mouse=/dev/input/event1,kbd=/dev/input/event0 -orender_mgr,fullscreen,scale -oscreen_mgr,swcursor $SB_APP

Was this article helpful?
0 out of 0 found this helpful