views:

1454

answers:

2

How do I programmatically access a USB transfer cable (such as Belkin's Easy Transfer Cable) from Windows?

I'm familiar with libusb-win32, but from what I can tell, using that with newer devices and with Windows Vista seems iffy.

I know that Windows Easy Transfer can do this. How do I write code that does the same thing as Windows Easy Transfer?

If there is no canned documentation on how to do this, I'm willing to do some digging, but I don't know where to start. How do I watch what Windows Easy Transfer is doing to find out how it does it? I see that Windows even gives transfer cables their own category in the Device Manager, "Transfer Cable Devices." How do I do low-level communication with one of these these drivers?

+1  A: 

You will need to use the low level win32 API to do this. Microsoft has some nice examples here on accessing a Human Interface Device. The transfer cable isn't explicitly an HID like a mouse or keyboard, but it conforms to the HID spec.

For example, to get the name of the USB device you would call

HidD_GetProductString(...)

http://msdn.microsoft.com/en-us/library/ms790920.aspx

There is lots more there, you should definitely take a look at the sample c app that works for all versions of windows from 2000 to Vista.

http://msdn.microsoft.com/en-us/library/dd163258.aspx

Good Luck!

Byron Whitlock
Thanks, but after trying out the HID sample app, it looks like these transfer cables aren't HID compliant (although devices like my UPS's data port are).
Josh Kelley
+2  A: 

I found out that Microsoft now offers WinUSB for simple user-mode communication with USB devices. (A WinUSB device driver must first be installed for the device; this is somewhat similar to a libusb-win32 device driver.) WinUSB works on XP (SP2 and above) and Vista.

The Easy Transfer Cable uses WinUSB for its device driver, so I was able to communicate with it by following the example code in Microsoft's WinUSB howto document.

Josh Kelley