sensors-detect and udev
PATCH 1/1 sensors-detect and udev
Hi all!
sensors-detect currently checks at the beginning of its execution if the i2c device nodes exists. It can't work on a system using udev as the nodes are created when the i2c-dev module is inserted.
The attached patch fixes that.
Bye,
Aurelien
Signature · 25 lines
.''`. Aurelien Jarno GPG: 1024D/F1BCDB73 : :' : Debian GNU/Linux developer | Electrical Engineer `. `' [email protected] | [email protected] `- people.debian.org/~aurel32 | www.aurel32.net -------------- next part -------------- Index: prog/detect/sensors-detect =================================RCS file: /home/cvs/lm_sensors2/prog/detect/sensors-detect,v retrieving revision 1.338 diff -u -1 -b -p -r1.338 sensors-detect --- prog/detect/sensors-detect 31 Jul 2004 16:09:37 -0000 1.338 +++ prog/detect/sensors-detect 10 Aug 2004 23:10:18 -0000 @@ -1805,2 +1805,8 @@ sub initialize_conf + my $use_udev = 0; + if (-d './dev') { + $use_udev = 1; + $dev_i2c = '/dev/i2c-'; + } + if (-f '/etc/modules.conf') { @@ -1813,3 +1819,3 @@ sub initialize_conf - if (!$use_devfs) { + if ((!$use_devfs) and (!$use_udev)) { if (-c '/dev/i2c-0') {
PATCH 1/1 sensors-detect and udev
Quoted 2 lines · Jean Delvare
Please use "&&" instead of "and". Also notice that !(A && B) is more efficient than (!A) && (!B), but I admit I am splitting hairs here ;)
I hope you meant !(A||B), or you better re-read DeMorgan. ;)
Regards,
Signature · 2 lines
Mark M. Hoffman [email protected]
PATCH 1/1 sensors-detect and udev
In reply to Aurelien JarnoQuoted 5 lines
sensors-detect currently checks at the beginning of its execution if the i2c device nodes exists. It can't work on a system using udev as the nodes are created when the i2c-dev module is inserted.
The attached patch fixes that.
I don't get this:
+ if (-d './dev') {
How does the existence of a directory named "dev" in the current directory (which can be just anything) demonstrate the use of udev?
And could you please explain how udev is working? I don't know anything about it.
Also,
+ if ((!$use_devfs) and (!$use_udev)) {
Please use "&&" instead of "and". Also notice that !(A && B) is more efficient than (!A) && (!B), but I admit I am splitting hairs here ;)
Thanks.
Signature · 2 lines
Jean "Khali" Delvare http://khali.linux-fr.org/
PATCH 1/1 sensors-detect and udev
In reply to Aurelien JarnoQuoted 3 lines · Jean Delvare
And could you please explain how udev is working? I don't know anything about it.
udev manages the /dev tree from userspace based on the kernel information in sysfs. A good summary of it is at:
http://www.linuxjournal.com/article.php?sids16
There's also some older info linked off of:
www.kroah.com/linux/
to an OLS paper, an OLS presentation, and a more recent OSCON presentation on it.
Hope this helps explain it.
thanks,
greg k-h
PATCH 1/1 sensors-detect and udev
In reply to Aurelien JarnoQuoted 6 lines · Jean Delvare
Quoted 3 lines
Please use "&&" instead of "and". Also notice that !(A && B) is more efficient than (!A) && (!B), but I admit I am splitting hairs here ;)
I hope you meant !(A||B), or you better re-read DeMorgan. ;)
Aha, yeah, of course. Thanks for making me feel ridiculous ;)
Signature · 2 lines
Jean "Khali" Delvare http://khali.linux-fr.org/
PATCH 1/1 sensors-detect and udev
In reply to Aurelien JarnoQuoted 9 lines · Jean Delvare
Quoted 5 lines
sensors-detect currently checks at the beginning of its execution if the i2c device nodes exists. It can't work on a system using udev as the nodes are created when the i2c-dev module is inserted.
The attached patch fixes that.
I don't get this:
+ if (-d './dev') {
It's a typo, I made the patch to quickly. Should be if (-d './dev') {
Quoted 4 lines
+ if ((!$use_devfs) and (!$use_udev)) {
Please use "&&" instead of "and". Also notice that !(A && B) is more efficient than (!A) && (!B), but I admit I am splitting hairs here ;)
Ok, changed.
New patch attached.
Aurelien
Signature · 25 lines
.''`. Aurelien Jarno GPG: 1024D/F1BCDB73 : :' : Debian GNU/Linux developer | Electrical Engineer `. `' [email protected] | [email protected] `- people.debian.org/~aurel32 | www.aurel32.net -------------- next part -------------- Index: prog/detect/sensors-detect =================================RCS file: /home/cvs/lm_sensors2/prog/detect/sensors-detect,v retrieving revision 1.338 diff -u -1 -b -p -r1.338 sensors-detect --- prog/detect/sensors-detect 31 Jul 2004 16:09:37 -0000 1.338 +++ prog/detect/sensors-detect 10 Aug 2004 23:10:18 -0000 @@ -1805,2 +1805,8 @@ sub initialize_conf + my $use_udev = 0; + if (-d '/.dev') { + $use_udev = 1; + $dev_i2c = '/dev/i2c-'; + } + if (-f '/etc/modules.conf') { @@ -1813,3 +1819,3 @@ sub initialize_conf - if (!$use_devfs) { + if (!($use_devfs || $use_udev)) { if (-c '/dev/i2c-0') {
PATCH 1/1 sensors-detect and udev
In reply to Aurelien JarnoQuoted 5 lines · Aurelien Jarno
Quoted 4 lines · Jean Delvare
Quoted 4 lines
sensors-detect currently checks at the beginning of its execution if the i2c device nodes exists. It can't work on a system using udev as the nodes are created when the i2c-dev module is inserted.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
The attached patch fixes that.
I don't get this:
+ if (-d './dev') {
It's a typo, I made the patch to quickly. Should be if (-d './dev') {
I still don't see how that shows if you are running on a udev system or not. Why not check for /dev/.udev.tdb or grep the process list for udevd (hm, but SLES 9 will fail that one, even though it's using udev.)
thanks,
greg k-h
PATCH 1/1 sensors-detect and udev
In reply to Aurelien JarnoQuoted 10 lines · Greg KH
Quoted 9 lines · Aurelien Jarno
Quoted 8 lines · Jean Delvare
Quoted 5 lines
sensors-detect currently checks at the beginning of its execution if the i2c device nodes exists. It can't work on a system using udev as the nodes are created when the i2c-dev module is inserted.
The attached patch fixes that.
I don't get this:
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
+ if (-d './dev') {
It's a typo, I made the patch to quickly. Should be if (-d './dev') {
I still don't see how that shows if you are running on a udev system or not. Why not check for
/dev/.udev.tdbor grep the process list for udevd (hm, but SLES 9 will fail that one, even though it's using udev.)
I personnaly don't know very well udev, so I used the same way as /dev/MAKEDEV.sh which is checking for /.dev.
But it you know udevt better than me, so I have made a new patch (attached) using your solution.
Aurelien
Signature · 25 lines
.''`. Aurelien Jarno GPG: 1024D/F1BCDB73 : :' : Debian GNU/Linux developer | Electrical Engineer `. `' [email protected] | [email protected] `- people.debian.org/~aurel32 | www.aurel32.net -------------- next part -------------- Index: prog/detect/sensors-detect =================================RCS file: /home/cvs/lm_sensors2/prog/detect/sensors-detect,v retrieving revision 1.338 diff -u -1 -b -p -r1.338 sensors-detect --- prog/detect/sensors-detect 31 Jul 2004 16:09:37 -0000 1.338 +++ prog/detect/sensors-detect 10 Aug 2004 23:10:18 -0000 @@ -1805,2 +1805,8 @@ sub initialize_conf + my $use_udev = 0; + if (-d '/dev/.udev.tdb') { + $use_udev = 1; + $dev_i2c = '/dev/i2c-'; + } + if (-f '/etc/modules.conf') { @@ -1813,3 +1819,3 @@ sub initialize_conf - if (!$use_devfs) { + if (!($use_devfs || $use_udev)) { if (-c '/dev/i2c-0') {
PATCH 1/1 sensors-detect and udev
In reply to Aurelien JarnoQuoted 1 line · Aurelien Jarno
New patch attached.
I forget that /dev/.udev.tdb is a file, not a directory. Thanks to Khali who tell me about that.
Again, new patch attached.
Aurelien
Signature · 25 lines
.''`. Aurelien Jarno GPG: 1024D/F1BCDB73 : :' : Debian GNU/Linux developer | Electrical Engineer `. `' [email protected] | [email protected] `- people.debian.org/~aurel32 | www.aurel32.net -------------- next part -------------- Index: prog/detect/sensors-detect =================================RCS file: /home/cvs/lm_sensors2/prog/detect/sensors-detect,v retrieving revision 1.338 diff -u -1 -b -p -r1.338 sensors-detect --- prog/detect/sensors-detect 31 Jul 2004 16:09:37 -0000 1.338 +++ prog/detect/sensors-detect 10 Aug 2004 23:10:18 -0000 @@ -1805,2 +1805,8 @@ sub initialize_conf + my $use_udev = 0; + if (-f '/dev/.udev.tdb') { + $use_udev = 1; + $dev_i2c = '/dev/i2c-'; + } + if (-f '/etc/modules.conf') { @@ -1813,3 +1819,3 @@ sub initialize_conf - if (!$use_devfs) { + if (!($use_devfs || $use_udev)) { if (-c '/dev/i2c-0') {
PATCH 1/1 sensors-detect and udev
In reply to Aurelien JarnoQuoted 10 lines · Jean Delvare
Quoted 5 lines
udev manages the /dev tree from userspace based on the kernel information in sysfs. A good summary of it is at:
http://www.linuxjournal.com/article.php?sids16
(...)
Hope this helps explain it.Thanks, that was a perfectly clear explanation.
(Note: I think there's a little error in the article. Minors were originally from 0 to 255, not 1 to 255.)
Oops, good catch, you are correct.
greg k-h
PATCH 1/1 sensors-detect and udev
In reply to Aurelien JarnoQuoted 5 lines
udev manages the /dev tree from userspace based on the kernel information in sysfs. A good summary of it is at:
http://www.linuxjournal.com/article.php?sids16
(...)
Hope this helps explain it.
Thanks, that was a perfectly clear explanation.
(Note: I think there's a little error in the article. Minors were originally from 0 to 255, not 1 to 255.)
Signature · 2 lines
Jean "Khali" Delvare http://khali.linux-fr.org/
PATCH 1/1 sensors-detect and udev
In reply to Aurelien JarnoQuoted 5 lines
Quoted 3 lines
I don't get this:
+ if (-d './dev') {
It's a typo, I made the patch to quickly. Should be if (-d './dev') {
Oh, really? I thought it should instead be:
+ if (-d './dev') {
;)
Signature · 2 lines
Jean "Khali" Delvare http://khali.linux-fr.org/
Jean Delvare
AppliedPATCH 1/1 sensors-detect and udev
In reply to Aurelien JarnoQuoted 4 lines
I forget that
/dev/.udev.tdbis a file, not a directory. Thanks to Khali who tell me about that.Again, new patch attached.
Applied, thanks.
Signature · 2 lines
Jean "Khali" Delvare http://khali.linux-fr.org/