From d9448e602e34dcc79ecb39814ca95793eec201ca Mon Sep 17 00:00:00 2001 From: Marvin Sinister Date: Thu, 23 May 2024 10:53:04 +0200 Subject: [PATCH] ignore NODEV errors when parsing powersupply files Signed-off-by: Marvin Sinister --- sysfs/class_power_supply.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sysfs/class_power_supply.go b/sysfs/class_power_supply.go index c50c32b3..cb1a2516 100644 --- a/sysfs/class_power_supply.go +++ b/sysfs/class_power_supply.go @@ -143,7 +143,7 @@ func parsePowerSupply(path string) (*PowerSupply, error) { name := filepath.Join(path, f.Name()) value, err := util.SysReadFile(name) if err != nil { - if os.IsNotExist(err) || err.Error() == "operation not supported" || errors.Is(err, os.ErrInvalid) { + if os.IsNotExist(err) || err.Error() == "operation not supported" || err.Error() == "no such device" || errors.Is(err, os.ErrInvalid) { continue } return nil, fmt.Errorf("failed to read file %q: %w", name, err)