[gpm] Support for QEMU mouse (via emulated usb tablet for proper positioning)
James Harvey
jamespharvey20@gmail.com
Fri Aug 16 03:08:59 CEST 2019
QEMU always provides a PS/2 to its virtual machines. It then provides
a GUI window for the VM, or another protocol like spice is used to
allow programs like remote-viewer to provide a GUI window.
It's PS/2 emulation is horrible for its positioning, in xorg and gpm.
There's an offset involved that changes as you go out of the GUI
window (within it can be running a console and gpm), so there are
areas of the screen you can't get to, when you leave the window to
somewhere else in the host, the cursor "jumps", and at least in xorg,
where a click registers isn't where the cursor is displayed on the
screen.
A long time ago, QEMU created an emulated USB tablet device which
gives absolute positioning, which fixes all of these problems with
xorg. This is through a "-usbdevice tablet" argument, and a few
others.
Using it, dmesg includes: "input: QEMU Virtio Tablet as
/devices/pci0000:00/0000:00:02.0/virtio0/input/input3". I don't need
to do any configuration for xorg to pick it up properly.
If I run evtest, it shows event2 is "QEMU Virtio Tablet", and event4
is "ImExPS/2 Generic Explorer Mouse".
If I run evtest on event2 (tablet), if shows button clicks and cursor
positioning using absolute coordinates. They appear proper, as the x
value goes right to 0 at the left edge.
If I run evtest on event4 (PS/2), it shows nothing. No button clicks,
and no cursor positioning.
If I run the default "gpm -m /dev/input/mice -t imps2", I get a text
mouse cursor and it registers button clicks. Moving the mouse tracks
in the right direction, but the QEMU PS/2 problems that happen under
xorg come up. There are areas you can't get to, and the mouse "jumps"
when you go out of the GUI window.
I'm confused by this, because I think QEMU is no longer sending
non-absolute positioning to the PS/2 mouse. I think it's there but
receives nothing. So, I think gpm is reading through the USB tablet.
I wouldn't think the tablet could be giving non-absolute positioning
to gpm. Maybe it's reading the absolute coordinates and using them
relatively, but that doesn't seem to match the movement I see either.
I see "* summa" for an astericked type, so tried "gpm -m
/dev/input/mouse0 -t summa". (With mouse0 pointing to the pci id for
the tablet.) It never shows a cursor, and when I move the mouse
around, it does random things like clicking and highlighting.
Would a new -t driver be needed for this to work properly?
"-t wacom" and "-t wp" don't run, it just exits.
"-t acecad" and "-t genitizer" also randomly click and highlight on
mouse movement.
More information about the gpm
mailing list