Robert P. J. Day wrote:
On Mon, 3 Aug 2009, Mulyadi Santosa wrote:
On Mon, Aug 3, 2009 at 3:45 AM, Robert P. J. Day<rpjday@xxxxxxxxxxxxxx> wrote:
i'm guessing there's no way to do this but, if you list the file
/proc/devices, you see only the character and block devices and the
major number corresponding to them:
Character devices:
1 mem
4 /dev/vc/0
4 tty
4 ttyS
5 /dev/tty
5 /dev/console
5 /dev/ptmx
7 vcs
10 misc
13 input
14 sound
21 sg
29 fb
... etc etc ...
is there any way, from user space, to see the *minor* number region
corresponding to those entries?
How about "ls"? e.g:
$ ls -li /dev/vcs*
4472 crw-rw---- 1 vcsa tty 7, 0 2009-08-01 09:56 /dev/vcs
8296 crw-rw---- 1 vcsa tty 7, 2 2009-08-01 09:56 /dev/vcs2
7 is major number, 0 and 2 are minor number of vcs and vcs2 respectively...
no, that shows you the subsequent *user space* device file creation
results. to see what i mean, take a look at LDD3,
http://lwn.net/Kernel/LDD3/, chapter 3.
that chapter explains how a device driver can register its major and
minor numbers with, say, alloc_chrdev_region(), but that operation
does nothing about creating the appropriate the userspace /dev files
-- that has to be done as a separate operation in userspace, and it's
assumed you *know* what those minor numbers are.
i'm asking if there's a way to see the results of that kernel space
alloc_chrdev_region() call in terms of minor device numbers,
information that is not provided in /proc/devices.
The closest thing I can think of is the entries in sysfs, though these
need to be explicitly created by the driver using device_create():
$ ls -la /dev/console
crw------- 1 root dialout 5, 1 2009-08-03 08:19 /dev/console
$ find /sys -name console
/sys/devices/virtual/tty/console
/sys/class/tty/console
$ cat /sys/class/tty/console/dev
5:1
$
--
Martyn Welch MEng MPhil MIET (Principal Software Engineer) T:+44(0)1327322748
GE Fanuc Intelligent Platforms Ltd, |Registered in England and Wales
Tove Valley Business Park, Towcester, |(3828642) at 100 Barbirolli Square,
Northants, NN12 6PF, UK T:+44(0)1327359444 |Manchester,M2 3AB VAT:GB 927559189
--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