1 #ifndef __RFKILL_H 2 #define __RFKILL_H 3 4 /* 5 * Copyright (C) 2006 - 2007 Ivo van Doorn 6 * Copyright (C) 2007 Dmitry Torokhov 7 * Copyright 2009 Johannes Berg <johannes (at) sipsolutions.net> 8 * 9 * Permission to use, copy, modify, and/or distribute this software for any 10 * purpose with or without fee is hereby granted, provided that the above 11 * copyright notice and this permission notice appear in all copies. 12 * 13 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 14 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 15 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 16 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 17 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 18 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 19 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 20 */ 21 22 #include <linux/types.h> 23 24 /* define userspace visible states */ 25 #define RFKILL_STATE_SOFT_BLOCKED 0 26 #define RFKILL_STATE_UNBLOCKED 1 27 #define RFKILL_STATE_HARD_BLOCKED 2 28 29 /** 30 * enum rfkill_type - type of rfkill switch. 31 * 32 * @RFKILL_TYPE_ALL: toggles all switches (userspace only) 33 * @RFKILL_TYPE_WLAN: switch is on a 802.11 wireless network device. 34 * @RFKILL_TYPE_BLUETOOTH: switch is on a bluetooth device. 35 * @RFKILL_TYPE_UWB: switch is on a ultra wideband device. 36 * @RFKILL_TYPE_WIMAX: switch is on a WiMAX device. 37 * @RFKILL_TYPE_WWAN: switch is on a wireless WAN device. 38 * @NUM_RFKILL_TYPES: number of defined rfkill types 39 */ 40 enum rfkill_type { 41 RFKILL_TYPE_ALL = 0, 42 RFKILL_TYPE_WLAN, 43 RFKILL_TYPE_BLUETOOTH, 44 RFKILL_TYPE_UWB, 45 RFKILL_TYPE_WIMAX, 46 RFKILL_TYPE_WWAN, 47 RFKILL_TYPE_GPS, 48 NUM_RFKILL_TYPES, 49 }; 50 51 /** 52 * enum rfkill_operation - operation types 53 * @RFKILL_OP_ADD: a device was added 54 * @RFKILL_OP_DEL: a device was removed 55 * @RFKILL_OP_CHANGE: a device's state changed -- userspace changes one device 56 * @RFKILL_OP_CHANGE_ALL: userspace changes all devices (of a type, or all) 57 */ 58 enum rfkill_operation { 59 RFKILL_OP_ADD = 0, 60 RFKILL_OP_DEL, 61 RFKILL_OP_CHANGE, 62 RFKILL_OP_CHANGE_ALL, 63 }; 64 65 /** 66 * struct rfkill_event - events for userspace on /dev/rfkill 67 * @idx: index of dev rfkill 68 * @type: type of the rfkill struct 69 * @op: operation code 70 * @hard: hard state (0/1) 71 * @soft: soft state (0/1) 72 * 73 * Structure used for userspace communication on /dev/rfkill, 74 * used for events from the kernel and control to the kernel. 75 */ 76 struct rfkill_event { 77 __u32 idx; 78 __u8 type; 79 __u8 op; 80 __u8 soft, hard; 81 } __packed; 82 83 /* 84 * We are planning to be backward and forward compatible with changes 85 * to the event struct, by adding new, optional, members at the end. 86 * When reading an event (whether the kernel from userspace or vice 87 * versa) we need to accept anything that's at least as large as the 88 * version 1 event size, but might be able to accept other sizes in 89 * the future. 90 * 91 * One exception is the kernel -- we already have two event sizes in 92 * that we've made the 'hard' member optional since our only option 93 * is to ignore it anyway. 94 */ 95 #define RFKILL_EVENT_SIZE_V1 8 96 97 /* ioctl for turning off rfkill-input (if present) */ 98 #define RFKILL_IOC_MAGIC 'R' 99 #define RFKILL_IOC_NOINPUT 1 100 #define RFKILL_IOCTL_NOINPUT _IO(RFKILL_IOC_MAGIC, RFKILL_IOC_NOINPUT) 101 102 /* and that's all userspace gets */ 103 104 #endif /* RFKILL_H */ 105