HID absolute mouse

It’s pain to get absolute mouse working. Finally i got it work on Primary display. For Second display i tried many different PHYSICAL_MAXIMUM values but none of them worked.

From my previous post i understood, mouhid nomalizes X, Y to range 0->65535 using equation (XYdata * 65535)/PHYSICAL_MAX.

Is it simply not possible for absolute mouse to send data on second display? Has anyone being able to do it?

Appreciate any help.

I’m using following code to nomalize X, Y before sending in report.
iX = (INT) ((iX * 32767) / GetSystemMetrics(SM_CXSCREEN));
iY = (INT) ((iY * 32767) / GetSystemMetrics(SM_CYSCREEN));

0x05, 0x0D, // USAGE_PAGE (Digitizers)
0x09, 0x02, // USAGE (Pen)
0xA1, 0x01, // COLLECTION (Application)
0x85, REPORTID_TABLETPC, // REPORT_ID (REPORTID_TABLETPC)
0x09, 0x02, // USAGE (Pen)
0xA1, 0x00, // COLLECTION (Physical)
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x30, // USAGE (X)
0x09, 0x31, // USAGE (Y)
0x35, 0x00, // PHYSICAL_MINIMUM (0)
0x46, 0xFF, 0x7F, // PHYSICAL_MAXIMUM (32767)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x26, 0xFF, 0x7F, // LOGICAL_MAXIMUM (32767)
0x75, 0x10, // REPORT_SIZE (16)
0x95, 0x02, // REPORT_COUNT (2)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x05, 0x0D, // USAGE_PAGE (Digitizers)
0x09, 0x42, // USAGE (Tip Switch)
0x09, 0x44, // USAGE (Barrel Switch)
0x09, 0x3C, // USAGE (Invert)
0x09, 0x45, // USAGE (Eraser)
0x09, 0x32, // USAGE (In Range)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x25, 0x01, // LOGICAL_MAXIMUM (1)
0x75, 0x01, // REPORT_SIZE (1)
0x95, 0x05, // REPORT_COUNT (5)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x75, 0x03, // REPORT_SIZE (3 bits padding)
0x95, 0x01, // REPORT_COUNT (1)
0x81, 0x03, // INPUT (Cnst,Var,Abs)
0x75, 0x10, // REPORT_SIZE (16 bits padding)
0x95, 0x01, // REPORT_COUNT (1)
0x81, 0x03, // INPUT (Cnst,Var,Abs)
0xC0, // END_COLLECTION
0xC0 // END_COLLECTION

I think that to get an absolute mouse to go beyond the primary monitor,
you need to specify MOUSE_VIRTUAL_DESKTOP in the MOUSE_INPUT_DATA
reported up to the raw input thread. Since mouhid.sys is the one doing
this for you, there is no way from your HID miniport to get mouhid to
set this flag. If you want to really to get this to work, you can write
a 2nd driver which is a device upper filter in between mouhid and
mouclass. In the service callback you insert into the chain you can
specify the flag. There is a WDK sample, moufiltr which you can base
your driver on. I would convert that driver to use KMDF (there is a
KMDF version of kbfiltr which you can base your conversion on), your
life will be much simpler for it.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@hotmail.com
Sent: Tuesday, April 17, 2007 5:11 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] HID absolute mouse

It’s pain to get absolute mouse working. Finally i got it work on
Primary display. For Second display i tried many different
PHYSICAL_MAXIMUM values but none of them worked.

From my previous post i understood, mouhid nomalizes X, Y to range
0->65535 using equation (XYdata * 65535)/PHYSICAL_MAX.

Is it simply not possible for absolute mouse to send data on second
display? Has anyone being able to do it?

Appreciate any help.

I’m using following code to nomalize X, Y before sending in report.
iX = (INT) ((iX * 32767) / GetSystemMetrics(SM_CXSCREEN));
iY = (INT) ((iY * 32767) / GetSystemMetrics(SM_CYSCREEN));

