User avatar
mad-hatter
Posts: 419
Joined: Sun Feb 26, 2012 2:58 pm
Location: By the UK seaside

C++/Qt4 - Accessing USB devices

Sun Sep 21, 2014 5:48 pm

Hello,

When the program starts the quantity of USB devices is unknown.
I'm enumerating through my attached USB devices to find the ones I'm interested in,
in a 'C' routine callled from a 'C++' routine, the only differences are as shown.
How can I access each USB device found from the calling 'C++' routine?

Any help or pointers will be appriciated.

Regards

Code: Select all

printf("Device node path - %s\n", (udev_device_get_devnode(dev))); //dev/hidraw
printf("product          - %s\n", (udev_device_get_sysattr_value(dev, "product")));
printf("id vendor        - %s\n", (udev_device_get_sysattr_value(dev, "idVendor")));
printf("id product       - %s\n", (udev_device_get_sysattr_value(dev, "idProduct")));
printf("id manu          - %s\n", (udev_device_get_sysattr_value(dev, "manufacturer")));
printf("serial           - %s\n", (udev_device_get_sysattr_value(dev, "serial")));
printf("count            - %d\n\n", Count);

Code: Select all

Differences:-
Device node path - /dev/bus/usb/001/011
count            - 1
Device node path - /dev/bus/usb/001/012
count            - 2
Device node path - /dev/bus/usb/001/013
count            - 3

Return to “C/C++”