pmj / QemuUSBTablet-OSX

Driver allowing OS X guests to use the "usb-tablet" absolute pointing device in Qemu.
GNU Lesser General Public License v3.0
61 stars 12 forks source link

OS X Driver for the Qemu USB Tablet input device.

When running a virtual machine in a window, it's useful to simulate an absolute pointing device, so that the host computer's mouse cursor motion through the window is seamless. Qemu offers such a device via the -device usb-tablet option (in contrast to -device usb-mouse). Unfortunately, OS X's HID device drivers don't pick up this device correctly.

To solve the problem, I've written a driver that makes it work. On OS X 10.8 and earlier, all that is needed is a codeless kext that tells Apple's driver that it already knows how to drive the device. OS X 10.9 and newer treat the device as an analog stick when you do this, converting distance from the middle of the screen as a velocity to apply to relative motion of the mouse cursor. This is an even worse user experience than with the usb-mouse device, so I've written another kext that subtly rewrites the device's HID report descriptor before Apple's driver has a chance to pick it up. Specifically, the device reports a usage mode of "pointer" (1). OS X's drivers expect either "Mouse" (2) or "Digitiser", so the kext changes that single byte from 1 to 2 and everything starts working.

To use this driver:

Notes:

The Packaging system

There are currently 3 distinct packages, which are combined into the single installer package. They are:

The inconsistent naming of these packages is an accident of history, but to avoid confusing OS X's package database in the case of an update, we haven't retroactively fixed it. Note that these identifiers are the package identifiers, and not to be confused with the kext bundle identifiers.