Linux-Hwmon Archive on lore.kernel.org
 help / Atom feed
* How to detect which device is mapped to hwmonX ?
@ 2018-12-11 20:30 Ranran
  2018-12-11 21:13 ` Guenter Roeck
  0 siblings, 1 reply; 5+ messages in thread
From: Ranran @ 2018-12-11 20:30 UTC (permalink / raw)
  To: linux-hwmon

Hello,

I have several nodes /sys/class/hwmon/hwmonX ,
but checking the fields I could not find yet a way how to identify a
device (for example i2c address) to the given mapping of hwmonX.

Is there a way to find out which device is mapped to which hwmonX ?

Thanks,
ran

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

* Re: How to detect which device is mapped to hwmonX ?
  2018-12-11 20:30 How to detect which device is mapped to hwmonX ? Ranran
@ 2018-12-11 21:13 ` Guenter Roeck
  2018-12-12  8:54   ` Ranran
  0 siblings, 1 reply; 5+ messages in thread
From: Guenter Roeck @ 2018-12-11 21:13 UTC (permalink / raw)
  To: Ranran; +Cc: linux-hwmon

On Tue, Dec 11, 2018 at 10:30:58PM +0200, Ranran wrote:
> Hello,
> 
> I have several nodes /sys/class/hwmon/hwmonX ,
> but checking the fields I could not find yet a way how to identify a
> device (for example i2c address) to the given mapping of hwmonX.
> 
> Is there a way to find out which device is mapped to which hwmonX ?
> 

Maybe libsensors would work for you ?

Guenter

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

* Re: How to detect which device is mapped to hwmonX ?
  2018-12-11 21:13 ` Guenter Roeck
@ 2018-12-12  8:54   ` Ranran
  2018-12-12 10:33     ` Jean Delvare
  0 siblings, 1 reply; 5+ messages in thread
From: Ranran @ 2018-12-12  8:54 UTC (permalink / raw)
  To: linux; +Cc: linux-hwmon

On Tue, Dec 11, 2018 at 11:13 PM Guenter Roeck <linux@roeck-us.net> wrote:
>
> On Tue, Dec 11, 2018 at 10:30:58PM +0200, Ranran wrote:
> > Hello,
> >
> > I have several nodes /sys/class/hwmon/hwmonX ,
> > but checking the fields I could not find yet a way how to identify a
> > device (for example i2c address) to the given mapping of hwmonX.
> >
> > Is there a way to find out which device is mapped to which hwmonX ?
> >
>
> Maybe libsensors would work for you ?
>
Thanks , I will check that.
But I was looking for something to check in /sys or /proc to get the matching.
Probably if libsensor somehow knows the mapping it also looks there, No ?

> Guenter

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

* Re: How to detect which device is mapped to hwmonX ?
  2018-12-12  8:54   ` Ranran
@ 2018-12-12 10:33     ` Jean Delvare
  2018-12-16  8:57       ` Ranran
  0 siblings, 1 reply; 5+ messages in thread
From: Jean Delvare @ 2018-12-12 10:33 UTC (permalink / raw)
  To: Ranran; +Cc: linux, linux-hwmon

On Wed, 12 Dec 2018 10:54:19 +0200, Ranran wrote:
> On Tue, Dec 11, 2018 at 11:13 PM Guenter Roeck <linux@roeck-us.net> wrote:
> >
> > On Tue, Dec 11, 2018 at 10:30:58PM +0200, Ranran wrote:  
> > > Hello,
> > >
> > > I have several nodes /sys/class/hwmon/hwmonX ,
> > > but checking the fields I could not find yet a way how to identify a
> > > device (for example i2c address) to the given mapping of hwmonX.
> > >
> > > Is there a way to find out which device is mapped to which hwmonX ?
> > >  
> >
> > Maybe libsensors would work for you ?
> >  
> Thanks , I will check that.
> But I was looking for something to check in /sys or /proc to get the matching.
> Probably if libsensor somehow knows the mapping it also looks there, No ?

libsensors looks in /sys indeed but it's not trivial and libsensors
does not offer an API for it. I remember writing a libsensors-based
name look-up tool years ago. I'm a bit in a hurry but I have copied
what I have at:

http://jdelvare.nerim.net/devel/lm-sensors/patches/

Maybe we can revive the idea if there is a need.

-- 
Jean Delvare
SUSE L3 Support

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

* Re: How to detect which device is mapped to hwmonX ?
  2018-12-12 10:33     ` Jean Delvare
@ 2018-12-16  8:57       ` Ranran
  0 siblings, 0 replies; 5+ messages in thread
From: Ranran @ 2018-12-16  8:57 UTC (permalink / raw)
  To: Jean Delvare; +Cc: Guenter Roeck, linux-hwmon

On Wed, Dec 12, 2018 at 12:33 PM Jean Delvare <jdelvare@suse.de> wrote:
>
> On Wed, 12 Dec 2018 10:54:19 +0200, Ranran wrote:
> > On Tue, Dec 11, 2018 at 11:13 PM Guenter Roeck <linux@roeck-us.net> wrote:
> > >
> > > On Tue, Dec 11, 2018 at 10:30:58PM +0200, Ranran wrote:
> > > > Hello,
> > > >
> > > > I have several nodes /sys/class/hwmon/hwmonX ,
> > > > but checking the fields I could not find yet a way how to identify a
> > > > device (for example i2c address) to the given mapping of hwmonX.
> > > >
> > > > Is there a way to find out which device is mapped to which hwmonX ?
> > > >
> > >
> > > Maybe libsensors would work for you ?
> > >
> > Thanks , I will check that.
> > But I was looking for something to check in /sys or /proc to get the matching.
> > Probably if libsensor somehow knows the mapping it also looks there, No ?
>
> libsensors looks in /sys indeed but it's not trivial and libsensors
> does not offer an API for it. I remember writing a libsensors-based
> name look-up tool years ago. I'm a bit in a hurry but I have copied
> what I have at:
>
> http://jdelvare.nerim.net/devel/lm-sensors/patches/
>
> Maybe we can revive the idea if there is a need.
>

Thank you,
I am still not sure how to do it using sysfs entries.
Eventually I used dmesg to see the order of enumeration:
[    0.640000] tmp102 1-004a: initialized
[    0.640000] tmp102 1-0049: error reading config register
[    0.640000] tmp102: probe of 1-0049 failed with error -121
[    0.640000] tmp102 1-0048: initialized

But I think it's quite bad method.

Thanks,
ran
> --
> Jean Delvare
> SUSE L3 Support

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

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-11 20:30 How to detect which device is mapped to hwmonX ? Ranran
2018-12-11 21:13 ` Guenter Roeck
2018-12-12  8:54   ` Ranran
2018-12-12 10:33     ` Jean Delvare
2018-12-16  8:57       ` Ranran

Linux-Hwmon Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-hwmon/0 linux-hwmon/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-hwmon linux-hwmon/ https://lore.kernel.org/linux-hwmon \
		linux-hwmon@vger.kernel.org linux-hwmon@archiver.kernel.org
	public-inbox-index linux-hwmon


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-hwmon


AGPL code for this site: git clone https://public-inbox.org/ public-inbox