Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
~ 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.
Posted
Updated 21-Dec-16 0:36am
Comments
[no name] 21-Dec-16 8:36am    
You haven't told us your application so you may be barking up the wrong tree. These pins are normally abstracted. Data is accessed via endpoints from the device's enumerated interfaces. Perhaps you should read this: USB in a NutShell - Chapter 1 - Introduction[^]

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).

"Was not able to find simple code."
I hope you intended 'sample code', for it wouldn't be simple by no means. :-)
 
Share this answer
 
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[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900