All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sensors-detect and udev
@ 2005-05-19  6:25 Aurelien Jarno
  2005-05-19  6:25 ` Jean Delvare
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: Aurelien Jarno @ 2005-05-19  6:25 UTC (permalink / raw)
  To: lm-sensors

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

-- 
  .''`.  Aurelien Jarno	              GPG: 1024D/F1BCDB73
 : :' :  Debian GNU/Linux developer | Electrical Engineer
 `. `'   aurel32@debian.org         | aurelien@aurel32.net
   `-    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') {

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] sensors-detect and udev
  2005-05-19  6:25 [PATCH] sensors-detect and udev Aurelien Jarno
@ 2005-05-19  6:25 ` Jean Delvare
  2005-05-19  6:25 ` Greg KH
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Jean Delvare @ 2005-05-19  6:25 UTC (permalink / raw)
  To: lm-sensors

> 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.

-- 
Jean "Khali" Delvare
http://khali.linux-fr.org/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] sensors-detect and udev
  2005-05-19  6:25 [PATCH] sensors-detect and udev Aurelien Jarno
                   ` (4 preceding siblings ...)
  2005-05-19  6:25 ` Jean Delvare
@ 2005-05-19  6:25 ` Mark M. Hoffman
  2005-05-19  6:25 ` Greg KH
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Mark M. Hoffman @ 2005-05-19  6:25 UTC (permalink / raw)
  To: lm-sensors

* Jean Delvare <khali@linux-fr.org> [2004-08-11 20:36:51 +0200]:
> 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,

-- 
Mark M. Hoffman
mhoffman@lightlink.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] sensors-detect and udev
  2005-05-19  6:25 [PATCH] sensors-detect and udev Aurelien Jarno
                   ` (3 preceding siblings ...)
  2005-05-19  6:25 ` Jean Delvare
@ 2005-05-19  6:25 ` Jean Delvare
  2005-05-19  6:25 ` Mark M. Hoffman
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Jean Delvare @ 2005-05-19  6:25 UTC (permalink / raw)
  To: lm-sensors

> * Jean Delvare <khali@linux-fr.org> [2004-08-11 20:36:51 +0200]:
> > 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 ;)

-- 
Jean "Khali" Delvare
http://khali.linux-fr.org/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] sensors-detect and udev
  2005-05-19  6:25 [PATCH] sensors-detect and udev Aurelien Jarno
                   ` (7 preceding siblings ...)
  2005-05-19  6:25 ` Aurelien Jarno
@ 2005-05-19  6:25 ` Greg KH
  2005-05-19  6:25 ` Jean Delvare
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Greg KH @ 2005-05-19  6:25 UTC (permalink / raw)
  To: lm-sensors

On Wed, Aug 11, 2004 at 08:36:51PM +0200, Jean Delvare wrote:
> 
> 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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] sensors-detect and udev
  2005-05-19  6:25 [PATCH] sensors-detect and udev Aurelien Jarno
  2005-05-19  6:25 ` Jean Delvare
  2005-05-19  6:25 ` Greg KH
@ 2005-05-19  6:25 ` Aurelien Jarno
  2005-05-19  6:25 ` Jean Delvare
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Aurelien Jarno @ 2005-05-19  6:25 UTC (permalink / raw)
  To: lm-sensors

On Wed, Aug 11, 2004 at 08:36:51PM +0200, Jean Delvare wrote:
> > 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') {

> +  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

-- 
  .''`.  Aurelien Jarno	              GPG: 1024D/F1BCDB73
 : :' :  Debian GNU/Linux developer | Electrical Engineer
 `. `'   aurel32@debian.org         | aurelien@aurel32.net
   `-    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') {

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] sensors-detect and udev
  2005-05-19  6:25 [PATCH] sensors-detect and udev Aurelien Jarno
  2005-05-19  6:25 ` Jean Delvare
@ 2005-05-19  6:25 ` Greg KH
  2005-05-19  6:25 ` Aurelien Jarno
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Greg KH @ 2005-05-19  6:25 UTC (permalink / raw)
  To: lm-sensors

On Thu, Aug 12, 2004 at 01:11:16AM +0200, Aurelien Jarno wrote:
> On Wed, Aug 11, 2004 at 08:36:51PM +0200, Jean Delvare wrote:
> > > 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') {

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] sensors-detect and udev
  2005-05-19  6:25 [PATCH] sensors-detect and udev Aurelien Jarno
                   ` (9 preceding siblings ...)
  2005-05-19  6:25 ` Jean Delvare
@ 2005-05-19  6:25 ` Aurelien Jarno
  2005-05-19  6:25 ` Jean Delvare
  11 siblings, 0 replies; 13+ messages in thread
