Monthly Archives: June 2009

WinUSB++ — Getting started

WinUSB is shipped as part of WDK, so the first step is to download and install WDK. Follow this link on how to get the WDK.

Once you properly get WDK installed, you should be finding the WinUSB specific header files under C:\WinDDK\6001.18002\inc\wdf\umdf\10:

winusb.h
winusbio.h
wudfddi.h
wudfddi.idl
wudfusb.h
wudfusb.idl

and lib files for linking under C:\WinDDK\6001.18002\lib\wlh\:

amd64\winusb.lib
i386\winusb.lib
ia64\winusb.lib

redistrib files can be found under D:\WinDDK\6001.18002\redist\winusb.

Now you are ready to develop your application using WinUSB.

Advertisements

WinUSB++, wrapping WinUSB

WinUSB is an attempt from Microsoft to ease USB applications on Windows XP and above.  Though it’s been around for quite a while, and seemingly MS has done a good job, I haven’t seen it widely used. I am guessing it’s attributed to the fact that many proprietary home-made drivers already existed and worked fine before it’s even developed. Vista’s marketing failure to rule out XP is another factor that people has no stimulation to develop new drivers based on WinUSB just because it’s new.

However, with the imminent Win 7 and 64-bit era, many existing XP-base driver may have to be upgraded, ant chances are more WinUSB based drivers will appear.

A few months ago, with some ST7 based devices at hands,  I spent some spare time investigating WinUSB and having ported from the ST USB Driver for Tube device v2.0.3.

In my rough test, WinUSB is a little bit slower that STTub,  some similar transaction cost about 0.36s with  STTub, but 0.40s with WinUSB. Not quite surprising as WinUSB is more generic.

The other day, when I was cleaning up the PC, I found this earlier attempts being covered with dust. I was feeling like sharing it out would be nicer.

In the future,  I’ll being finding some time and talking about how to

1) wrap this C style API thing into a C++ interface and

2) overcome its major limits – no asynchronous access to this drive, which means if you have two WinUSB based application, you cannot let them talk to WinUSB at the same time.

 

2009-06-13_110956