-3

As we know that we can use the terminal to find the USB ports by commanding lsusb:

$ lsusb
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 004: ID 5986:02d2 Acer, Inc 
Bus 001 Device 005: ID 054c:0688 Sony Corp. 
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 034: ID 13fe:4100 Kingston Technology Company Inc. Flash drive
Bus 003 Device 033: ID 2500:0020  
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

I also went to the websites and had a lot of suggestions but they are kind of not working as the list which I expected above.

.... and so on.

I am trying to understand how to link USB input to the C++ but I am getting confuse and have no ideas with it.

Cœur
  • 37,241
  • 25
  • 195
  • 267
phuc nguyen
  • 45
  • 1
  • 5
  • 2
    `they are kind of not working` care to elaborate? Please [edit] in some addition context, like what _exactly_ is not working - with associated / relevant logs / console output. – Matt Clark Dec 20 '16 at 21:08

1 Answers1

1

On Linux, the libusb library provides a C library API for using USB devices, that should be usable with C++ too. libusb is a part of all major Linux distributions.

Sam Varshavchik
  • 114,536
  • 5
  • 94
  • 148
  • Sam Varshavchik: I am sorry for the lacking of skills on C++. That would be nice if you can help me more details, I went on the link you provided, but there are a lot of files and seem not to help me to answer my question. And I thought that will be simple solution, but getting complicated. Thank you very much. – phuc nguyen Dec 21 '16 at 02:02
  • Sam Varshavchik: I went on that link and clicked onto the "you can also access the source directly from github.", then chose the "libusb" folder, there are bunches of files, so I confused. – phuc nguyen Dec 21 '16 at 02:08