Page 1 of 1

How to support mouse integration?

Posted: Wed Sep 30, 2015 3:51 am
by Jarno
Hello everybody,

I've looked everywhere on the large vista's of the internet and found... nothing :(
I want to learn how to support mouse integration in VM's i.e. when your OS is being ran as the guest OS.

If anyone has a clue, please share your knowledge and/or point me at the right direction.

Thanx :)

Re: How to support mouse integration?

Posted: Wed Sep 30, 2015 5:33 am
by Ready4Dis
I'm not sure exactly what you mean by mouse integration... do you mean how do you take control of the mouse from the VM? I know bochs uses the f12 key to enable/disable they mouse (aka, switch from host to guest). You still need to do everything in the OS to enable mouse support though just like if you were using real hardware. Might have to make some configuration changes depending on exactly how you want it to work though (ps/2, usb?)

Re: How to support mouse integration?

Posted: Wed Sep 30, 2015 5:51 am
by iansjack
If you mean that you want to support the mouse in your OS then you do it in a VM exactly the same as you would on real hardware.

Re: How to support mouse integration?

Posted: Wed Sep 30, 2015 7:17 am
by hometue
Or perhaps you are referring to a feature similar to Virtualbox mouse integration? For that I am guessing you need to somehow install the guest additions into your operating system.

Re: How to support mouse integration?

Posted: Wed Sep 30, 2015 12:55 pm
by Octocontrabass
VirtualBox provides a PCI device that allows the host and guest to communicate with one another. You transfer data between the guest and the host by placing a data structure somewhere in RAM, and writing the address of the data structure to a specific I/O port. The host informs the guest when more data is ready with an interrupt.

I don't know of any documentation for it, but the source code is available for both the host and guest side.

Re: How to support mouse integration?

Posted: Sat Oct 24, 2015 2:17 pm
by hidnplayr
Another possibility is to support USB HID devices in tablet mode, and put your VM in this mode.
This works great for me on KolibriOS in Virtualbox.

Re: How to support mouse integration?

Posted: Mon Oct 26, 2015 4:15 am
by mallard
Since I'm also interested in (eventually) having VM mouse integration in my OS, I did a bit of searching.

This mailing list post is probably the best place to start; it's a reply from a VirtualBox developer to one of the Syllable OS developers detailing how the guest additions work (there's nothing Syllable-specific there).

Basically, there's a PCI device (VMMDev, PCI device ID 80EE:CAFE) that provides a whole bunch of services; everything from time synchronisation to folder sharing goes through it. Since VirtualBox is open source, you can read through the existing additions and the VirtualBox-side code to get an idea how it all works. It is however fairly complex on a typical OS; there are multiple layers that each request goes through making it hard to understand.

The only independently-developed (and by far the simplest) "guest additions" I've found those included in MINIX v3. Their code only supports time synchronisation, but does show the basics of how to communicate with the PCI device. It shouldn't be too difficult to use this code as a guide to write a driver that supports mouse integration.