Dr Andrew Scott G7VAV

My photo
 
June 2025
Mo Tu We Th Fr Sa Su
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 1 2 3 4 5 6


rfkill.h
001: #ifndef __RFKILL_H
002: #define __RFKILL_H
003: 
004: /*
005:  * Copyright (C) 2006 - 2007 Ivo van Doorn
006:  * Copyright (C) 2007 Dmitry Torokhov
007:  * Copyright 2009 Johannes Berg <johannes@sipsolutions.net>
008:  *
009:  * Permission to use, copy, modify, and/or distribute this software for any
010:  * purpose with or without fee is hereby granted, provided that the above
011:  * copyright notice and this permission notice appear in all copies.
012:  *
013:  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
014:  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
015:  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
016:  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
017:  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
018:  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
019:  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
020:  */
021: 
022: #include <linux/types.h>
023: 
024: /* define userspace visible states */
025: #define RFKILL_STATE_SOFT_BLOCKED       0
026: #define RFKILL_STATE_UNBLOCKED          1
027: #define RFKILL_STATE_HARD_BLOCKED       2
028: 
029: /**
030:  * enum rfkill_type - type of rfkill switch.
031:  *
032:  * @RFKILL_TYPE_ALL: toggles all switches (requests only - not a switch type)
033:  * @RFKILL_TYPE_WLAN: switch is on a 802.11 wireless network device.
034:  * @RFKILL_TYPE_BLUETOOTH: switch is on a bluetooth device.
035:  * @RFKILL_TYPE_UWB: switch is on a ultra wideband device.
036:  * @RFKILL_TYPE_WIMAX: switch is on a WiMAX device.
037:  * @RFKILL_TYPE_WWAN: switch is on a wireless WAN device.
038:  * @RFKILL_TYPE_GPS: switch is on a GPS device.
039:  * @RFKILL_TYPE_FM: switch is on a FM radio device.
040:  * @NUM_RFKILL_TYPES: number of defined rfkill types
041:  */
042: enum rfkill_type {
043:         RFKILL_TYPE_ALL = 0,
044:         RFKILL_TYPE_WLAN,
045:         RFKILL_TYPE_BLUETOOTH,
046:         RFKILL_TYPE_UWB,
047:         RFKILL_TYPE_WIMAX,
048:         RFKILL_TYPE_WWAN,
049:         RFKILL_TYPE_GPS,
050:         RFKILL_TYPE_FM,
051:         NUM_RFKILL_TYPES,
052: };
053: 
054: /**
055:  * enum rfkill_operation - operation types
056:  * @RFKILL_OP_ADD: a device was added
057:  * @RFKILL_OP_DEL: a device was removed
058:  * @RFKILL_OP_CHANGE: a device's state changed -- userspace changes one device
059:  * @RFKILL_OP_CHANGE_ALL: userspace changes all devices (of a type, or all)
060:  */
061: enum rfkill_operation {
062:         RFKILL_OP_ADD = 0,
063:         RFKILL_OP_DEL,
064:         RFKILL_OP_CHANGE,
065:         RFKILL_OP_CHANGE_ALL,
066: };
067: 
068: /**
069:  * struct rfkill_event - events for userspace on /dev/rfkill
070:  * @idx: index of dev rfkill
071:  * @type: type of the rfkill struct
072:  * @op: operation code
073:  * @hard: hard state (0/1)
074:  * @soft: soft state (0/1)
075:  *
076:  * Structure used for userspace communication on /dev/rfkill,
077:  * used for events from the kernel and control to the kernel.
078:  */
079: struct rfkill_event {
080:         __u32 idx;
081:         __u8  type;
082:         __u8  op;
083:         __u8  soft, hard;
084: } __attribute__((packed));
085: 
086: /*
087:  * We are planning to be backward and forward compatible with changes
088:  * to the event struct, by adding new, optional, members at the end.
089:  * When reading an event (whether the kernel from userspace or vice
090:  * versa) we need to accept anything that's at least as large as the
091:  * version 1 event size, but might be able to accept other sizes in
092:  * the future.
093:  *
094:  * One exception is the kernel -- we already have two event sizes in
095:  * that we've made the 'hard' member optional since our only option
096:  * is to ignore it anyway.
097:  */
098: #define RFKILL_EVENT_SIZE_V1    8
099: 
100: /* ioctl for turning off rfkill-input (if present) */
101: #define RFKILL_IOC_MAGIC        'R'
102: #define RFKILL_IOC_NOINPUT      1
103: #define RFKILL_IOCTL_NOINPUT    _IO(RFKILL_IOC_MAGIC, RFKILL_IOC_NOINPUT)
104: 
105: /* and that's all userspace gets */
106: 
107: #endif /* RFKILL_H */
108: 


for client (none)
© Andrew Scott 2006 - 2025,
All Rights Reserved
http://www.andrew-scott.uk/
Andrew Scott
http://www.andrew-scott.co.uk/