如何从 Windows 以编程方式访问 USB 传输电缆(例如 Belkin 的 Easy Transfer Cable)?
我熟悉 libusb-win32,但据我所知,将其与较新的设备一起使用与Windows Vista 似乎不太一样。
我知道 Windows Easy Transfer 可以做到这一点。 如何编写与 Windows Easy Transfer 功能相同的代码?
如果没有关于如何执行此操作的固定文档,我愿意进行一些挖掘,但我不知道从哪里开始。 如何观察 Windows Easy Transfer 正在执行的操作以了解其工作原理? 我发现 Windows 甚至在设备管理器中为传输电缆提供了自己的类别“传输电缆设备”。 我如何与这些驱动程序之一进行低级通信?
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?
发布评论
评论(3)
我发现 Microsoft 现在提供 WinUSB 来进行简单的用户模式通信USB 设备。 (必须首先为该设备安装 WinUSB 设备驱动程序;这有点类似于 libusb-win32 设备驱动程序。)WinUSB 可在 XP(SP2 及更高版本)和 Vista 上运行。
Easy Transfer Cable 使用 WinUSB 作为其设备驱动程序,因此我能够按照 Microsoft WinUSB howto 文档。
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.
您将需要使用低级 win32 API 来执行此操作。
微软在这里有一些关于访问人机接口设备的很好的例子。 传输电缆不像鼠标或键盘那样明确是 HID,但它符合 HID 规范。
例如,要获取 USB 设备的名称,您可以调用
http:// msdn.microsoft.com/en-us/library/ms790920.aspx
还有更多内容,您绝对应该看一下适用于从 2000 到 Vista 的所有 Windows 版本的示例 c 应用程序。
http://msdn.microsoft.com/en-us/library/dd163258。 祝你
好运!
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
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!
您需要有一根 USB 数据传输线(也称为 USB 数据连接线)
支持API或SDK,则使用如下代码:
参见:
参考1,参考2
You need to have an USB data transfer cable (also called USB data link cable) which
support API or SDK, then use the following code:
See:
Reference1, Reference2