mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-10-15 20:45:32 +00:00
core: introduce "unavailable" rfkill state
Introduce a new "unavailable" rfkill state to indicate that no rfkill hardware was found. Currently it is still handled as "unblocked".
This commit is contained in:
parent
2bdca1f5d6
commit
2343148da8
|
@ -2323,6 +2323,11 @@ _rfkill_radio_state_set_from_manager(NMRfkillManager *rfkill_mgr,
|
|||
RfkillRadioState *rstate)
|
||||
{
|
||||
switch (nm_rfkill_manager_get_rfkill_state(rfkill_mgr, rtype)) {
|
||||
case NM_RFKILL_STATE_UNAVAILABLE:
|
||||
rstate->sw_enabled = TRUE;
|
||||
rstate->hw_enabled = TRUE;
|
||||
rstate->os_owner = TRUE;
|
||||
return;
|
||||
case NM_RFKILL_STATE_UNBLOCKED:
|
||||
rstate->sw_enabled = TRUE;
|
||||
rstate->hw_enabled = TRUE;
|
||||
|
|
|
@ -84,6 +84,8 @@ static const char *
|
|||
nm_rfkill_state_to_string(NMRfkillState state)
|
||||
{
|
||||
switch (state) {
|
||||
case NM_RFKILL_STATE_UNAVAILABLE:
|
||||
return "unavailable";
|
||||
case NM_RFKILL_STATE_UNBLOCKED:
|
||||
return "unblocked";
|
||||
case NM_RFKILL_STATE_SOFT_BLOCKED:
|
||||
|
@ -188,8 +190,8 @@ recheck_killswitches(NMRfkillManager *self)
|
|||
|
||||
/* Default state is unblocked */
|
||||
for (i = 0; i < NM_RFKILL_TYPE_MAX; i++) {
|
||||
poll_states[i] = NM_RFKILL_STATE_UNBLOCKED;
|
||||
platform_states[i] = NM_RFKILL_STATE_UNBLOCKED;
|
||||
poll_states[i] = NM_RFKILL_STATE_UNAVAILABLE;
|
||||
platform_states[i] = NM_RFKILL_STATE_UNAVAILABLE;
|
||||
platform_checked[i] = FALSE;
|
||||
}
|
||||
|
||||
|
@ -222,12 +224,12 @@ recheck_killswitches(NMRfkillManager *self)
|
|||
dev_state = sysfs_state_to_nm_state(sysfs_state, sysfs_reason);
|
||||
|
||||
nm_log_dbg(LOGD_RFKILL,
|
||||
"%s rfkill%s switch %s state now %d/%u reason: 0x%x",
|
||||
"%s rfkill%s switch %s state now %d/%s reason: 0x%x",
|
||||
nm_rfkill_type_to_string(ks->rtype),
|
||||
ks->platform ? " platform" : "",
|
||||
ks->name,
|
||||
sysfs_state,
|
||||
dev_state,
|
||||
nm_rfkill_state_to_string(dev_state),
|
||||
sysfs_reason);
|
||||
|
||||
if (ks->platform == FALSE) {
|
||||
|
@ -248,7 +250,7 @@ recheck_killswitches(NMRfkillManager *self)
|
|||
/* blocked platform switch state overrides device state, otherwise
|
||||
* let the device state stand. (bgo #655773)
|
||||
*/
|
||||
if (platform_states[i] != NM_RFKILL_STATE_UNBLOCKED)
|
||||
if (platform_states[i] > NM_RFKILL_STATE_UNBLOCKED)
|
||||
poll_states[i] = platform_states[i];
|
||||
}
|
||||
|
||||
|
@ -396,7 +398,7 @@ nm_rfkill_manager_init(NMRfkillManager *self)
|
|||
c_list_init(&priv->killswitch_lst_head);
|
||||
|
||||
for (i = 0; i < NM_RFKILL_TYPE_MAX; i++)
|
||||
priv->rfkill_states[i] = NM_RFKILL_STATE_UNBLOCKED;
|
||||
priv->rfkill_states[i] = NM_RFKILL_STATE_UNAVAILABLE;
|
||||
|
||||
priv->udev_client = nm_udev_client_new(NM_MAKE_STRV("rfkill"), handle_uevent, self);
|
||||
|
||||
|
|
|
@ -8,16 +8,17 @@
|
|||
#define __NM_RFKILL_MANAGER_H__
|
||||
|
||||
typedef enum {
|
||||
NM_RFKILL_STATE_UNBLOCKED = 0,
|
||||
NM_RFKILL_STATE_SOFT_BLOCKED = 1,
|
||||
NM_RFKILL_STATE_HARD_BLOCKED = 2,
|
||||
NM_RFKILL_STATE_UNAVAILABLE = 0,
|
||||
NM_RFKILL_STATE_UNBLOCKED = 1,
|
||||
NM_RFKILL_STATE_SOFT_BLOCKED = 2,
|
||||
NM_RFKILL_STATE_HARD_BLOCKED = 3,
|
||||
/* NM_RFKILL_STATE_HARD_BLOCKED_OS_NOT_OWNER means that the CSME firmware
|
||||
* is currently controlling the device. This feature is implmented on Intel
|
||||
* wifi devices only.
|
||||
* The NetworkManager can get ownership on the device, but it requires to
|
||||
* first ask ownership through the iwlmei kernel module.
|
||||
*/
|
||||
NM_RFKILL_STATE_HARD_BLOCKED_OS_NOT_OWNER = 3,
|
||||
NM_RFKILL_STATE_HARD_BLOCKED_OS_NOT_OWNER = 4,
|
||||
} NMRfkillState;
|
||||
|
||||
typedef enum {
|
||||
|
|
Loading…
Reference in a new issue