at v5.11 4.1 kB view raw
1/* 2 * Copyright (C) 2006 - 2007 Ivo van Doorn 3 * Copyright (C) 2007 Dmitry Torokhov 4 * Copyright 2009 Johannes Berg <johannes@sipsolutions.net> 5 * 6 * Permission to use, copy, modify, and/or distribute this software for any 7 * purpose with or without fee is hereby granted, provided that the above 8 * copyright notice and this permission notice appear in all copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 */ 18#ifndef _UAPI__RFKILL_H 19#define _UAPI__RFKILL_H 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 (requests only - not a switch type) 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 * @RFKILL_TYPE_GPS: switch is on a GPS device. 39 * @RFKILL_TYPE_FM: switch is on a FM radio device. 40 * @RFKILL_TYPE_NFC: switch is on an NFC device. 41 * @NUM_RFKILL_TYPES: number of defined rfkill types 42 */ 43enum rfkill_type { 44 RFKILL_TYPE_ALL = 0, 45 RFKILL_TYPE_WLAN, 46 RFKILL_TYPE_BLUETOOTH, 47 RFKILL_TYPE_UWB, 48 RFKILL_TYPE_WIMAX, 49 RFKILL_TYPE_WWAN, 50 RFKILL_TYPE_GPS, 51 RFKILL_TYPE_FM, 52 RFKILL_TYPE_NFC, 53 NUM_RFKILL_TYPES, 54}; 55 56/** 57 * enum rfkill_operation - operation types 58 * @RFKILL_OP_ADD: a device was added 59 * @RFKILL_OP_DEL: a device was removed 60 * @RFKILL_OP_CHANGE: a device's state changed -- userspace changes one device 61 * @RFKILL_OP_CHANGE_ALL: userspace changes all devices (of a type, or all) 62 * into a state, also updating the default state used for devices that 63 * are hot-plugged later. 64 */ 65enum rfkill_operation { 66 RFKILL_OP_ADD = 0, 67 RFKILL_OP_DEL, 68 RFKILL_OP_CHANGE, 69 RFKILL_OP_CHANGE_ALL, 70}; 71 72/** 73 * enum rfkill_hard_block_reasons - hard block reasons 74 * @RFKILL_HARD_BLOCK_SIGNAL: the hardware rfkill signal is active 75 * @RFKILL_HARD_BLOCK_NOT_OWNER: the NIC is not owned by the host 76 */ 77enum rfkill_hard_block_reasons { 78 RFKILL_HARD_BLOCK_SIGNAL = 1 << 0, 79 RFKILL_HARD_BLOCK_NOT_OWNER = 1 << 1, 80}; 81 82/** 83 * struct rfkill_event - events for userspace on /dev/rfkill 84 * @idx: index of dev rfkill 85 * @type: type of the rfkill struct 86 * @op: operation code 87 * @hard: hard state (0/1) 88 * @soft: soft state (0/1) 89 * @hard_block_reasons: valid if hard is set. One or several reasons from 90 * &enum rfkill_hard_block_reasons. 91 * 92 * Structure used for userspace communication on /dev/rfkill, 93 * used for events from the kernel and control to the kernel. 94 */ 95struct rfkill_event { 96 __u32 idx; 97 __u8 type; 98 __u8 op; 99 __u8 soft; 100 __u8 hard; 101 __u8 hard_block_reasons; 102} __attribute__((packed)); 103 104/* 105 * We are planning to be backward and forward compatible with changes 106 * to the event struct, by adding new, optional, members at the end. 107 * When reading an event (whether the kernel from userspace or vice 108 * versa) we need to accept anything that's at least as large as the 109 * version 1 event size, but might be able to accept other sizes in 110 * the future. 111 * 112 * One exception is the kernel -- we already have two event sizes in 113 * that we've made the 'hard' member optional since our only option 114 * is to ignore it anyway. 115 */ 116#define RFKILL_EVENT_SIZE_V1 8 117 118/* ioctl for turning off rfkill-input (if present) */ 119#define RFKILL_IOC_MAGIC 'R' 120#define RFKILL_IOC_NOINPUT 1 121#define RFKILL_IOCTL_NOINPUT _IO(RFKILL_IOC_MAGIC, RFKILL_IOC_NOINPUT) 122 123/* and that's all userspace gets */ 124 125#endif /* _UAPI__RFKILL_H */