Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

MY HID Mouse, how to "write data" to my HID mouse form Win32 AP ?

326 views
Skip to first unread message

FISH

unread,
Dec 11, 2003, 12:21:32 PM12/11/03
to
Hello,

I write a driver (XP driver) for my HID mouse,
my HID mouse need some data to proccess some things,
=====================================================================
because my HID mouse have some LED and memory,
i hope i can control it and write data to the memory of my HID mouse,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
=====================================================================
when my user-mode win32 APPLICATION , CreateFile to open my HID mouse
device, got this message "Access Denied!"..

anyone know some way to solve it!?

please help me!.......

FISH
gold...@ms5.url.com.tw

Robert Marquardt

unread,
Dec 11, 2003, 1:46:06 PM12/11/03
to
FISH wrote:

If you declared output reports for your mouse then you are out of luck.
The output reports are written with WriteFile, but Windows opens the
mouse with an exclusive CreateFile call denying all other CreateFile
calls with read or write access.
Try declaring feature reports.
HidD_SetFeature happily works on a file handle opened WITHOUT read or
write access.

FISH

unread,
Dec 12, 2003, 1:16:25 AM12/12/03
to
Robert Marquardt <robert_m...@gmx.de> wrote in message news:<e1EhAcBw...@tk2msftngp13.phx.gbl>...


i use HID Descript tool (DT.exe), use the mouse sample , modify to my
HID mouse description.

then i use DDK\src\wdm\hid\hclient tool, call HidP_SetButtons /
HidP_GetButtons, Write/Read data to my HID mouse, it's return
success...

now , i have a problem........ =.=||
how could i get then Write/Read event in my HID mouse driver,
(DDK + DriverWorks, i use vhidmou sample under XP)

i trace message by DriverMonitor, i can't got any message in
ReadRepoort() / WriteReport(), (just got ReadReport() message, 1~2
times when driver start)

how to get R/W MESSAGE ????


here is my description:

0x05, 0x01, // Usage Page (Generic Desktop),
0x09, 0x02, // Usage (Mouse),
0xA1, 0x01, // Collection (Application),
0x09, 0x01, // Usage (Pointer),
0xA1, 0x00, // Collection (Physical),

0x05, 0x09, // Usage Page (Buttons),
0x19, 0x01, // Usage Minimum (01),
0x29, 0x03, // Usage Maximun (03),
0x15, 0x00, // Logical Minimum (0),
0x25, 0x01, // Logical Maximum (1),
0x95, 0x03, // Report Count (3),
0x75, 0x01, // Report Size (1),
0x81, 0x02, // Input (Data, Variable, Absolute), ;3 button bits
0x95, 0x01, // Report Count (1),
0x75, 0x05, // Report Size (5),
0x81, 0x01, // Input (Constant), ;5 bit padding

0x05, 0x01, // Usage Page (Generic Desktop),
0x09, 0x30, // Usage (X),
0x09, 0x31, // Usage (Y),
0x15, 0x81, // Logical Minimum (-127),
0x25, 0x7F, // Logical Maximum (127),
0x75, 0x08, // Report Size (8),
0x95, 0x02, // Report Count (2),
0x81, 0x06, // Input (Data, Variable, Relative), ;2 position bytes (X
& Y)
===============================================================================
0x05, 0x09, // ; USAGE_PAGE (Button)
0x19, 0x01, // ; USAGE_MINIMUM (Button 1)
0x29, 0x03, // ; USAGE_MAXIMUM (Button 3)
0x15, 0x00, // ; LOGICAL_MINIMUM (0)
0x25, 0x01, // ; LOGICAL_MAXIMUM (1)
0x95, 0x03, // ; REPORT_COUNT (3)
0x75, 0x01, // ; REPORT_SIZE (1)
0x91, 0x02, // ; OUTPUT (Data,Variable,Abs)
0x95, 0x01, // ; REPORT_COUNT (1)
0x75, 0x05, // ; REPORT_SIZE (5)
0x91, 0x03, // ; OUTPUT (Cnst,Variable,Abs)
========================================================================
0xC0, // End Collection,
0xC0 // End Collection

Robert Marquardt

unread,
Dec 12, 2003, 5:21:54 AM12/12/03
to
FISH wrote:

> then i use DDK\src\wdm\hid\hclient tool, call HidP_SetButtons /
> HidP_GetButtons, Write/Read data to my HID mouse, it's return
> success...

No wonder these functions succeed. They only fill the report which you
will have to write with writeFile, only that WriteFile cannot work on a
mouse.

As i said the problem lies with Windows and standard file security. The
device has been opened exclusively with a CreateFile call by Windows.
All other CreateFile calls for read or write access fail.
You can either define feature reports or declare a second top level
collection which shows up as another device. Make that a generic HID and
you can gain access.

FISH

unread,
Dec 12, 2003, 8:38:50 AM12/12/03
to
gold...@ms5.url.com.tw (FISH) wrote in message news:<3aa415f6.03121...@posting.google.com>...


Thanks Robert Marquardt, I already slove this problem , use HidD_SetFeature()!

Thanks VeryMuch!!!!!!!!

FISH

0 new messages