USB 和个人创建的设备在 Windows 中使用 C/C++ 连接
我知道如何使用并行端口进行接口,并且对串行端口接口也有一些了解。但是有没有办法在 Windows 中使用 USB 端口进行连接呢?或者有任何链接可以提供有关如何执行此操作的教程吗?
具体来说,我想了解它的编程方面。
我不知道如何开始。我已经搜索过谷歌,但没有看到任何代码示例。
提前致谢,新年快乐。
I know how to interface using the parallel port and also have a little idea on serial port interfacing. But is there a way to interface using the USB port in Windows? Or any links that would give tutorials on how to do this?
Specifically, I wanted to know the programming side of it.
I don't know how to start. I have searched into google but I have not seen any code samples.
Thanks in advance and Happy New Year.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
USB 编程比串行或并行端口编程复杂得多。要为 Windows 编写 USB 驱动程序,您可能需要 Windows WDK 。但是,对于您自己构建的设备,您可以从在设备中实现串行端口类驱动程序开始,以便它在 Windows 中显示为新的串行端口。 HID 是另一个可能有用的驱动程序类,通常用于某种输入设备。
如果您想做 USB 编程,我会推荐一本好书,例如 Jan Axelson 的 USB Complete。真正的硬件协议分析仪是必不可少的。
USB programming is considerably more complex than serial or parallel port programming. For writing USB drivers for Windows, you'll probably need the Windows WDK. However, for a device you build yourself you can start with implementing a serial port class driver in your device, so that it shows up as a new serial port in Windows. The HID is another potentially useful driver class, generally used for some kind of input device.
I would recommend a good book if you want to do USB programming, for example Jan Axelson's USB Complete. And a real hardware protocol analyser is indispensable.
发现一篇有趣的博客文章 http://yeohhs.blogspot.com/2006/ 08/programming-usb-port.html
它提到了一个库“libusb”及其包装器。该库是一个 GNU 项目。其库和文档可能会很有用。 libusb的API文档在这里:http://libusb.sourceforge.net/api-1.0/
Found an interesting blog post http://yeohhs.blogspot.com/2006/08/programming-usb-port.html
it mentions a library 'libusb' and a wrapper for the same. The library is a GNU project. The library and documentation of the same may prove useful. The API documentation of libusb is here: http://libusb.sourceforge.net/api-1.0/