Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for VirtualBox guests #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

fonic
Copy link

@fonic fonic commented Aug 28, 2017

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.

Tested with:

  • Gentoo Linux host, amd64, VirtualBox 5.1.26
  • Ubuntu Server 16.04.3 LTS guest, both plain textmode and framebuffer

Please note:

  • the commented out code sections for wheel handling just reflect different approaches with the preferred one currently being active
  • gpm has to be instructed to use the appropriate input device, using /dev/input/mice will not work
  • makes gpm support for virtualbox console #7, which was a rather unclean approach, obsolete

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.
@msokalski
Copy link

msokalski commented Feb 12, 2018

Tested on Arch x64 inside VBox 5.1.30 works well with 1 minor quirk:
After changing rows / lines of the console (using eg. setfont), there's a dead space in bottom right corner. You need to pass it until mouse pointer starts moving on console or in opposite direction leaves VBox window. Everything get back to normal after switching forth and back active console screen but at least 1 mouse event must be generated on another screen. :)

@jamespharvey20
Copy link

@fonic, thank you for this! I was about to write a PR for supporting a QEMU USB Tablet, but after looking at yours and trying it, it works as-is for QEMU on Arch.

I think this would be great to get merged.

It might be worth naming it something different than vbox though, since it works for QEMU. I don't have a great suggestion for this. Maybe vmtablet, but perhaps that's too generic, because I have no idea how and if VMWare handles absolute positioning.

It also might be a good idea to put the last part of the patch in alphabetical order, whether it stays as vbox or is renamed to something else. The order given in the code is the order displayed by -t help, and at quick glance, it appears the rest are in alphabetical order except for at the top mman and ms.

@skoehler
Copy link

skoehler commented Apr 23, 2023

Does this patch implement general USB tablet support? How is it specific to virtualbox? What about qemu?

The real issue here seems to be that gpm seems to lack support for tablet devices (which by definition send absolute coordinates, AFAIK). So what's missing to have general tablet support?

@fonic
Copy link
Author

fonic commented Apr 24, 2023

Does this patch implement general USB tablet support? How is it specific to virtualbox? What about qemu?

This has been developed for and tested with VirtualBox, that's what makes it specific. @jamespharvey20 has tested it successfully on QEMU. I don't use QEMU and thus haven't verified. I could, but then there seems to be little interest in merging this PR (it's been open for almost 6 years now), so why invest precious time.

Does this implement general USB tablet support? Who knows. It might, it might not. I don't own any USB tablets and thus can't verify.

The real issue here seems to be that gpm seems to lack support for tablet devices (which by definition send absolute coordinates, AFAIK). So what's missing to have general tablet support?

Well, feel free to put in some work and investigate how [USB] tablets of different vendors work. The question is whether tablets in general present themselves like VirtualBox's USB tablet or not (quote from my own commit):

/*
 * 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)
 */

@7eggert
Copy link

7eggert commented Jun 22, 2024

Please add this because the other mouse drivers aren't usable in the virt-manager console.

@fonic
Copy link
Author

fonic commented Jun 22, 2024

Please add this because the other mouse drivers aren't usable in the virt-manager console.

If you are using Arch Linux or some derivative, you can use gpm-vm from AUR which already includes this PR/patch (see https://wiki.archlinux.org/title/General_purpose_mouse#QEMU_or_VirtualBox).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants