Re: can i see a driver's registered *minor* number(s)?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 11 Apr 2008, Mohamed Thalib .H wrote:

>
> On Fri, 2008-04-11 at 05:56 -0400, Robert P. J. Day wrote:
> > i know well enough that, if i write and load a driver that allocates
> > a device major number and one or more minor numbers, i can see the
> > allocated major number via /proc/devices.  but is there a userspace
> > way to see the minor number(s)?  or, as LDD3 implies, it's my job to
> > just *know* what those would have been?  thanks.
> >
> > rday
> > --
> >
> > ========================================================================
> > Robert P. J. Day
> > Linux Consulting, Training and Annoying Kernel Pedantry:
> >     Have classroom, will lecture.
> >
> > http://crashcourse.ca                          Waterloo, Ontario, CANADA
> > ========================================================================
> >
> > --
> > To unsubscribe from this list: send an email with
> > "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
> > Please read the FAQ at http://kernelnewbies.org/FAQ
> >
>
> Check out this command in the user space...
>
> ls -l /dev
>
> it gives some thing like this you can find major no is 2 and 7 and minor
> are the 23,24,25,37,38,39 etc...
>
> crw-rw-rw- 1 root   tty       2,  23 2008-04-11 19:55 ptyq7
> crw-rw-rw- 1 root   tty       2,  24 2008-04-11 19:55 ptyq8
... snip ...

  no, it's not that simple -- i'm talking about when you "insmod" a
driver and that driver uses, say, alloc_chrdev_region() to register a
major number and one or more minor numbers, but you still haven't
created any special device files for that driver yet.

  if you look on p. 47 of LDD3, there's a script called "scull_load"
that handles all the bureaucracy of loading a module and checking the
major number that's assigned, but it simply assumes minor numbers of
0-3, which just happens to be what the driver asks for.

  but let's say (theoretically) that you don't know what minor
number(s) the driver is going to ask for.  is there a way to determine
that information from userspace afterwards?  i've always assumed there
isn't, but i just thought i'd ask to see if there wasn't something i'd
just never noticed.  maybe something under /sys/module/<whatever>, or
something like that.

rday
--

========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry:
    Have classroom, will lecture.

http://crashcourse.ca                          Waterloo, Ontario, CANADA
========================================================================

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux