On Tue, 19 Mar 2002, Nemosoft Unv. wrote:

>> > As to the /devfs name... Could be done, but I would like to put the
>> > amount of logic that is needed ina user program to a minimum, so 'old'
>> > style /dev should be listed as well.
>>
>> Major/minor is all that is really needed.  If you're using devfs you can
>> manipulate devfsd to let you know that a new device has shown up, and
>> what its name is.
>
>Agreed, it's all that is *really* needed. Yet, I do not want to put the
>burden on each and every programmer to implement a whole
>major-to-devicename over and over again.

To provide the /dev/ name, devices.c would have to maintain a table of
device major/minor mappings to conventional names, like the
devices.txt file...and as has been said, there is no guarantee of that
name actually being used.

while all that has to be done from userspace is
ls -l /dev | grep "^T.* MMM, NNN" | cut -c57-

where T is b or c, MMM is space-filled major, NNN is space-filled
minor.

More reliable and probably no slower is
file /dev/* | grep "character special (MMM/NNN)"

or 'block special' of course.  MMM/NNN is not space-filled.

I guess to add /dev/ recursion it would have to be something like
find /dev/ -name \* | file -f - | grep "etc..."

plus 2>/dev/null to ignore errs...

so, not simple, but isn't that much easier than maintaining a
major/minor -> name table?


-- 
Dan Streetman
[EMAIL PROTECTED]
--------------------------------------------------
186,282 miles per second:
It isn't just a good idea, it's the law!


_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to