RFkill - Add support for input key to control wireless radio
Subsystems (2)
RFC PATCH 1/1 RFkill - Add support for input key to control wireless radio
Hi,
This patch has been send some months ago to this list as well, based on comments made then, I have improved the rfkill handling.
Besides the rt2x00 drivers (rt2400, rt2500, rt2570, rt61 and rt73 chipsets) Lennart Poettering has also shown interest in rfkill for his MSI laptop driver. If this rfkill version is approved, the real patch submission will have seperate patches to make those drivers use rfkill.
But before I will send the patch for submission, I first would like to hear if rfkill has changed enough and is now generic enough to make it acceptable for inclusion in the main kernel tree.
The rfkill works as follows, when the user presses the hardware key to control the wireless (wifi, bluetooth or irda) radio a signal will go to rfkill. This happens by the hardware driver sending a signal to rfkill, or rfkill polling for the button status.
The key signal will then be processed by rfkill, each key will have its own input device, if this input device has not been openened by the user, rfkill will keep the signal and either turn the radio on or off based on the key status.
If the input device has been opened, rfkill will send the signal to userspace and do nothing further. The user is in charge of controlling the radio.
sysfs entries have been added for the user to read the button status, and to set the radio status. This allows the user to turn on or off the radio in a similar way as rfkill would do (using the callback functions the hardware driver has provided).
Signed-off-by Ivo van Doorn <[email protected]>
----
drivers/input/misc/Kconfig +15 -0
@@ -79,4 +79,19 @@ config HP_SDC_RTC Say Y here if you want to support the built-in real time clock of the HP SDC controller. +config RFKILL + tristate "RF button support" + help + If you say yes here, the rfkill driver will be build + which allowed network devices to register their hardware + RF button which controls the radio state. This driver + will then create an input device for it. + + When the input device is not used, the rfkill driver + will make sure that when the RF button is pressed the radio + is enabled or disabled accordingly. When the input device + has been opened by the user this radio control will be left + to the user, and rfkill will only send the RF button status + change to userspace. + endif
drivers/input/misc/Makefile +1 -0
@@ -11,3 +11,4 @@ obj-$(CONFIG_INPUT_UINPUT) += uinput.o obj-$(CONFIG_INPUT_WISTRON_BTNS) += wistron_btns.o obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o obj-$(CONFIG_INPUT_IXP4XX_BEEPER) += ixp4xx-beeper.o +obj-$(CONFIG_RFKILL) += rfkill.o
drivers/input/misc/rfkill.c new file +880 -0
880 lines not on this page · raw message
include/linux/rfkill.h new file +140 -0
140 lines not on this page · raw message
Am Sonntag, 12. November 2006 15:48 schrieb Ivo van Doorn:
Quoted 3 lines
If the input device has been opened, rfkill will send the signal to userspace and do nothing further. The user is in charge of controlling the radio.
As turning off the radio is relevant to safety eg. in aircraft, hospitals, etc., potentially ignoring the button is questionable.
Regards
Oliver
Quoted 7 lines · Oliver Neukum
Am Sonntag, 12. November 2006 15:48 schrieb Ivo van Doorn:
Quoted 3 lines
If the input device has been opened, rfkill will send the signal to userspace and do nothing further. The user is in charge of controlling the radio.
As turning off the radio is relevant to safety eg. in aircraft, hospitals, etc., potentially ignoring the button is questionable.
True, that is why the default behavior is to listen to the button and change the radio status. Only when the input device is opened the button is ignored. But changing the radio status, and then reporting it to the user might also not be what the user wants, he might want to execute some commands while the radio is still enabled before disabling the radio.
Ivo
Quoted 7 lines
Quoted 4 lines
If the input device has been opened, rfkill will send the signal to userspace and do nothing further. The user is in charge of controlling the radio.
As turning off the radio is relevant to safety eg. in aircraft, hospitals, etc., potentially ignoring the button is questionable.
"Policy does not belong into the kernel".
-`J'