Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document keyboard udev rule #2

Open
joonas-fi opened this issue Apr 3, 2021 · 0 comments
Open

Document keyboard udev rule #2

joonas-fi opened this issue Apr 3, 2021 · 0 comments
Labels
documentation Improvements or additions to documentation

Comments

@joonas-fi
Copy link
Member

joonas-fi commented Apr 3, 2021

Why is it a hardlink: tl;dr: hotplug support.

If you don't want to run screen-server with --privileged (you shouldn't), and you don't want to bind the entire /dev/input (violates principle of least privilege), you're left with having to map a directory that contains the sole event device. It has to be directory, because device nodes come and go (hotplug). i.e. plug creates inode 1 -> disconnect -> plug creates inode 2. If you'd naively map --device /dev/input/logitech and start a container, during the whole lifecycle of the container it'd refer to inode 1.

Here's my /etc/udev/rules.d/80-screen-server.rules:

# Logitech should be visible for screen-server

ACTION=="add", KERNEL=="event[0-9]*", ATTRS{name}=="Logitech K400", RUN+="/bin/sh -c 'mkdir -p /dev/input/screen-server && ln $devnode /dev/input/screen-server/logitech'"
ACTION=="remove", KERNEL=="event[0-9]*", ATTRS{name}=="Logitech K400", RUN+="/bin/sh -c 'rm /dev/input/screen-server/logitech'"

And docker-compose file:

version: "3.5"
services:
  screens:
    labels:
      traefik.frontend.rule: Host:screens.mydomain.com
    environment:
      SCREEN_1: "5900,800,1280,Galaxy Tab 2,/dev/input/screen-server/logitech"
    image: fn61/screen-server:20201218_1758_3beeef8d
    shm_size: 512M # Firefox and Chrome crash on default (64 M) if website is heavy in any way
    ports:
      - "5900:5900"
    devices:
    - "/dev/input/screen-server"
    networks:
      default: null
networks:
  default:
    external:
      name: mynetwork
@joonas-fi joonas-fi added the documentation Improvements or additions to documentation label Apr 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant