From 237c028e536c4dc282e8bc87211f0ddfdc046a36 Mon Sep 17 00:00:00 2001 From: Emmanuel Grumbach Date: Tue, 1 Mar 2022 20:20:25 +0200 Subject: [PATCH] rfkill: fix the rfkill reason property query and parsing The udev property is RFKILL_HW_BLOCK_REASON and it is returned as a bitmap in hexadecimal. Fixes: 9c4fbbe1b8ab ('rfkill: query the hardware rfkill reason from udev') https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1128 --- src/core/nm-rfkill-manager.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/nm-rfkill-manager.c b/src/core/nm-rfkill-manager.c index 2315973d85..9eac097294 100644 --- a/src/core/nm-rfkill-manager.c +++ b/src/core/nm-rfkill-manager.c @@ -211,9 +211,10 @@ recheck_killswitches(NMRfkillManager *self) G_MININT, G_MAXINT, -1); + sysfs_reason = _nm_utils_ascii_str_to_int64( - udev_device_get_property_value(device, "RFKILL_STATE_REASON"), - 10, + udev_device_get_property_value(device, "RFKILL_HW_BLOCK_REASON"), + 16, G_MININT, G_MAXINT, 1); /* defaults to SIGNAL in case the kernel does not support this */