Giter Site home page Giter Site logo

hotplug-evdev-passthrough's Introduction

Intro

QEMU evdev passthrough stops if the physical keyboard and mouse are disconnected, but does not restart when they are reconnected. This can be a problem when using a KVM switch.

This project dynamically attaches physical devices to virtual devices. The physical devices can be disconnected and reconnected, but the virtual devices remain connected. This provides a workaround to the problem described above.

Setup

Find the physical devices to handle with ls -alh /dev/input/by-id/. Find their associated path with ls -alh /dev/input/by-path/. Configure config.yaml with the devices paths.

Add the user to the input group.

sudo usermod -a -G input user

Add the following udev rules, for instance in /etc/udev/rules.d/80-virtual-input.rules.

ACTION=="add", SUBSYSTEM=="input", ATTRS{phys}=="py-evdev-uinput", ATTRS{name}=="virtual-keyboard", SYMLINK+="input/by-id/virtual-keyboard"
ACTION=="add", SUBSYSTEM=="input", ATTRS{phys}=="py-evdev-uinput", ATTRS{name}=="virtual-mouse", SYMLINK+="input/by-id/virtual-mouse"

Set up the environment.

virtualenv -p python3 venv
source venv/bin/activate
pip install -r requirements.txt

Start the program.

python3 start.py

The following input devices should be available.

  • /dev/input/by-id/virtual-mouse
  • /dev/input/by-id/virtual-keyboard

The program should capture events on the pysical devices, and re-emit from the virtual devices. You can verify with evtest.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.