2

I want to create a small program, where I read from a serial port in C. Up to this point it works fine and does exactly what I want it to do.

But how can I get the port (/dev/something) from the device name? Using lsusb, I for example got this entry for my keyboard:

Bus 020 Device 007: ID 24ae:2000 24ae RAPOO 2.4G Wireless Device

On the right hand side I get something like "RAPOO Device", which is the vendor or name of the device. Can I get the port, where that device is currently connected to with any C function on Linux?

Edit: Check this example Improper output using libusb for a possible solution!

F_Schmidt
  • 902
  • 1
  • 11
  • 32
  • No, I need a function in the programming language C! – F_Schmidt Jul 20 '20 at 17:20
  • 1
    Check out the source code for lsusb: https://github.com/gregkh/usbutils/blob/master/lsusb.c – Lee Daniel Crocker Jul 20 '20 at 17:26
  • I retract my duplicate, the right one can be https://stackoverflow.com/questions/29083184/improper-output-using-libusb but I cannot vote again for it – bruno Jul 20 '20 at 17:29
  • Okay, well that duplicate works better for me. I want to pass my program a string representing the usb name. Then the program should search where the port / mounting point is. – F_Schmidt Jul 20 '20 at 17:31

0 Answers0