Skip to content

Commit 67df4d5

Browse files
committed
Check bluetooth for hardware lock before enabling
1 parent c798dbd commit 67df4d5

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

src/rfkill.vala

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,19 @@ public class RFKillManager : Object {
117117
set_software_lock (WIMAX, value);
118118
set_software_lock (WMAN, value);
119119

120-
// Some hardware keys still turn off bluetooth
120+
/*
121+
* Some hardware keys still turn off bluetooth so we iterate over
122+
* devices to check if bluetooth was hardware locked and unlock it
123+
* but we don't want to toggle it back on if it was manually disabled
124+
* in software
125+
*/
121126
if (!value) {
122-
set_software_lock (BLUETOOTH, false);
127+
foreach (unowned var device in get_devices ()) {
128+
if (device.device_type == BLUETOOTH && device.hardware_lock) {
129+
set_software_lock (BLUETOOTH, false);
130+
break;
131+
}
132+
}
123133
}
124134
}
125135
}

0 commit comments

Comments
 (0)