Re: MY HID Mouse, how to "write data" to my HID mouse form Win32 AP ? by goldfish
goldfish
Fri Dec 12 00:16:25 CST 2003
Robert Marquardt <robert_marquardt@gmx.de> wrote in message news:<e1EhAcBwDHA.2452@tk2msftngp13.phx.gbl>...
> FISH wrote:
>
> > 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
> > goldfish@ms5.url.com.tw
>
> 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.
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