I am making a little device that uses a digital encoder to send the key codes for up arrow, down arrow, and Enter (Return) to a Raspberry Pi 4B where it will control a kiosk-like menu system.
The device is built using an Adruino Nano ESP32 and a digital encoder that has a push button action as wells as the encoder function – so it has three switch elements.
The Raspberry Pi 4B Linux is up to date and runs in the GUI mode with Wayland.
I used some example code as the basis for this simple application. I compiled the code on my Mac mini and then uploaded it to the ESP32 using a USB-C connection to theMac. The key functions operate as expected on the Mac. The test case is a few lines of text open in TextEdit. With the encoder I can move the cursor up and down through the text. Pushing the encoder sends a Return code and I see that in the text correctly.
The Raspberry Pi used for testing has a Rasberry Pi keyboard and mouse attached. The problem is the same whether the Pi keyboard and mouse are connected or not.
When I connect this device to a Raspberry Pi nothing at all happens. I don’t see any relevant messages with dmesg or journalctl on the Pi. That is the case both for when I insert the device when the Pi is up and running the text editor, and also when I connect the device with the Pi powered off and. then power it up
Here is some of the code that deals with sending the keyboard code for the return key.
The omitted code deals with setting up and debouncing the switches and is not related to the problem.
I suspect that the problem has something to do with how Linux on the Raspberry Pi deals with newly attached keyboard devices just because the device works correctly with my Mac.
The device is built using an Adruino Nano ESP32 and a digital encoder that has a push button action as wells as the encoder function – so it has three switch elements.
The Raspberry Pi 4B Linux is up to date and runs in the GUI mode with Wayland.
I used some example code as the basis for this simple application. I compiled the code on my Mac mini and then uploaded it to the ESP32 using a USB-C connection to theMac. The key functions operate as expected on the Mac. The test case is a few lines of text open in TextEdit. With the encoder I can move the cursor up and down through the text. Pushing the encoder sends a Return code and I see that in the text correctly.
The Raspberry Pi used for testing has a Rasberry Pi keyboard and mouse attached. The problem is the same whether the Pi keyboard and mouse are connected or not.
When I connect this device to a Raspberry Pi nothing at all happens. I don’t see any relevant messages with dmesg or journalctl on the Pi. That is the case both for when I insert the device when the Pi is up and running the text editor, and also when I connect the device with the Pi powered off and. then power it up
Here is some of the code that deals with sending the keyboard code for the return key.
The omitted code deals with setting up and debouncing the switches and is not related to the problem.
Code:
...#include "USB.h"#include "USBHIDKeyboard.h"...USBHIDKeyboard Keyboard;...void setup(){ ... Keyboard.begin(); USB.begin(); ...}void loop(){ ... Keyboard.press(KEY_RETURN); Keyboard.releaseAll(); ...}Statistics: Posted by wincoder — Fri Jul 04, 2025 2:24 pm