alternative to syslog for finding devine names
I'm working with a itx mobo running a cut down version of redhat with uclibc and busy box.
My C application makes use of a number of usb devices (up to about 16) that are normally physically present at boot time.
Currently I'm reading /proc/bus/usb/devices and then using the device number to parse through syslog() output to find my device name (eg /dev/ttyUSBx).
Although this works ok there are a number of pitfalls:
1. syslog() only keeps 4k of buffer so it's possible that the items of interest might roll off. (It might be possible to increase this buffer that's a poor fix)
2. Doing string comparisons is slow and error-prone
3. The usb devices are accessed by different threads, each thread needs to know it's appropriate device names, so I must repeat the effort for each thread. (It's can't be done by a controlling thread or startup process)
Is there anyway to get the device name (/dev/ttyUSBx) without using syslog?
Or perhaps I can fix certain devices to always get the same name?
If you need help with specifics, just post. Also, thereís this thread.
I think /sys is what I'm looking for!
I didn't have the /sys directory though and didn't have sysfs mounted so I did this:
# mkdir /sys
# mount -t sysfs none /sys
and now it's all there
|All times are GMT -5. The time now is 11:18 PM.|