Auto-connect request of `hardware-observe` and `raw-input` for `fingerpaint`

Hello :slight_smile:

I recently published Fingerpaint on Snapcraft, and I would like that the app to work out of the box (without manual connections).

The app allows you to draw using your touchpad, using it as a canvas (that means getting raw/absolute touch data from the sensor).

In order to do that I need:

  • The raw-input plug (for access to /dev/input/eventX)
  • The hardware-observe plug (for navigating /sys to know which device is the touchpad)

In addition, I add a udev rule (ENV{ID_INPUT_TOUCHPAD}=="1", MODE="0664") that allows non-root users to access this device (I consider this ok privacy-wise since it’s just a touchpad, not a keyboard, and since getting this data is rather trivial anyway when not running in a confined snap).

Adding the udev rule is handled by prompting the user to run a setup script as root (outside the sandbox) if the device is inaccessible.

Thanks :slight_smile:

From what I can tell from the snap’s description:

Your touchpad will not control the cursor while drawing, though external mice should still work

I assume that this snap takes the raw-input from the device rather than using the higher-level input interfaces provided by wayland / X etc? And so that is why it needs this low-level access?

Can you also explain more about the udev rule? What exactly do you prompt the user to do in this case? How does the snap handle removing this udev rule when it is uninstalled? Would it be better to instead ask the user to say add themselves to the input group? Or to split your snap into a privileged daemon that can run as root and access the device file directly and then have the frontend user-facing part communicate with the daemon to get the input events through it? Then a user should not have to do anything.