Is there a way to tell if a device is a serial port, parallel port of USB from it's name? I need this for a program I'm writing. I Want to detect which kind of device is given and treat them differently. Paul Alfille
Fri, 30 Jan 2004, by palfille@earthlink.net:
Is there a way to tell if a device is a serial port, parallel port of USB from it's name?
I need this for a program I'm writing. I Want to detect which kind of device is given and treat them differently.
Why? They're all character devices under Linux, so for the kernel there's no difference. But if must you can look at the major/minor device numbers. crw-rw---- 1 root lp 6, 0 Mar 14 2003 /dev/lp0 crw-rw---- 1 root uucp 4, 64 Mar 14 2003 /dev/ttyS0 ^^ ^^ There's a table in /usr/src/linux/Documentation/devices.txt Theo -- Theo v. Werkhoven Registered Linux user# 99872 http://counter.li.org ICBM 52 13 27N , 4 29 45E. SUSE 8.2 Kernel k_athlon-2.4.20 See headers for PGP/GPG info.
Well, I'm working with 1-wire bus adapters and THEY care. There are differnt versions for serial, parallel and USB and I'd like to autoconfigure as much as possible. My reading of the the kernel discussion suggests that fixed major/minor numbers are deprecated. Are they reliable for distinguishing serial/parallel/USB? Paul On Sat, 2004-01-31 at 18:13, Theo v. Werkhoven wrote:
Fri, 30 Jan 2004, by palfille@earthlink.net:
Is there a way to tell if a device is a serial port, parallel port of USB from it's name?
I need this for a program I'm writing. I Want to detect which kind of device is given and treat them differently.
Why? They're all character devices under Linux, so for the kernel there's no difference.
But if must you can look at the major/minor device numbers. crw-rw---- 1 root lp 6, 0 Mar 14 2003 /dev/lp0 crw-rw---- 1 root uucp 4, 64 Mar 14 2003 /dev/ttyS0 ^^ ^^ There's a table in /usr/src/linux/Documentation/devices.txt
Theo
Sat, 31 Jan 2004, by palfille@earthlink.net:
Well, I'm working with 1-wire bus adapters and THEY care. There are differnt versions for serial, parallel and USB and I'd like to autoconfigure as much as possible.
My reading of the the kernel discussion suggests that fixed major/minor numbers are deprecated. Are they reliable for distinguishing serial/parallel/USB?
I'm sorry, my knowledge stops here. Ask in the kernel dev. mailinglist. Theo -- Theo v. Werkhoven Registered Linux user# 99872 http://counter.li.org ICBM 52 13 27N , 4 29 45E. SUSE 8.2 Kernel k_athlon-2.4.20 See headers for PGP/GPG info.
participants (2)
-
Paul Alfille
-
Theo v. Werkhoven