I am trying to access a USB mouse device using CreateFile() by giving the proper device path(registry path). As Createfile() is an all-purpose function which can open handle to a file or any device whose driver support CreateFile(), I should get a valid handle through this.
But i am getting an error as “Access denied” ie system error code 5.
My question to the driver experts is : Is CreateFile() not supported in the USB mouse driver (mouseclass, mouhid etc). If it is supported then why is the access denied to the device.
Are access for read access? if so, the mouse is opened for exclusive read by the OS. Once you get a handle to the mouse, what i/o (read, write, IOCTL) do you want to send to it? for instance, if you want to send a custom IOCTL, this will not work because mouclass will block it.
The access is for read. I am not able to get the valid handle. The DeviceHandle is equal to INVALID_HANDLE_VALUE. And the GetLastError() gives Error code 5.
This the path of my USB mouse device \?\hid#vid_xxx&pid_xxx#6&7567e41&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}…
If the CreateFile() is supported by the driver then why do get an invalid handle.
wrote in message news:xxxxx@ntdev… > I am trying to access a USB mouse device using CreateFile() by giving the proper device path(registry path). As Createfile() is an all-purpose function which can open handle to a file or any device whose driver support CreateFile(), I should get a valid handle through this. > > But i am getting an error as “Access denied” ie system error code 5. > > My question to the driver experts is : Is CreateFile() not supported in the USB mouse driver (mouseclass, mouhid etc). If it is supported then why is the access denied to the device. > > Any directions in this highly appreciated. > > >
Can you change the mouse firmware to put the last 2 buttons in a separate collection?
D
-----Original Message-----
From: “xxxxx@mindtree.com” To: “Windows System Software Devs Interest List” Sent: 06/28/07 2:58 AM Subject: RE:[ntdev] CreateFlie support in USB mouse device.
Thanks for the reply
I am basically interested in reading the HID reports from the USB mouse having 7 buttons.
If i cannot open the mouse then how will i be able to read the reports from the mouse.
Is there any way I can get the handle to the mice. My work is also related to the following link
wrote in message news:xxxxx@ntdev… > Do you mean to say include a seperate report descriptor for the 2 buttons and make the usage undefined for the 2 buttons… > > >
Put the 2 buttons in a new top level collection and make the usage page
for the TLC anything but a mouse.
d
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@mindtree.com
Sent: Thursday, June 28, 2007 9:08 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] CreateFlie support in USB mouse device.
Do you mean to say include a seperate report descriptor for the 2
buttons and make the usage undefined for the 2 buttons…
i have changed the firmware with 2 mouse buttons in the seperate TLC. I am even able to actually get the handle to the device for this collection.
But i am hitting a new problem here.
The mouse driver gets loaded as the USAGE is mouse for the 5 buttons. In this case i am not getting the mouse clicks to the application. This could be because the applications would interpret the report with report id 0, but now in my case i have 2 report ids, report id 1 and report id 2.
Are you not getting any mouse clicks or just 3-5 are missing? If
everything is not showing up, I think this is a firmware issue on your
device that you need to fix, probably you are not interpreting or
sending the right report IDs
D
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@mindtree.com
Sent: Wednesday, July 04, 2007 2:46 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] CreateFlie support in USB mouse device.
i have changed the firmware with 2 mouse buttons in the seperate TLC. I
am even able to actually get the handle to the device for this
collection.
But i am hitting a new problem here.
The mouse driver gets loaded as the USAGE is mouse for the 5 buttons. In
this case i am not getting the mouse clicks to the application. This
could be because the applications would interpret the report with report
id 0, but now in my case i have 2 report ids, report id 1 and report id
2.
You can send write (IRP_MJ_WRITE) to the non mouse TLC, not the mouse
TLC since mouclass blocks writes. For all the HID IOCTLs you can send
to the mouse TLC from user mode, see the function
MouseClassDeviceControl in the mouclass example in the WDK. Basically
you can send/get/read/write anything you want to the non mouse TLC…
d
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@mindtree.com
Sent: Wednesday, July 04, 2007 9:22 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] CreateFlie support in USB mouse device.
Thanks D for the reply…
Now i am able to get the mouse clicks… it was the problem with the
report ids…
I am also able to read the button click information using the
ReadFile().
I would want to write to the device in a similar fashion. Will i be
successful in doing this…