From 51ba8176b9733a00d2e83cb27399694db50f3389 Mon Sep 17 00:00:00 2001 From: Adam Lee Date: Thu, 25 Dec 2014 15:35:33 +0800 Subject: [PATCH v2] respond Lenovo ThinkPad ?40 series' Fn+F8 BugLink: http://bugs.launchpad.net/bugs/1396429 Lenovo ThinkPad ?40 series' wireless toggle key is not the classic "ibm/hotkey HKEY" but "button/wlan WLAN", which only controls WLAN, this patch makes it also controlling Bluetooth(only on ThinkPad) like the old days. v2: won't impact ibm-wireless event if a prior ThinkPad model has WiFi but no Bluetooth. Signed-off-by: Adam Lee --- events/thinkpad-wireless | 6 ++++++ ibm-wireless.sh | 4 ++++ 2 files changed, 10 insertions(+) create mode 100644 events/thinkpad-wireless diff --git a/events/thinkpad-wireless b/events/thinkpad-wireless new file mode 100644 index 0000000..be78907 --- /dev/null +++ b/events/thinkpad-wireless @@ -0,0 +1,6 @@ +# /etc/acpi/events/thinkpad-wireless +# This is called when the user presses the wireless button and calls +# /etc/acpi/ibm-wireless.sh for further processing. + +event=button/wlan WLAN 00000080 00000000 +action=/etc/acpi/ibm-wireless.sh general diff --git a/ibm-wireless.sh b/ibm-wireless.sh index ddfa60f..363fa68 100755 --- a/ibm-wireless.sh +++ b/ibm-wireless.sh @@ -6,6 +6,10 @@ test -f /usr/share/acpi-support/state-funcs || exit 0 . /usr/share/acpi-support/state-funcs +if [ "$1" = "general" ]; then + rfkill list | grep tpacpi_bluetooth_sw || exit 0 +fi + rfkill list | sed -n -e'/tpacpi_bluetooth_sw/,/^[0-9]/p' | grep -q 'Soft blocked: yes' bluetooth_state=$? -- 2.1.4