(btw, Bill, reply-to-all is customary on almost all Linux-related
mailing lists)

On Wed, 28 Sep 2005 23:01:01 -0400 (EDT) Alan Stern wrote:

> On Wed, 28 Sep 2005, Bill Rees wrote:
> 
> > Randy.Dunlap wrote:
> > 
> > >On Wed, 28 Sep 2005, Bill Rees wrote:
> > >
> > >>Hi All,
> > >>
> > >>First of all, are driver versions located anywhere in the sysfs tree?
> > >>I've looked through the code of some devices and didn't see any.  What
> > >>I'ld like to do is add a software driver version to the sysfs tree but
> > >>don't know the proper location to do so.  I'm thinking of
> > >>/sys/modules/<module name>/version.  Does this work for everybody?
> > >>    
> > >>
> >
> > >why do it in the kernel at all vs. using 'modinfo'?

| Well, I'ld like to read the version info programmitcally so a user mode 
| app can modify its behaviour based on  the version of the driver 
| software.  I'm don't know how to programmitically read the version info 
| from the module.

A program can find the kernel version by using the uname(2) syscall,
then it can exec modinfo and capture its output, giving modinfo
the driver filename, such as
/lib/modules/2.6.14-rc1-git4/kernel/drivers/usb/serial/usbserial.ko
which prints:
filename:       
/lib/modules/2.6.14-rc1-git4/kernel/drivers/usb/serial/usbserial.ko
author:         Greg Kroah-Hartman, [EMAIL PROTECTED], 
http://www.kroah.com/linux/
description:    USB Serial Driver core
version:        v2.0
license:        GPL
vermagic:       2.6.14-rc1-git4 SMP PENTIUM4 gcc-3.3
depends:        
srcversion:     4FF6D384DFAB92E5FB64CB5
parm:           product:User specified USB idProduct (ushort)
parm:           vendor:User specified USB idVendor (ushort)
parm:           debug:Debug enabled or not (bool)
<EOF>

and then just grab the "version:" line and you have it.
Yes, it's probably a few more lines of userspace source code
than opening and reading /sys/whatchamacallit/version
(after you determine the value of whatchamacallit), but
it's userspace, not kernel code.  :)

Ah fudge, it's already there!!!  You just missed it.
See /sys/module/usbserial/version: v2.0

oh well...


> >
> > Besides, the version info I get from modinfo doesn't seem to correlate 
> > with the driver version at all.

Examples, please.  or maybe we aren't talking about the same
version numbers (a la Alan's question).

> What driver versions are you talking about?  Many drivers don't have real 
> version numbers.  At least, not ones that are updated religiously.  That 
> more or less stopped when Bitkeeper was adopted.

There have been some recent patches adding the use of
MODULE_VERSION() to about 150 drivers so far, and I expect to see
more...

> Besides, the kernel version alone should suffice to identify the version
> of every driver within it.

That should be good enough for developers, don't know if it's
good enough for app software.

---
~Randy


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to