Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Vista Drivers > WinUSB as a functional driver to replace an existing HIDUSB kernel mode driver

Reply
Thread Tools Display Modes

WinUSB as a functional driver to replace an existing HIDUSB kernel mode driver

 
 
Justin
Guest
Posts: n/a

 
      09-08-2010
I am looking for the simplest way to replace the driver of an existing USB optical mouse. (This is an experimental project
I know i could write a KMD to replace the driver but reverse engineering and existing device and debugging KMDs is challenging at best
Basically im looking read the opical mouse input data to use for my own purposes without the using it to control the mouse pointer and buttons
Can this be done? If not, what would be the best approach?


 
Reply With Quote
 
 
 
 
Philip Ries [MSFT]
Guest
Posts: n/a

 
      09-08-2010
Yes, what you want to do is possible with WinUSB. Just write your INF
so that, for the experiment mouse's hardware ID, WinUSB will load. Be
sure to specify a unique device interface GUID in the INF.

On 9/7/2010 7:55 PM, Justin wrote:
> I am looking for the simplest way to replace the driver of an existing USB optical mouse. (This is an experimental project)
> I know i could write a KMD to replace the driver but reverse engineering and existing device and debugging KMDs is challenging at best.
> Basically im looking read the opical mouse input data to use for my own purposes without the using it to control the mouse pointer and buttons.
> Can this be done? If not, what would be the best approach?
>
>

 
Reply With Quote
 
Justin
Guest
Posts: n/a

 
      09-08-2010
That sounds promising. Its just that i read some where http://www.libusb.org/wiki/windows_backend (a third party wrapper library) that:quot
"HID keyboards and mice will not have read or write access. This is because Windows requires an exclusive access to them, and uses a driver that prevent generic access.

Should this not effect me?


 
Reply With Quote
 
Tim Roberts
Guest
Posts: n/a

 
      09-09-2010
Justin </> wrote:

>That sounds promising. Its just that i read some where http://www.libusb.org/wiki/windows_backend (a third party wrapper library) that:quote
>"HID keyboards and mice will not have read or write access. This is because Windows requires an exclusive access to them, and uses a driver that prevent generic access."
>
>Should this not effect me?


No. The HID stack opens the HID driver for exclusive access, but you will
be replacing the HID driver with your own. You can do whatever you want.

Of course, when you do so, it will no longer be seen as a mouse. You need
to realize that.
--
Tim Roberts,
Providenza & Boekelheide, Inc.
 
Reply With Quote
 
justin_romaine
Guest
Posts: n/a

 
      09-09-2010
I certainly don't want it to be seen as a mouse
For this project, its turning into a Wah pedal MIDI controller to control amp simulators for an electric guitar
Thanks for you advice! This sounds like much more fun than writing a kernel mode HID filter driver which was my first attempt. Although it seamed possible, its was just taking up so much time.


 
Reply With Quote
 
justin_romaine
Guest
Posts: n/a

 
      09-15-2010
Thanks Tim and Philip for your excellent help! All i had to do was cobble togetther the basic example from http://msdn.microsoft.com/en-us/libr...174(VS.85).asp
along with the installation instructions
Replaced the HIDs with the particular Microsoft Wheel mouse HID and installed the winusb driver
The guts it in this bit of code. The Device only had one endpoint so there was not much choice thankfully
[code
while(bResult = WinUsb_ReadPipe(hDeviceHandle, *pID, (UCHAR*)&info, sizeof(info), &cbRead, 0)


if(cbRead > 0
printf("X move %d Y move %d buttons %u wheel direction %d\n",info.xmotion,info.ymotion,info.status,info.w heel)

[/code
So thats is the first part of my project completed
I have 2 more parts but i am starting to fear, the bit i thought would be the easiest, is actually the hardest

Now i need to create a virtual MIDI device. This i will use to present my midi events to a port that can be enumerated on the system by a sequencer or virtual instrument that uses MIDI as a controller

I thought i could somehow use winmm.dll to create the virtual device but i cant see how
i can call midiOutShortMsg(...) to send my events. But the virtual instruments are not MIDI out sources so they do not have a device id for a midi out device

The closest I have got is looking at the mpu401 and uart examples in the DDK. But thats scary back to KM again. Yuk. Too hard to debug

You guys are certainly know your stuff, and was wondering if you could give me some advice on the easiest way send my midi events to a midi port that could be selected by a MIDI application

(I could have used MIDI Mapper pre Windows 7 but its Gone to i can't route the events to the consuming application. But i certainly would prefer my own vertual port.)


 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Game Compatibility BCurrey Windows Vista Games 6 11-29-2007 08:11 PM
"can't Open kernel mode driver service" error please help! Adam4x4x Windows Vista Hardware 3 04-19-2007 11:42 AM
Going Golfing but not with Vista markbyrn Windows Vista Games 15 03-08-2007 10:59 AM
americas army stuttering under vista premium ernie Windows Vista Games 0 02-27-2007 10:20 PM
problem in dxdiag Peewee64 Windows Vista Games 0 02-14-2007 09:49 PM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59