〜如何使用C ++ / cpp访问USB端口? 〜 [英] ~ How to access USB ports using C++/cpp ? ~

查看:109
本文介绍了〜如何使用C ++ / cpp访问USB端口? 〜的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

〜如何使用C ++ / cpp访问USB端口? 〜



我希望能够在Windows 10上使用C ++ / cpp在USB端口上读取和写入引脚(D +& D-)。 />


汇总代码非常合适。



谢谢你



我的尝试:



无法找到简单的代码。

~ How to access USB ports using C++/cpp ? ~

I would like to be able to read and write to pins (D+ & D-) on an USB port using C++/cpp on Windows 10.

Assemble code greatly appropriated.

Thank U

What I have tried:

Was not able to find simple code.

推荐答案

我想你必须去驱动程序级别,例如:如何编写第一个USB客户端驱动程序(KMDF)(Windows驱动程序) [ ^ ](假设您使用的是 Windows )。



I suppose you have to go to driver level, see, for instance: How to write your first USB client driver (KMDF) (Windows Drivers)[^] (assuming you are using Windows).

无法找到简单的代码。

我希望你打算'样本代码',因为它绝不是简单的。 : - )

I hope you intended 'sample code', for it wouldn't be simple by no means. :-)


USB驱动芯片是集成电路,内置支持处理USB协议。因此,它们没有直接设置数据线的命令。这根本没有意义,因为USB协议在初始连接时使用特定的信号状态来选择速度。



用于通过常见操作系统(如Android)进行低级别USB访问,Linux,OS X或Windows,使用像 libusb 这样的库[ ^ ]。
USB driver chips are integrated circuits with built-in support for handling the USB protocol. Therefore, they have no commands to set the data lines directly. That would make no sense at all because the USB protocol uses specific signal states upon initial connections to select the speed.

For low level access to USB with common OS like Android, Linux, OS X, or Windows, use a library like libusb[^].


这篇关于〜如何使用C ++ / cpp访问USB端口? 〜的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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