Userspace matching of hwmon devices to hardware
Guenter Roeck
linux at roeck-us.net
Mon Mar 25 21:43:17 AEDT 2019
On 3/25/19 1:21 AM, Lei YU wrote:
> This email is to ask/discuss if there is a stable path/name (or whatever) for
> hwmon devices in the different versions of kernels.
>
> In OpenBMC, the service phosphor-hwmon reads the sensors' value and expose to
> DBus, depending on a configure file that matches the device tree path.
>
> The service is started by udev rule, called with the DEVPATH and OF_FULLNAME,
> so it knows where to find the configure file depending on DEVPATH or
> OF_FULLNAME.
>
> E.g. on Romulus BMC, the w83773 sensor has OF_FULLNAME at
> /ahb/apb/i2c at 1e78a000/i2c-bus at 440/w83773g at 4c,
> and the service knows the config is matched from path
> /etc/default/obmc/hwmon/ahb/apb/i2c at 1e78a000/i2c-bus at 440/w83773g at 4c.conf
>
> However, the DEVPATH or OF_FULLNAME is not stable in different kernels:
> * In 4.1x kernel, the path is as above.
> * In 5.0 kernel, "i2c at 1e78a000" is changed to "bus at 1e78a000" in the path.
>
This is due to a devicetree source change with commit 1426d40e11f73 ("ARM: dts:
aspeed: Fix I2C bus warnings"). In general you can not assume that devicetree
files (or path names derived from devicetree source files) stay the same across
kernel releases.
> This breaks the userspace's phosphor-hwmon.
> If we fix the issue by updating the configure files' path in userspace, it
> means the userspace only with the new 5.x kernel.
>
> So the question here is, it there a stable way for userspace to match a hwmon
> device?
>
libsensors should handle it for you, but I don't immediately know how to map
that into udev rules. Jean, any idea ?
Guenter
More information about the openbmc
mailing list