Grabbing mouse pointer

52 views
Skip to first unread message

Vít Šesták

unread,
Mar 28, 2017, 9:48:26 AM3/28/17
to qubes-users
I am trying to grab a mouse pointer in order to be fully controllable by the app. Alternatively, it would be OK to attach an external mouse to a VM (PVM, PVM with loopback VNC, HVM, I don't care much which variant would be used…) and make it working.

Grabbing the mouse from dom0 does not seem to be easy. And even if I manage it to be grabbed, I would probably break inter-VM communicating unless the protocol is redesigned. So, it is probably a dead-end now.

I've tried to connect an USB mouse directly to AppVM (through qvm-usb), I see it in lsusb and /dev/input/mouse0, but I am not able to use it – the laser does not even light. I've tried xfce4-mouse-settings in both bare AppVM and TigerVNC loopback, but the mouse was not there, even after adding /dev/input/mice to xorg-qubes.conf-template.

I've also tried a Ubuntu 16.04 HVM. It would probably work after passing the mouse here. But passing the mouse input to Ubuntu is not so easy. I've tried to install Debian's qubes-usb-proxy (both jessie and stretch; I know this is both dirty and risky), but it wants to remove some packages, including Xorg. so, this would require more work…

Maybe I should pass the mouse through network. I can use either usbip (but I have no network in sys-usb, so I would have to do it through an extra proxy…) or via some mouse-specific software.

Passing whole USB controller to the HVM is not an option for me today. It might be a viable (but non-preferred) way later when I buy a VT-d-capable laptop.

Regards,
Vít Šesták 'v6ak'

Vít Šesták

unread,
Mar 28, 2017, 5:18:06 PM3/28/17
to qubes-users
I got it partially working.

Instead of running tigervncserver, I start a new X11 session (with dummy video driver) and start x0vncserver for this session. This is mostly the same as running tigervncserver directly, but this way is more flexible. You can, for example, pass a custom Xorg.conf.

The problem is: When I pass the mouse to the VM, as soon as the X11 tries to use it (according to its logs), it freezes. This problem seems to be related rather to USB, because sudo lsusb -v also freezes and even Ctrl+C cannot kill it. (Without sudo, it works fine.)

Also note that qvm-usb takes some seconds (maybe 10s or 20s) to complete, although I see the device in the target VM even before it completes. While it might be unrelated, it is worth to be mentioned.

Regards,
Vít Šesták 'v6ak'

Vít Šesták

unread,
Mar 31, 2017, 4:43:12 PM3/31/17
to qubes-users
Some continuation of my monolog for those who are interested:

I was able to get it working using qubes-input-proxy between VMs. A brief overview:

* Another X11 instance running on display :1 with dummy video driver.
* VNC server (x0tigervncserver) listening on 127.0.0.1 allowing access to the X11 instance.
* VNC client (vncviewer from TigerVNC) connected to the server mentioned above.
* VM sys-net has modified service for qubes-input-proxy to send the mouse events to the target VM instead of dom0.
* Target VM has a slightly modified Qubes RPC endpoint (prepended /usr/bin/env DISPLAY=:1) in order to work with the proper display.

Result:

* Internal touchpad works as usual.
* External mouse is grabbed for the VM.
* External mouse does not move the system pointer (as it is rendered by dom0), but maybe this does not matter much for use cases of grabbed pointer.
* It is possible but impractical to use both mouse grabbed by the VM and touchpad connected to the dom0 at the same time.
* Easy to go fullscreen :)

Some ideas etc.:

* It is a good idea to run a window manager in the VM. I use Openbox.
* It does not work when TigerVNC creates its own X11 server, not sure why. This is the reason I am using xinit+x0vncserver with dummy display output instead of just using tigervncserver command.
* Maybe even the USB approach would work under normal circumstances. I have udev configured to disable all HIDs by default, which complicates using the mouse a bit.
* If we get qubes-usb-proxy-sender to dom0, we could theoretically do this for all (even non-USB) devices. This would be probably a more user friendly way.
* Non-Linux systems (e.g. Windows) can be probably handled through RDP/VNC/… over local network.
* Maybe we could pass the mouse input to server :0 and avoid the need of extra X11 instance and VNC at all. I, however, like the better fullscreen support with the VNC.

Regards,
Vít Šesták 'v6ak'
Reply all
Reply to author
Forward
0 new messages