使用USB设备 [英] Working with USB Devices

查看:112
本文介绍了使用USB设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我目前正在尝试构建可通过DFU对设备进行编程的应用程序.我有一个具有我需要的所有功能和方法的应用程序编程接口,我的问题是该API是C ++,我试图将其转换为C#,但是我很难理解我需要做什么.目前,我能够识别连接到PC的所有USB设备,此链接证明是非常有用的,现在我需要根据我发现的API指南获取到该设备的符号链接.我不确定它们对符号链接的含义.

我还有一个问题是设备的句柄是设备ID还是PnpID?

我知道它们是非常基本的概念,但是如果您能向我介绍教程或解释我需要知道的内容的文章,那么我将很难理解它们,对此我们将不胜感激.

谢谢.

Hi,

I am currently trying to build an application that would program a device through DFU. I have an application programming interface with all the functions and methods I need, my problem is that the API is in C++, I am trying to translate it to C# but I am having a hard time understanding what I need to do. Currently I am able to identify all the usb devices connected to the pc,this link turned out to be very helpful, now I need to get the Symbolic link to the device according to the API guide I found. I am not sure what they mean by symbolic link.

Another question I have is the handle of the device is the device ID or the PnpID?

I know they are very basic concepts, but I am having a hard time to understand them, if you could point me to a tutorial, or article explaining what I need to know I would gladly appreciate it.

Thanks.

推荐答案



符号链接是指向文件系统中的文件夹/目录(NTFS,FAT32,ext2、3等)的链接.
因此,在这种情况下,指向您设备的符号链接可能是指向I:\(USB大容量存储设备的设备字母).

到设备ID和PNP-ID:
所有Plug n''Play(so ... PNP)设备都必须包含一个deviceID,以便操作系统可以唯一地识别该设备,以便为该设备加载正确的驱动程序,PNP-ID是Vendor-ID的组合和设备ID.

这是一个很棒的库,信息和示例,您可以轻松使用它们:

用于C#的USB HID组件 [ http://sourceforge.net/projects/libusbdotnet/ [ http://www.developerfusion.com/article/84338/making-usb-c-friendly / [ ^ ]

枚举和自动检测USB驱动器 [用于检测USB设备的USB库 [ ^ ]


不幸的是,我不知道您所说的将通过DFU对设备进行编程的意思."
与RAS/DFU通信的方式有多种,具体取决于您要自己编写多少代码.

通过P/Invoke使用RASAPI32.dll:
http://www.pinvoke.net/default.aspx/rasapi32.rasdial [ ^ ]

易于使用的库:
http://dotras.codeplex.com/ [ ^ ]

在您完成研究过程后,我们将竭诚欢迎您提供大量信息,更多特定问题;)

问候

PS:您不一定需要使用C ++ API来实现此目的.
Hi,

a symbolic link is a link to a folder/directory within your file system (NTFS,FAT32,ext2,3, ...).
So in this case the symbolic link to your device could be to i.e. I:\ (the device letter of your USB Mass Storage Device).

To Device ID''s and PNP-ID''s:
All Plug n'' Play (so...PNP) devices must contain a deviceID in order to allow the OS to uniquely recognize the device to load the correct driver for this device, the PNP-ID is a combination of the Vendor-ID and device-ID.

Here is a great libraries,infos and examples you can easily work with:

A USB HID Component for C#[^]

http://sourceforge.net/projects/libusbdotnet/[^]

http://www.developerfusion.com/article/84338/making-usb-c-friendly/[^]

Enumerate and Auto-Detect USB Drives[^]

A USB Library to Detect USB Devices[^]


Unfortunately I don''t know what you mean with "that would program a device through DFU."
There are several ways to communicate with RAS/DFU, depends how much code you want to write by yourself.

Using RASAPI32.dll by P/Invoke:
http://www.pinvoke.net/default.aspx/rasapi32.rasdial[^]

Easy-To-Use Library:
http://dotras.codeplex.com/[^]

Much Information, more specified questions are always welcome after your research process ;)

Regards

PS: You don''t necessarily need to use a C++ API to achieve this.


SerialPort类对此非常有用: ^ ].另请参见 http://www.developerfusion.com/article/84338/making-usb-c -friendly/ [^ ]
The SerialPort class is great for this: http://msdn.microsoft.com/en-us/library/system.io.ports.serialport.aspx[^]. also see http://www.developerfusion.com/article/84338/making-usb-c-friendly/[^]


这篇关于使用USB设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