0x05, 0x0D, // USAGE_PAGE
(Digitizers)
0x09, 0x02, // USAGE (Pen)
0xA1, 0x01, // COLLECTION
(Application)
0x85, REPORTID_TABLETPC, // REPORT_ID
(REPORTID_TABLETPC)
0x09, 0x02, // USAGE
(Pen)
0xA1, 0x00, //
COLLECTION (Physical)
0x05, 0x01, //
USAGE_PAGE (Generic Desktop)
0x09, 0x30, // USAGE
(X)
0x09, 0x31, // USAGE
(Y)
0x35, 0x00, //
PHYSICAL_MINIMUM (0)
0x46, 0xFF, 0x7F, //
PHYSICAL_MAXIMUM (32767)
0x15, 0x00, //
LOGICAL_MINIMUM (0)
0x26, 0xFF, 0x7F, //
LOGICAL_MAXIMUM (32767)
0x75, 0x10, //
REPORT_SIZE (16)
0x95, 0x02, //
REPORT_COUNT (2)
0x81, 0x02, // INPUT
(Data,Var,Abs)
0x05, 0x0D, //
USAGE_PAGE (Digitizers)
0x09, 0x42, // USAGE
(Tip Switch)
0x09, 0x44, // USAGE
(Barrel Switch)
0x09, 0x3C, // USAGE
(Invert)
0x09, 0x45, // USAGE
(Eraser)
0x09, 0x32, // USAGE
(In Range)
0x15, 0x00, //
LOGICAL_MINIMUM (0)
0x25, 0x01, //
LOGICAL_MAXIMUM (1)
0x75, 0x01, //
REPORT_SIZE (1)
0x95, 0x05, //
REPORT_COUNT (5)
0x81, 0x02, // INPUT
(Data,Var,Abs)
0x75, 0x03, //
REPORT_SIZE (3 bits padding)
0x95, 0x01, //
REPORT_COUNT (1)
0x81, 0x03, // INPUT
(Cnst,Var,Abs)
0x75, 0x10, //
REPORT_SIZE (16 bits padding)
0x95, 0x01, //
REPORT_COUNT (1)
0x81, 0x03, // INPUT
(Cnst,Var,Abs)
0xC0, //
END_COLLECTION
0xC0 //
END_COLLECTION


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Thanks Doron, time to roll up my sleeves and make another driver.

Before you go down the path of writing another driver, perhaps you can
manipulate some state in the debugger to see if this is the thing you
need to do. Set a bp on mouclass!MouseClassServiceCallback and do the
following when it is invoked for your HID device. The 2nd parameter is
the PMOUSE_INPUT_DATA that mouhid is reporting, you can then set the
MOUSE_VIRTUAL_DESKTOP flag (0x2) in the Flags field.

D

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@hotmail.com
Sent: Tuesday, April 17, 2007 8:39 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] HID absolute mouse

Thanks Doron, time to roll up my sleeves and make another driver.


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

It worked.

I modified moufiltr INF for HID mouse (replacing PS2_Inst with HID_Mouse_Inst). and updated my “HID-complaint mouse” device (as said in moufiltr install instructions). I added MOUSE_VIRTUAL_DESKTOP to Flags field and mouse is working on second screen.

Another Problem:
I have another Digitizers report descriptor which is sending absolute X Y with pen related data. In Device Manager it appears as “HID-compliant device” and clicking driver detail button tells me there are no drivers loaded for this device. Does this mean this device doesn’t have mouhid in its driver stack ? How do i install moufiltr in this case ?

Thanks

Digitizers are not mice (which is why it shows up a HID compliant device). They are handled separately by the digitizer software in user mode, no mouhid involved. in this case, you can open the digitizer in user mode, read the data in your application and call SendInput.

d

Beside SendInput and UAC problem, using SendInput will defeat the whole purpose of using flicks on Second Monitor. To be concise i’m making virtual tablet pc device and i feed the data coming from external touch device.

Do you know if anyone in TabletPC team would be able to help me about sending data on second monitor (as its coming from digitizer device)?

Well, you can solve the UAC problem with a manifest that specifies
uiAccess=true (and signing your exe and putting it in Program Files)
(though, be careful… it appears that thus-manifested apps started from
the Run key are locked to below-normal priority on Vista… requiring a
workaround of some kind that we haven’t found yet :-).

I’m not sure what you mean about it defeating the purpose… There are
very few ways in which SendInput doesn’t do exactly the same thing as a
driver sending mouse packets…

xxxxx@hotmail.com wrote:

