For a small project i am using libudev to get notification for USB devices plug-in/plug-out. Is there any way of knowing which USB port was used to plug in the device via libudev. Actually there are multiple ports available and it is necessary to know which one was used. Any hints would be highly appreciated!
Advertisement
Answer
After a bit of a research i found that it is possible using libusb.
From here, libusb can be used to get a list of all devices plugged in , now the devices discovered using libudev can be checked in the list of devices available via libusb_get_device_list
.
Further libusb_get_port_number
could be used to get the port number for the same device.