项目作者: JmirY

项目描述 :
Virtual KM switch for Linux-hosted VMs
高级语言: C++
项目地址: git://github.com/JmirY/HID-Porter.git
创建时间: 2019-11-21T05:52:20Z
项目社区:https://github.com/JmirY/HID-Porter

开源协议:GNU General Public License v2.0

下载


HID-Porter

Virtual KM switch for Linux-hosted VMs.

User can send mouse/keyboard input to VM selectively.


Prerequisites

  • Configfs
    This file system has to be mounted somewhere.
    Recent linux kernel already mounts configfs at /sys/kernel/config .
    However,
    /config is recommended as mount point.

    Gadget-builder script consider /config as mount point of configfs by default.
    User can change it by editing util/gadget-builder.sh

  • Linux kernel module

    • libcomposite
    • dummy_hcd

      The maximum number of dummy HCD can be created is 2 by default.

      1. Should change module source to expand limit.

Configfs and module dummy_hcd may be disbaled for default kernel user.
User should edit kernel configuration to enable those.

How to Build

Use g++ with -pthread option

  1. $ g++ -o HID-Porter < src > -pthread

How to Use

  1. # run as root user
  2. $ sudo ./HID-Porter
  3. <<<<< HID-Porter >>>>>
  4. # input host HID node path
  5. --> Input info about host
  6. --> Mouse device node : /dev/hidraw0
  7. --> Keyboard device node : /dev/hidraw1
  8. --> How many VMs want to attach? (up to 9): 2
  9. # input gadget device node path
  10. --> Input info about guest no.1
  11. --> Gadget mouse device node : /dev/hidg0
  12. --> Gadget keyboard device node : /dev/hidg2
  13. --> Input info about guest no.2
  14. --> Gadget mouse device node : /dev/hidg1
  15. --> Gadget keyboard device node : /dev/hidg3
  16. # As HID-Porter initiated properly,
  17. # message will be printed as below
  18. --> Porters are working :)

Use Alt + “number key” to switch active system.
As an example,
Alt + 1 -> Host
Alt + 2 -> Guest no.1
Alt + 3 -> Guest no.2
. . .

Send SIGINT ( Ctrl + C ) to stop the program.