Beside SendInput and UAC problem, using SendInput will defeat the whole purpose of using flicks on Second Monitor. To be concise i’m making virtual tablet pc device and i feed the data coming from external touch device.

Do you know if anyone in TabletPC team would be able to help me about sending data on second monitor (as its coming from digitizer device)?


Ray
(If you want to reply to me off list, please remove “spamblock.” from my
email address)

Apps in the run key (and start up group) are initially boxed into a
below normal priority on logon. After a set period of time (can’t
remember what it is, but it is something like 5 minutes), the priority
is bumped back to normal. This was done so that the onslaught of
startup applications did not crush desktop usability from heavy I/O and
paging

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Ray Trent
Sent: Monday, April 23, 2007 10:37 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] HID absolute mouse

Well, you can solve the UAC problem with a manifest that specifies
uiAccess=true (and signing your exe and putting it in Program Files)
(though, be careful… it appears that thus-manifested apps started from

the Run key are locked to below-normal priority on Vista… requiring a
workaround of some kind that we haven’t found yet :-).

I’m not sure what you mean about it defeating the purpose… There are
very few ways in which SendInput doesn’t do exactly the same thing as a
driver sending mouse packets…

xxxxx@hotmail.com wrote:

Beside SendInput and UAC problem, using SendInput will defeat the
whole purpose of using flicks on Second Monitor. To be concise i’m
making virtual tablet pc device and i feed the data coming from external
touch device.

Do you know if anyone in TabletPC team would be able to help me about
sending data on second monitor (as its coming from digitizer device)?


Ray
(If you want to reply to me off list, please remove “spamblock.” from my

email address)


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

In my case i can configure external touch device to either work on Primary Monitor or the second monitor or project both monitors on it. (Imagine a tablet pc where second monitor plugged is a digitizer (using extended desktop) and you can use stylus on both monitors).

What I’m currently doing is, if X, Y data is coming from primary monitor I send it to my virtual tablet pc driver and I can do navigational and editing flicks. And if X, Y data is from second monitor I use SentInput in which case i get standard mouse cursor and none of flicks work (as data is not coming from tablet pc device).

What i would like to do is send X, Y data coming from second monitor to my virtual tabletpc driver to get the same behavior as primary monitor. When i tried this approach I was sending X, Y data coming from second monitor but mouse cursor always appeared on left edge of second monitor and couldn’t get it move on entire second monitor.

Ahh… for some reason I would have thought that you’d do all your fancy
UI-interacting features in user-mode. In which case, calling SendInput
to just move the mouse when needed is just the right thing.

That’s might still the right way to do it, but if you want to send it
down to your primary display’s kernel driver (and you know the kernel
driver will be present on the primary display), then the easiest way to
do that is to create a control device in the primary driver and send the
packets from the secondary software via IOCTLs.

xxxxx@hotmail.com wrote:

In my case i can configure external touch device to either work on Primary Monitor or the second monitor or project both monitors on it. (Imagine a tablet pc where second monitor plugged is a digitizer (using extended desktop) and you can use stylus on both monitors).

What I’m currently doing is, if X, Y data is coming from primary monitor I send it to my virtual tablet pc driver and I can do navigational and editing flicks. And if X, Y data is from second monitor I use SentInput in which case i get standard mouse cursor and none of flicks work (as data is not coming from tablet pc device).

What i would like to do is send X, Y data coming from second monitor to my virtual tabletpc driver to get the same behavior as primary monitor. When i tried this approach I was sending X, Y data coming from second monitor but mouse cursor always appeared on left edge of second monitor and couldn’t get it move on entire second monitor.


Ray
(If you want to reply to me off list, please remove “spamblock.” from my
email address)

Doron Holan wrote:

Apps in the run key (and start up group) are initially boxed into a
below normal priority on logon. After a set period of time (can’t
remember what it is, but it is something like 5 minutes), the priority
is bumped back to normal. This was done so that the onslaught of

Upon further testing, this behavior seems to be the case for normal
apps, but for apps with uiAccess=true (to bypass UIPI) it appears that
they stay boxed to below normal priority forever… whether this is a
bug or as-designed is unknown to me.

Ray
(If you want to reply to me off list, please remove “spamblock.” from my
email address)