Skip to content

Feature request: expose HID/input devices to Python container via app.yaml #472

Description

@jlooper

Hi, all, I had Claude help me express my problem here; I can PR but thought I'd open an issue first. I'm trying to get a small bluetooth keyboard and a small LCD screen to talk to each other via the Arduino Uno Q.

Problem

The Python app container runs as uid=1000 and does not have access to /dev/input/eventX
devices because:

  1. The input group (gid 995) is not included in group_add in the generated app-compose.yaml
  2. Major device 13 (input devices) is not whitelisted in device_cgroup_rules

There is currently no supported way to grant the Python container access to keyboard, mouse,
or other HID input devices without manually editing .cache/app-compose.yaml on every run —
which gets overwritten each time the app starts.

Use Case

Reading keypresses from a Bluetooth keyboard connected to the UNO Q to build interactive apps:

  • Keyboard-driven TFT display terminal
  • Text prompt interface for a local LLM (e.g. Ollama)
  • Any app that needs physical input without a touchscreen or web UI

Reproducing the Problem

# In main.py — always fails with Operation not permitted
fd = open('/dev/input/event3', 'rb')

Even with chmod 666 /dev/input/eventX on the host, the container still returns
[Errno 1] Operation not permitted because major device 13 is not in device_cgroup_rules.

Confirmed via:
Running as uid=1000 gid=1000

Groups: [20, 29, 44, 991, 1000, 1001] # input group 995 missing

event3 stat: mode=0o20666 uid=0 gid=995

Open failed: [Errno 1] Operation not permitted

Proposed Solution

Add an input_devices: true option to app.yaml that injects the following into the
generated app-compose.yaml:

services:
  main:
    group_add:
      - 995  # input group
    device_cgroup_rules:
      - "c 13:* rmw"  # HID/input devices major number

This follows the same pattern already used for other device types in the existing
app-compose.yaml:

device_cgroup_rules:
  - c 226:* rmw
  - c 250:* rmw
  - c 504:* rmw
  - c 81:* rmw
  - c 116:* rmw

Current Workaround

A systemd service on the host reads /dev/input/eventX and forwards keypresses to a named
pipe at /dev/keyboard_input, which the container reads via the existing /dev bind mount.
This works but requires manual SSH setup outside of App Lab and is fragile when the Bluetooth
keyboard reconnects on a different event number.

Environment

  • Board: Arduino UNO Q
  • App Lab version: arduino-app-cli version → 0.11.1
  • Input device: Bluetooth keyboard via USB dongle, appears as /dev/input/eventX

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions