Virtual Input manger uses uinput framework to create virtual/user-space input devices & virtio-input infrastructure from QEmu to map the devices on virtual machines

How to Compile

Prerequisite:

  • Required minimum gcc version is 7.4.0 or Ubuntu 18.04 release of Ubuntu Host

Compile:

  • $make clean
  • $make
  • Compilation generates vinput-manager & sendkey executables.

Follow below steps to check volume and power button functionality in CIV-GVTG

Step 1:

  • Pre-built binaries are placed in ~/civ/scripts directory
  • $cd ~/civ/scripts/
  • $chmod +x vinput-manager sendkey

Step 2: Launch vinput-manager

  • $sudo ./vinput-manager

Step 3: Launch Android

  • Add below two lines under common_options variable in start_android_qcow2.sh script.
    -device virtio-input-host-pci,evdev=/dev/input/by-id/Power-Button-vm0 \
    -device virtio-input-host-pci,evdev=/dev/input/by-id/Volume-Button-vm0 \
  • Launch CIV using start_android_qcow2.sh script.

Step 4: Use sendkey application to verify volume and power key functionality in android

  • Volume Functionality:
    ./sendkey --vm 0 --volume up => Increases volume in CIV
    ./sendkey --vm 0 --volume down => decreases volume in CIV
  • Power Functionality:
    ./sendkey --vm 0 --power 0 => Short press to trigger Suspend/Resume in CIV
    ./sendkey –vm 0 –power 5 => long press of power key for 5 seconds. Displays power options in Android.

Note:

  1. Use sendkey application only after launching CIV.
  2. To set device in to graphical mode.
    $sudo systemctl set-default graphical.target
    $sudo reboot

Follow below steps to check volume and power button functionality in CIV-GVTD

Step 1: Pre-built binaries are placed in ~/civ/scripts directory

  • $cd ~/civ/scripts
  • $chmod +x vinput-manager sendkey

Step 2: Set the device in multi-user target mode.

  • $sudo systemctl set-default multi-user.target

Step 3: Update logind.conf file with "HandlePowerKey=ignore" and reboot device

  • $sudo vim /etc/systemd/logind.conf
    [Login]
    HandlePowerKey=ignore
  • $sudo reboot

Step 4: Launch vinput-manager

  • $sudo ./vinput-manager --gvtd

Step 5:

  • Add below 3 lines under common_options variable in start_android_qcow2.sh script.
    -device virtio-input-host-pci,evdev=/dev/input/by-id/Power-Button-vm0 \
    -device virtio-input-host-pci,evdev=/dev/input/by-id/Volume-Button-vm0 \
    -qmp unix:./qmp-vinput-sock,server,nowait \

  • Launch CIV: $sudo ./scripts/start_android_qcow2.sh --gvtd

Step 6: Run sendkey application to verify volume and power key functionality in android

  • Volume Functionality:
    ./sendkey --vm 0 --volume up => Increases volume in CIV
    ./sendkey --vm 0 --volume down => decreases volume in CIV
  • Power Functionality:
    ./sendkey --vm 0 --power 0 => Suspend/Resume in CIV
    ./sendkey –vm 0 –power 5 => long press of power key for 5 seconds. Displays power options in android.

Note:
1. Use sendkey application after launching CIV.