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: 9c4fbbe1b8 ('rfkill: query the hardware rfkill reason from udev')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1128
This commit is contained in:
Emmanuel Grumbach 2022-03-01 20:20:25 +02:00 committed by Thomas Haller
parent bd92d9df24
commit 237c028e53
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -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 */