I'm trying to write a C program that goes through all USB devices and extracts some information from them. When I run ls /sys/bus/usb/devices from the terminal, I get this output:

1-0:1.0    1-1.1      1-1.2      1-1.2:1.1  usb1
1-1        1-1.1:1.0  1-1.2:1.0  1-1:1.0

However, running ls within a system() call in C only shows the following devices:

1-0:1.0    1-1        1-1.1      1-1.1:1.0  1-1:1.0    usb1

I can't think of a reason why the rest of the devices aren't showing, maybe something to do with permissions? Is there anyway to get all of them to display?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.