From: Aurelien Jarno @ 2005-05-19  6:25 UTC (permalink / raw)
  To: lm-sensors

On Wed, Aug 11, 2004 at 05:21:17PM -0700, Greg KH wrote:
> On Thu, Aug 12, 2004 at 01:11:16AM +0200, Aurelien Jarno wrote:
> > On Wed, Aug 11, 2004 at 08:36:51PM +0200, Jean Delvare wrote:
> > > > 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') {
> 
> 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.)
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

-- 
  .''`.  Aurelien Jarno	              GPG: 1024D/F1BCDB73
 : :' :  Debian GNU/Linux developer | Electrical Engineer
 `. `'   aurel32@debian.org         | aurelien@aurel32.net
   `-    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') {

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] sensors-detect and udev
  2005-05-19  6:25 [PATCH] sensors-detect and udev Aurelien Jarno
                   ` (2 preceding siblings ...)
  2005-05-19  6:25 ` Aurelien Jarno
@ 2005-05-19  6:25 ` Jean Delvare
  2005-05-19  6:25 ` Jean Delvare
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Jean Delvare @ 2005-05-19  6:25 UTC (permalink / raw)
  To: lm-sensors

> 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.)

-- 
Jean "Khali" Delvare
http://khali.linux-fr.org/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] sensors-detect and udev
  2005-05-19  6:25 [PATCH] sensors-detect and udev Aurelien Jarno
                   ` (8 preceding siblings ...)
  2005-05-19  6:25 ` Greg KH
@ 2005-05-19  6:25 ` Jean Delvare
  2005-05-19  6:25 ` Aurelien Jarno
  2005-05-19  6:25 ` Jean Delvare
  11 siblings, 0 replies; 13+ messages in thread
From: Jean Delvare @ 2005-05-19  6:25 UTC (permalink / raw)
  To: lm-sensors

> > 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') {

;)

-- 
Jean "Khali" Delvare
http://khali.linux-fr.org/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] sensors-detect and udev
  2005-05-19  6:25 [PATCH] sensors-detect and udev Aurelien Jarno
                   ` (6 preceding siblings ...)
  2005-05-19  6:25 ` Greg KH
@ 2005-05-19  6:25 ` Aurelien Jarno
  2005-05-19  6:25 ` Greg KH
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Aurelien Jarno @ 2005-05-19  6:25 UTC (permalink / raw)
  To: lm-sensors

On Thu, Aug 12, 2004 at 01:11:16AM +0200, Aurelien Jarno wrote:
> 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
 
-- 
  .''`.  Aurelien Jarno	              GPG: 1024D/F1BCDB73
 : :' :  Debian GNU/Linux developer | Electrical Engineer
 `. `'   aurel32@debian.org         | aurelien@aurel32.net
   `-    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') {

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] sensors-detect and udev
  2005-05-19  6:25 [PATCH] sensors-detect and udev Aurelien Jarno
                   ` (5 preceding siblings ...)
  2005-05-19  6:25 ` Mark M. Hoffman
@ 2005-05-19  6:25 ` Greg KH
  2005-05-19  6:25 ` Aurelien Jarno
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Greg KH @ 2005-05-19  6:25 UTC (permalink / raw)
  To: lm-sensors

On Thu, Aug 12, 2004 at 08:01:36PM +0200, Jean Delvare wrote:
> > 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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] sensors-detect and udev
  2005-05-19  6:25 [PATCH] sensors-detect and udev Aurelien Jarno
                   ` (10 preceding siblings ...)
  2005-05-19  6:25 ` Aurelien Jarno
@ 2005-05-19  6:25 ` Jean Delvare
  11 siblings, 0 replies; 13+ messages in thread
From: Jean Delvare @ 2005-05-19  6:25 UTC (permalink / raw)
  To: lm-sensors

> I forget that /dev/.udev.tdb is a file, not a directory. Thanks to
> Khali who tell me about that.
> 
> Again, new patch attached.

Applied, thanks.

-- 
Jean "Khali" Delvare
http://khali.linux-fr.org/

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2005-05-19  6:25 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-19  6:25 [PATCH] sensors-detect and udev Aurelien Jarno
2005-05-19  6:25 ` Jean Delvare
2005-05-19  6:25 ` Greg KH
2005-05-19  6:25 ` Aurelien Jarno
2005-05-19  6:25 ` Jean Delvare
2005-05-19  6:25 ` Jean Delvare
2005-05-19  6:25 ` Mark M. Hoffman
2005-05-19  6:25 ` Greg KH
2005-05-19  6:25 ` Aurelien Jarno
2005-05-19  6:25 ` Greg KH
2005-05-19  6:25 ` Jean Delvare
2005-05-19  6:25 ` Aurelien Jarno
2005-05-19  6:25 ` Jean Delvare

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.