Tech Support > Microsoft Windows > Drivers > Can a USB HID device get mouhid to set MOUSE_VIRTUAL_DESKTOP?
Can a USB HID device get mouhid to set MOUSE_VIRTUAL_DESKTOP?
Posted by Ben G. on April 18th, 2008


Hi folks,

I'm developing a USB HID mouse device that works in absolute pointing mode.
When there are multiple monitors attached to the computer, the device is
aware of the topology and layout of the monitors, so it can scale the
coordinates to the bounding box of the monitors.

We have a PS/2 version of this device and a custom driver that always sets
the MOUSE_VIRTUAL_DESKTOP flag when queueing MOUSE_INPUT_DATA packets.

I'd like to be able to use the stock mouhid driver on systems with multiple
monitors, but as far as I can tell, mouhid never sets MOUSE_VIRTUAL_DESKTOP.
This limits the mouse cursor to the primary display.

Is there any way for a USB HID device to set a flag in its report descriptor
that will get mouhid to set MOUSE_VIRTUAL_DESKTOP in its MOUSE_INPUT_DATA
packets?

Thanks!


Posted by Ray Trent on April 18th, 2008


In the case of a USB device using the stock driver, how would you make
it so, as you say, "the device is aware of the topology and layout of
the monitors, so it can scale the coordinates to the bounding box of the
monitors"?

Seems like you're going to need a driver for that purpose anyway, so why
not use the same filter driver (that scales your coordinates) to
intercept the mouclass callbacks and set the flag?

To answer your question more directly, I know of no way to get mouhid to
do that for you.

Ben G. wrote:

--
Ray

Posted by Ben G. on April 19th, 2008


Thanks for the super speedy reply, Ray!

"Ray Trent" wrote:

This is actually for a virtual USB mouse device running as part of a virtual
machine. The virtual USB device directly communicates with the display
subsystem of the virtual machine (no filter driver involved) to figure out
the topology of the monitors attached to Windows.

Due to the complexity of maintaining another custom kernel driver, as well
the expense and time of going through WHQL to get that driver signed for each
and every release of our software, it'd of course be much preferred if we
could get mouhid to set MOUSE_VIRTUAL_DESKTOP in its packets.

No problem. I appreciate you taking the time to answer my question!


Posted by Ray Trent on April 21st, 2008


Ben G. wrote:
No problem.

What I meant, BTW, was that you could add code to your existing PS/2
driver to handle the USB case as well (you need to filter at the exact
same spot to do this on the USB side, and do pretty much the same thing).

I don't know exactly what you did in that PS/2 driver, but it's even
remotely possible that all you'd have to do is add an entry in the INF
file to filter USB too. But even if you have to write special code for
the USB side, there's no reason the same .sys file can't control both
kinds of device, even simultaneously (we do it all the time).

Then you'd only have 1 driver, with 1 WHQL requirement (though you could
split the INF into two separate ones if you really wanted to).
--
Ray

Posted by Doron Holan [MSFT] on April 22nd, 2008


there is no interface to have mouhid set the virtual deskto flag. you can
easily write an upper filter between mouhid and mouclass which sets this
flag on every reported input packet though. as ray said, your ps2 driver
(if it is a filter) can play double duty on both stacks.

d
--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"Ray Trent" <rat@nospam.nospam> wrote in message
news:e0x6xw$oIHA.420@TK2MSFTNGP02.phx.gbl...

Posted by Ben G. on April 22nd, 2008


Thanks very much, Ray and Doron.

I agree that we can make our PS/2 driver (it is indeed a filter) do double
duty in this case. I wasn't aware that we could have it filter two different
stacks.

Would it be possible to bind it specifically to mouhid, since only mouhid
has this bug? I don't want to apply this to other USB drivers that might be
installed (for example, tablet drivers) for USB devices that are not our
special absolute mouse.

Cheers,

Ben

"Doron Holan [MSFT]" wrote:

Posted by Doron Holan [MSFT] on April 22nd, 2008


your INF can install on a vendor specific ID. it will filter on a device
level basis, not a class wide basis which would limit it to your HID device

d

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"Ben G." <BenG@discussions.microsoft.com> wrote in message
news:CAC4B2AC-6B81-401D-9517-8412E6AC3D0B@microsoft.com...