summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames P. Harvey2019-08-18 22:48:45 -0400
committerJames P. Harvey2019-08-18 23:09:52 -0400
commita3760dda277e84a8fc0016619a3ac5f7830283d5 (patch)
tree0491462cfa5b88d697173da0e40d54f88c3694f5
parentb57d20780988b607b21b2bd1856e5fa5797b453c (diff)
downloadaur-a3760dda277e84a8fc0016619a3ac5f7830283d5.tar.gz
Add patch for VM USB tablet support, and use it by default.
-rw-r--r--.SRCINFO8
-rw-r--r--PKGBUILD18
-rw-r--r--gpm-23.patch92
-rwxr-xr-xgpm-vm22
-rw-r--r--gpm-vm.conf1
-rw-r--r--gpm.service5
6 files changed, 140 insertions, 6 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 293624822967..c42ec93702aa 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -15,10 +15,16 @@ pkgbase = gpm-vm
source = 0001-glibc-sigemptyset.patch
source = gpm.sh
source = gpm.service
+ source = gpm-23.patch
+ source = gpm-vm
+ source = gpm-vm.conf
sha256sums = SKIP
sha256sums = 61f901aae46ff79679a058758151dc93901dcd9ea938fabb0765554993b8cb09
sha256sums = f41e90dcf6c0c6c4b8eff1c69039a20eb6b38ea851ffd1fa47ba311bf83d6ed8
- sha256sums = dc7d2463f6670ff2c1646a571ffad51f7c603793c25c6f685efad13cbb444034
+ sha256sums = 4d1e92a82006a7d361deeb8760514bbf1b33b40264bb57a4f4087239009d0485
+ sha256sums = f9f228a17701afcf383396861cfe798067505b4dbfddbb4fa91ee3e4c5088175
+ sha256sums = 92c6040e43617fe1aaf3af45c63c211e9de6a2728fc005aef32a5aebe4bcfe19
+ sha256sums = a0b57507017158316facb9e603b187dc443fbe934ed024ceea94715565843d4f
pkgname = gpm-vm
diff --git a/PKGBUILD b/PKGBUILD
index 5f7a0d97c7c3..83646c45be7b 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,5 +1,10 @@
+# Original Core Repo
+# ======================
# Maintainer: Eric BĂ©langer <eric@archlinux.org>
+# Modifications to work for QEMU and Virtualbox
+# Maintainer: James P. Harvey <jamespharvey20 at gmail dot com>
+
pkgname=gpm-vm
_pkgname=gpm
pkgver=1.20.7.r27.g1fd1941
@@ -15,11 +20,17 @@ options=('!makeflags')
source=("git+https://github.com/telmich/gpm.git#commit=${_commit}"
'0001-glibc-sigemptyset.patch'
'gpm.sh'
- 'gpm.service')
+ 'gpm.service'
+ 'gpm-23.patch'
+ 'gpm-vm'
+ 'gpm-vm.conf')
sha256sums=('SKIP'
'61f901aae46ff79679a058758151dc93901dcd9ea938fabb0765554993b8cb09'
'f41e90dcf6c0c6c4b8eff1c69039a20eb6b38ea851ffd1fa47ba311bf83d6ed8'
- 'dc7d2463f6670ff2c1646a571ffad51f7c603793c25c6f685efad13cbb444034')
+ '4d1e92a82006a7d361deeb8760514bbf1b33b40264bb57a4f4087239009d0485'
+ 'f9f228a17701afcf383396861cfe798067505b4dbfddbb4fa91ee3e4c5088175'
+ '92c6040e43617fe1aaf3af45c63c211e9de6a2728fc005aef32a5aebe4bcfe19'
+ 'a0b57507017158316facb9e603b187dc443fbe934ed024ceea94715565843d4f')
provides=('gpm')
conflicts=('gpm')
@@ -37,6 +48,7 @@ prepare() {
cd "${srcdir}/${_pkgname}"
patch -Np1 < ../0001-glibc-sigemptyset.patch
+ patch -Np1 < ../gpm-23.patch
./autogen.sh
}
@@ -57,6 +69,8 @@ package() {
make DESTDIR="${pkgdir}" install
install -D -m0755 ../gpm.sh "${pkgdir}/etc/profile.d/gpm.sh"
install -D -m0644 ../gpm.service "${pkgdir}/usr/lib/systemd/system/gpm.service"
+ install -D -m0755 ../gpm-vm "${pkgdir}/usr/bin/gpm-vm"
+ install -D -m0644 ../gpm-vm.conf "${pkgdir}/etc/gpm-vm.conf"
# library fixes
cd "${pkgdir}/usr/lib/"
diff --git a/gpm-23.patch b/gpm-23.patch
new file mode 100644
index 000000000000..a9519aa9ac3f
--- /dev/null
+++ b/gpm-23.patch
@@ -0,0 +1,92 @@
+From 99e29cb2206d1c5a43c3035098ae1a7f434b9b8f Mon Sep 17 00:00:00 2001
+From: fonic <fonic.maxxim@live.com>
+Date: Mon, 28 Aug 2017 15:30:02 +0200
+Subject: [PATCH] Add support for VirtualBox guests This adds support for the
+ 'USB Tablet' absolute pointing device emulated by VirtualBox. This enables
+ Linux guests to seamlessly integrate, i.e. the pointer doesn't have to be
+ captured by the guest anymore.
+
+Pointer movement, all five buttons (two of them being mapped to 'middle') and both vertical and horizontal wheels are supported.
+
+Vertical mouse wheel functionality could be verified using links in framebuffer mode. Horizontal wheel is untested due to the lack of a device with that feature.
+---
+ src/mice.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 59 insertions(+)
+
+diff --git a/src/mice.c b/src/mice.c
+index 6cbd491..00c69b9 100644
+--- a/src/mice.c
++++ b/src/mice.c
+@@ -254,6 +254,62 @@ static int M_evdev (Gpm_Event * state, unsigned char *data)
+ }
+ return 0;
+ }
++
++/*
++ * USB Tablet emulated by VirtualBox for seamless mouse integration
++ *
++ * The 'VirtualBox USB Tablet' is an absolute pointing device which
++ * uses values of range 0-32767 for both axes, reports five button
++ * states (left, right, middle, side, extra) and two wheel states
++ * (vertical, horizontal; both relative)
++ */
++#define VBOX_MAX 32767
++
++static int M_vbox (Gpm_Event * state, unsigned char *data)
++{
++ struct input_event thisevent;
++ (void) memcpy (&thisevent, data, sizeof (struct input_event));
++
++ state->dx = state->dy = 0;
++ state->wdx = state->wdy = 0;
++
++ // Pointer
++ if (thisevent.type == EV_ABS) {
++ if (thisevent.code == REL_X) {
++ state->x = thisevent.value * (win.ws_col+1) / VBOX_MAX;
++ realposx = thisevent.value * REALPOS_MAX / VBOX_MAX;
++ } else if (thisevent.code == REL_Y) {
++ state->y = thisevent.value * (win.ws_row+1) / VBOX_MAX;
++ realposy = thisevent.value * REALPOS_MAX / VBOX_MAX;
++ }
++
++ // Wheels
++ } else if (thisevent.type == EV_REL) {
++ if (thisevent.code == REL_WHEEL) {
++ //state->buttons ^= thisevent.value > 0 ? GPM_B_UP : GPM_B_DOWN;
++ //state->wdy = thisevent.value > 0 ? +1 : -1;
++ state->wdy = thisevent.value;
++ } else if (thisevent.code == REL_HWHEEL) {
++ //state->buttons ^= thisevent.value > 0 ? GPM_B_RIGHT : GPM_B_LEFT;
++ //state->buttons ^= thisevent.value > 0 ? GPM_B_LEFT : GPM_B_RIGHT;
++ //state->wdx = thisevent.value > 0 ? +1 : -1;
++ //state->wdx = thisevent.value > 0 ? -1 : +1;
++ state->wdx = thisevent.value;
++ }
++
++ // Buttons
++ } else if (thisevent.type == EV_KEY) {
++ switch (thisevent.code) {
++ case BTN_LEFT: state->buttons ^= GPM_B_LEFT; break;
++ case BTN_MIDDLE: state->buttons ^= GPM_B_MIDDLE; break;
++ case BTN_RIGHT: state->buttons ^= GPM_B_RIGHT; break;
++ case BTN_SIDE: state->buttons ^= GPM_B_MIDDLE; break;
++ case BTN_EXTRA: state->buttons ^= GPM_B_MIDDLE; break;
++ }
++ }
++
++ return 0;
++}
+ #endif /* HAVE_LINUX_INPUT_H */
+
+ static int M_ms(Gpm_Event *state, unsigned char *data)
+@@ -2404,6 +2460,9 @@ Gpm_Type mice[]={
+ {"evdev", "Linux Event Device",
+ "", M_evdev, I_empty, STD_FLG,
+ {0x00, 0x00, 0x00, 0x00} , 16, 16, 0, 0, NULL},
++ {"vbox", "For USB Tablet emulated by VirtualBox for mouse integration",
++ "", M_vbox, I_empty, STD_FLG,
++ {0x00, 0x00, 0x00, 0x00} , 24, 24, 0, 1, NULL},
+ #endif /* HAVE_LINUX_INPUT_H */
+ {"exps2", "IntelliMouse Explorer (ps2) - 3 buttons, wheel unused",
+ "ExplorerPS/2", M_imps2, I_exps2, STD_FLG,
diff --git a/gpm-vm b/gpm-vm
new file mode 100755
index 000000000000..f2e1cf780301
--- /dev/null
+++ b/gpm-vm
@@ -0,0 +1,22 @@
+#!/usr/bin/bash
+
+conf="/etc/gpm-vm.conf"
+
+if [[ ! -f "${conf}" ]]; then
+ echo "'${conf}' does not exist"
+ exit 1
+fi
+
+source "${conf}"
+
+if [[ ! -v event ]]; then
+ echo "'event' is not set in '${conf}'"
+ exit 1
+fi
+
+if [[ ! -c "${event}" ]]; then
+ echo "'${event}' does not exist or is not a character device"
+ exit 1
+fi
+
+/usr/bin/gpm -m "${event}" -t vbox
diff --git a/gpm-vm.conf b/gpm-vm.conf
new file mode 100644
index 000000000000..c4e15f7af636
--- /dev/null
+++ b/gpm-vm.conf
@@ -0,0 +1 @@
+event="/dev/input/event2"
diff --git a/gpm.service b/gpm.service
index 6d4d403a7410..ca807547eb93 100644
--- a/gpm.service
+++ b/gpm.service
@@ -1,12 +1,11 @@
[Unit]
-Description=Virtual console mouse server
+Description=Virtual console mouse server (for QEMU/VirtualBox)
Requires=systemd-udevd.service
After=systemd-udevd.service
-ConditionPathExists=/dev/input/mice
[Service]
Type=forking
-ExecStart=/usr/bin/gpm -m /dev/input/mice -t imps2
+ExecStart=/usr/bin/gpm-vm
[Install]
WantedBy=multi-user.target