USB Transfer Cable Programming / Conversation with a USB Device Driver

How to programmatically access a USB transfer cable (e.g. Belkin Easy Transfer Cable ) from Windows?

I am familiar with libusb-win32 , but from what I can say, using this with newer devices and with Windows Vista seems inconvenient.

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

If there is no ready-made documentation on how to do this, I am ready to do some digging, but I do not know where to start. How to see what Windows Easy Transfer does to find out how it does it? I can see that Windows even transfers the transfer cables of its category in the "Transfer Cable Devices" device manager. How to perform low-level communication with one of these drivers?

+6
windows usb device-driver
source share
3 answers

I found out that Microsoft now offers WinUSB for easy user communication with USB devices. (First, the WinUSB device driver must be installed for the device, which is somewhat similar to the libusb-win32 device driver.) WinUSB works with XP (SP2 and higher) and Vista.

The Easy Transfer cable uses WinUSB for its device driver, so I was able to contact it by following the code example in the Microsoft WinUSB howto document.

+5
source share

To do this, you will need to use the low-level win32 API. Microsoft has some good examples of accessing a user interface device. The transfer cable is clearly not HID, like a mouse or keyboard, but conforms to the HID specification.

For example, to get the name of the USB device you are calling

HidD_GetProductString(...) 

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

There is still a lot, you definitely need to look at an example from an application that works for all versions of Windows from 2000 to Vista.

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

Good luck

+2
source share

You need a USB data cable (also called a USB data cable) that has a support API or SDK, then use the following code:

 void CU2uDlg::OnOK() { BYTE buf[65530]; LPU2URET pU2uRet; BOOL bRet; int ret; CString msgstr; ret = u2u_open(); if (ret == -1){ AfxMessageBox("Open U2U device Success."); }else{ msgstr.Format("Open U2U device fail,return:%d", ret); AfxMessageBox(msgstr); return; } //send data bRet = u2u_SendData(buf, 65530, ret); if(!bRet) { msgstr.Format("Send data error,return:%d", ret); AfxMessageBox(msgstr); return; } //receive data while (1){ bRet = u2u_RecvData(recvData, dataLen, ret); if( !bRet ) { msgstr.Format("Receive data error,return:%d", ret); AfxMessageBox(msgstr); u2u_close(); return; }else{ break; } } u2u_close(); } 

See: Reference1 , Reference2

0
source share

All Articles