Git Product home page Git Product logo

evdev-mirror's Introduction

Experimental evdev input mirror

When qemu is setup to use exclusive evdev input, it's actually a real pain to read the inputs to your vm from your host machine.

If you don't want to rebuild qemu or linux from source, you're kinda stuck with hooking(maybe if ur a big brain you can do something like register another input listener in the kernel but I tried that and it no work). I think hooking the kernel is better because it seems to almost never change and the symbols are exported with kallsyms.

This is setup just for keypresses/mousebuttons at the moment.

Update Kernel 5.7+

Kernel 5.7 stops the export of kallsyms functions and has forced us to change the way we get symbol addresses.

The new method by heep requires Kernel 5.0 or higher and uses the livepatcher feature.

System Requirements ( approx )

  • 64bit Linux system
  • Kernel Version >= 5.00 ( for kernel livepatcher )
  • The following Kernel Build configurations
    • CONFIG_FTRACE
    • CONFIG_KALLSYMS
    • CONFIG_DYNAMIC_FTRACE_WITH_REGS
    • CONFIG_HAVE_FENTRY
    • CONFIG_LIVEPATCH

Your distro provider probably put a list of your config options in /boot/config*, there's a good chance your kernel already has these options, but if it does not, you'll have to rebuild from source.

  • Kernel headers for your current kernel.
  • elfutils development package ( "elfutils-libelf-devel" for redhat, "libelf-dev" for ubuntu )
  • Development Essentials ( make, gcc, etc. )

Build Instructions

  • After installing kernel headers, you should just be able to use the makefile.
  • make in the cartographer directory.

After the build you can load with insmod evdev_mirror.ko and unload with rmmod evdev_mirror

Why did you take out the timestamp that the other evdev events have

Because that recently got changed in the linux kernel. My VM was on 4.19 and i'm on 4.20 and I was wondering why it wasn't working. ( it was mismatched )

I figured that I didn't really need the timestamp anyway.

The struct is still a standard linux struct, which is also in <linux/input.h>, but it's just an input_value instead of an input_event and the only difference is the missing time.

Overview

  • When inserted into the kernel, it will hook the evdev events function and create /dev/input/evdev-mirror character device
  • You can now read keyboard events from that device, (see the example)

Credits

-Heep for his new method of getting symbol addresses

-Alexey Lozovsky - For his series of articles part1 about ftrace and hooking with ftrace along with code snippets that I used in this project.

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.