The Other Half

Hard to believe that it will be another month since the last LUFA release in only a few short days – and yet, there hasn’t been enough changes to warrant another official release just yet. That’s mostly because I’m starting to run out of things to work on, and can’t find the motivation to finish some of the large unfinished sub-projects I’ve begun.

However, I do have some exciting news. Up until now, LUFA has only solved half of the equation about USB devices — it allows for the creation of feature rich embedded devices and hosts, but doesn’t solve the “PC Problem”, or more aptly, how the hell one can drive a custom USB device from a PC. All of LUFA so far has focused on the standard classes which most operating systems support out of the box, which means no need for the creation of drivers. Those wanting to create custom devices (such as a data interface for a temperature monitor) have usually resorted to misusing the HID or CDC-ACM (virtual serial) classes for the transport of arbitrary data.

The only other options have been either to code for libusb under Linux – or, to a very limited degree, Windows – or get friendly with the Windows Driver Development Kit. I myself had a go at the latter, but as it relies heavily on Win32 API stuff, I was less than useless at getting anything to work. However, now there’s another solution.

Enter WinUSBNet. This is a MIT licensed .NET wrapper around the Windows LibUSB driver, present in Vista, Windows 7 and (once a patch is installed) XP. This gives a very user friendly way to bind to custom USB devices, using completely vendor-specific interfaces – eschewing the standard classes completely. This isn’t a cross-platform solution (libusb would be required for *nix platforms) but in the world of Windows, it makes all the difference. Seriously, try it out if you are primarily after Windows compatibility, as it works under all the .NET languages from Microsoft.

WinUSBNet is a creation of Thomas Bleeker, who as mentioned has been kind enough to make it MIT license — the same license used with LUFA. That means that by using both, you can have a custom USB device and Windows software for free, with no legal obligations other than to give both of us credit for the components used in your design.
I’ll be making a LUFA demo using WinUSBNet soon for the next release, so that people can see just how powerful the two are when used together. I’m excited, to say the least.

 

Comments: 7

Leave a reply »

 
 
 

Ah great ! I’m looking forward for your demo using the WinUSBNet wrapper ! Can you please explain what is this XP patch you are talking about, Dean ?
Right now I’m using LibUSB-Win32 with another wrapper, but I’m not satisfied with it, and it can’t detect device connection and disconnection…

Thank you Dean for your powerful library and the time you put into it,
Best wishes for this new year,
Carl

 

That’s more the domain of Thomas (creator of the WinUSBNet library). However, as I understand it, it revolves around the use of special driver INF files, which refer to a “coinstaller” package from Microsoft, which installs all the needed WinUSB components onto an XP machine during the installation of the device’s drivers. You can read a little about it here:

http://blogs.msdn.com/peterwie/archive/2007/01/10/fixing-the-umdf-usb-samples-to-install-both-on-xp-vista.aspx

Thanks Carl!
– Dean

 

There is an inf template on the wiki page of the project. You need two coinstaller dlls from the ddk (free download). This inf works on xp, vista and 7. The coinstallers will install winusb if it is not yet installed. On vista and 7 it is preinstalled but the coinstallers may contain a newer version. Documentation from Microsoft always includes the coinstallers. There is a third coinstaller for umdf but that one is only needed when writing your own driver (winusb is also an API available at driver level).

 

Thanks Thomas for your explanation.
Although my device is a dual MassStorage/HID, will I need an inf file, even for a HID device ?
I haven’t found yet a simple way to access HID device using .Net and C# under WinXP, I mean directly, I don’t want to install a layer such as LibUSB-Win32 and a wrapper around it.

Best regards,
Carl

 

Carl,

I can field this one – no, the library will not work with a HID device – it is unable to bind to any class which the OS has an automatic driver for; this includes HID, Mass Storage, Audio and other classes which do not require a custom vendor INF file to load a driver (CDC is excluded from this, as while the OS contains a driver for it, you need to supply an INF to get it to load).

– Dean

 

Thanks Dean,

I’ll keep looking for the simplest way to communicate with my compound device.
By the way, with isn’t there a MassStorageKeyboard demo in the lowlevel folder ? Not an important thing, since I can use the ClassDriver way…

Best regards,
Carl

 

Carl,

Because of the messiness of doing so. I’ve got each of the standard classes as Low Level and Class Driver demos, but only the Class Driver versions have dual-class demos — this is because I fear that a the complexity of a combined low level demo would not be particularly helpful to someone wanting to learn how to do it with the LUFA library. Of course, I am happy to do it if there is enough call for it, but I think that the majority want to use the class drivers anyway to reduce the complexity of their code.

– Dean

 

Leave a Reply

 
(will not be published)
 
 
Comment
 
 

 

Vital Stats

  • 35 Years Old
  • Australian
  • Lover of embedded systems
  • Firmware engineer
  • Self-Proclaimed Geek

Latest Blog Posts

RSS