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

Discussion in 'Windows Vista Drivers' started by FISH, Dec 11, 2003.

  1. FISH

    FISH Guest


    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, Dec 11, 2003
    1. Advertisements

  2. 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.
    Robert Marquardt, Dec 11, 2003
    1. Advertisements

  3. FISH

    FISH Guest

    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

    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
    FISH, Dec 12, 2003
  4. 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

    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.
    Robert Marquardt, Dec 12, 2003
  5. FISH

    FISH Guest

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

    Thanks VeryMuch!!!!!!!!

    FISH, Dec 12, 2003
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.