aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/rfkill.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/rfkill.h')
-rw-r--r--include/linux/rfkill.h84
1 files changed, 60 insertions, 24 deletions
diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h
index 090852c8de7a..7c116f6631b8 100644
--- a/include/linux/rfkill.h
+++ b/include/linux/rfkill.h
@@ -22,34 +22,17 @@
22 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 22 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 */ 23 */
24 24
25#include <linux/types.h>
25 26
26/* define userspace visible states */ 27/* define userspace visible states */
27#define RFKILL_STATE_SOFT_BLOCKED 0 28#define RFKILL_STATE_SOFT_BLOCKED 0
28#define RFKILL_STATE_UNBLOCKED 1 29#define RFKILL_STATE_UNBLOCKED 1
29#define RFKILL_STATE_HARD_BLOCKED 2 30#define RFKILL_STATE_HARD_BLOCKED 2
30 31
31/* and that's all userspace gets */
32#ifdef __KERNEL__
33/* don't allow anyone to use these in the kernel */
34enum rfkill_user_states {
35 RFKILL_USER_STATE_SOFT_BLOCKED = RFKILL_STATE_SOFT_BLOCKED,
36 RFKILL_USER_STATE_UNBLOCKED = RFKILL_STATE_UNBLOCKED,
37 RFKILL_USER_STATE_HARD_BLOCKED = RFKILL_STATE_HARD_BLOCKED,
38};
39#undef RFKILL_STATE_SOFT_BLOCKED
40#undef RFKILL_STATE_UNBLOCKED
41#undef RFKILL_STATE_HARD_BLOCKED
42
43#include <linux/types.h>
44#include <linux/kernel.h>
45#include <linux/list.h>
46#include <linux/mutex.h>
47#include <linux/device.h>
48#include <linux/leds.h>
49
50/** 32/**
51 * enum rfkill_type - type of rfkill switch. 33 * enum rfkill_type - type of rfkill switch.
52 * 34 *
35 * @RFKILL_TYPE_ALL: toggles all switches (userspace only)
53 * @RFKILL_TYPE_WLAN: switch is on a 802.11 wireless network device. 36 * @RFKILL_TYPE_WLAN: switch is on a 802.11 wireless network device.
54 * @RFKILL_TYPE_BLUETOOTH: switch is on a bluetooth device. 37 * @RFKILL_TYPE_BLUETOOTH: switch is on a bluetooth device.
55 * @RFKILL_TYPE_UWB: switch is on a ultra wideband device. 38 * @RFKILL_TYPE_UWB: switch is on a ultra wideband device.
@@ -58,6 +41,7 @@ enum rfkill_user_states {
58 * @NUM_RFKILL_TYPES: number of defined rfkill types 41 * @NUM_RFKILL_TYPES: number of defined rfkill types
59 */ 42 */
60enum rfkill_type { 43enum rfkill_type {
44 RFKILL_TYPE_ALL = 0,
61 RFKILL_TYPE_WLAN, 45 RFKILL_TYPE_WLAN,
62 RFKILL_TYPE_BLUETOOTH, 46 RFKILL_TYPE_BLUETOOTH,
63 RFKILL_TYPE_UWB, 47 RFKILL_TYPE_UWB,
@@ -66,6 +50,62 @@ enum rfkill_type {
66 NUM_RFKILL_TYPES, 50 NUM_RFKILL_TYPES,
67}; 51};
68 52
53/**
54 * enum rfkill_operation - operation types
55 * @RFKILL_OP_ADD: a device was added
56 * @RFKILL_OP_DEL: a device was removed
57 * @RFKILL_OP_CHANGE: a device's state changed -- userspace changes one device
58 * @RFKILL_OP_CHANGE_ALL: userspace changes all devices (of a type, or all)
59 */
60enum rfkill_operation {
61 RFKILL_OP_ADD = 0,
62 RFKILL_OP_DEL,
63 RFKILL_OP_CHANGE,
64 RFKILL_OP_CHANGE_ALL,
65};
66
67/**
68 * struct rfkill_event - events for userspace on /dev/rfkill
69 * @idx: index of dev rfkill
70 * @type: type of the rfkill struct
71 * @op: operation code
72 * @hard: hard state (0/1)
73 * @soft: soft state (0/1)
74 *
75 * Structure used for userspace communication on /dev/rfkill,
76 * used for events from the kernel and control to the kernel.
77 */
78struct rfkill_event {
79 __u32 idx;
80 __u8 type;
81 __u8 op;
82 __u8 soft, hard;
83} __packed;
84
85/* ioctl for turning off rfkill-input (if present) */
86#define RFKILL_IOC_MAGIC 'R'
87#define RFKILL_IOC_NOINPUT 1
88#define RFKILL_IOCTL_NOINPUT _IO(RFKILL_IOC_MAGIC, RFKILL_IOC_NOINPUT)
89
90/* and that's all userspace gets */
91#ifdef __KERNEL__
92/* don't allow anyone to use these in the kernel */
93enum rfkill_user_states {
94 RFKILL_USER_STATE_SOFT_BLOCKED = RFKILL_STATE_SOFT_BLOCKED,
95 RFKILL_USER_STATE_UNBLOCKED = RFKILL_STATE_UNBLOCKED,
96 RFKILL_USER_STATE_HARD_BLOCKED = RFKILL_STATE_HARD_BLOCKED,
97};
98#undef RFKILL_STATE_SOFT_BLOCKED
99#undef RFKILL_STATE_UNBLOCKED
100#undef RFKILL_STATE_HARD_BLOCKED
101
102#include <linux/types.h>
103#include <linux/kernel.h>
104#include <linux/list.h>
105#include <linux/mutex.h>
106#include <linux/device.h>
107#include <linux/leds.h>
108
69/* this is opaque */ 109/* this is opaque */
70struct rfkill; 110struct rfkill;
71 111
@@ -84,11 +124,7 @@ struct rfkill;
84 * the rfkill core query your driver before setting a requested 124 * the rfkill core query your driver before setting a requested
85 * block. 125 * block.
86 * @set_block: turn the transmitter on (blocked == false) or off 126 * @set_block: turn the transmitter on (blocked == false) or off
87 * (blocked == true) -- this is called only while the transmitter 127 * (blocked == true) -- ignore and return 0 when hard blocked.
88 * is not hard-blocked, but note that the core's view of whether
89 * the transmitter is hard-blocked might differ from your driver's
90 * view due to race conditions, so it is possible that it is still
91 * called at the same time as you are calling rfkill_set_hw_state().
92 * This callback must be assigned. 128 * This callback must be assigned.
93 */ 129 */
94struct rfkill_ops { 130struct rfkill_ops {