Retrieve device information in Linux from device file descriptor using c++ -
how can device info including device name device file descriptor? for example, in skype can see device "/dev/snd/pcmc2d0c" has name: "usb 2.0 camera. usb audio default audio device (default:card=camera)" how can such device name using c++? int file = open("/dev/snd/pcmc2d0c", o_rdwr | o_nonblock, 0); if (-1 == file) // check error occurred during opening? { perror("open"); return -1; } if (-1 == ioctl(file, /* appropriate ioctl value device info? */, /* appropriate structure fill device info? */)) { perror("ioctl"); return -1; } there no ioctl values getting device information. in special case it's usb device, has other sources device type information. you can sysfs file system, mounted @ /sys . there directory /sys/bus/usb/devices/ , has symbolic link entries pointing real devices. on system, there example /sys/bus/usb/devices/3-4 . symbolic link leads directory /sys/devices/pci0000:00/0000:...