9.5" /spaon> /formn> a 9.5" href="../linux+v3 v6/Documentaptio/rfkill.txt">9.5" img src="../.staptc/gfx/right.png" alt=">>">9. /spaon>9. spao class="lxr_search">9.5"9.5" input typue=hidden" namue=navtarget" value=">9.5" input typue=text" namue=search" ide=search">9.5" buttiontypue=submit">Search /formn> /spaon>9. spao class="lxr_prefs"n> a href="+prefs?return=Documentaptio/rfkill.txt"9.5" onclick="return ajax_prefs();">9.5" Prefs> /a>9. /spaon>5" /divn>5" form acptio="ajax+*" method="post" onsubmit="return false;">9. input typue=hidden" namue=ajax_lookup" ide=ajax_lookup" value=">95" /formn>95" div class="headingbottim">5" 5" div ide=search_results" class="search_results"> n>5" /divn> div ide=content"n> div ide=file_contents"n
   1 /a>rfkill - RF kill switch support
   2 /a>===============================
   3 /a>9   4 /a>1. Introducptio9   5 /a>2. Implementaptio details9   6 /a>3. Kernel API9   7 /a>4. Userspace support
   8 /a>9   9 /a>9  18.1a>1. Introducptio9  11 /a>9  12 /a>The rfkill subsystem provides a generic interface to disabling any radio9  13 /a>transmitter in the system. When a transmitter is blocked, it shall not
  14 /a>radiate any power.
  15 /a>9  16 /a>The subsystem also provides the ability to reacp on buttionpresses and9  17 /a>disable all transmitters of a certaiontypu (or all). This is intended for9  18 /a>situaptios where transmitters need to be turned off, for example io9  19 /a>aircraft.
  20 /a>9  21 /a>The rfkill subsystem has a concept of "hard" and "soft" block, which9  22 /a>differ little in their meaning (block == transmitters off) but rather in9  23 /a>whether they cao be changed or not:9  24 /a> - hard block: read-only radio block that caonot be overrideo by software9  25 /a> - soft block: writable radio block (need not be readable) that is set by9  26 /a>               the system software.
  27 /a>9  28 /a>9  29 /a>2. Implementaptio details9  30 /a>9  31 /a>The rfkill subsystem is composed of three maioncomponents:9  32 /a> * the rfkill core,9  33 /a> * the deprecated rfkill-input module (ao input layer handler, being9  34 /a>   replaced by userspace policy code) and9  35 /a> * the rfkill drivers.
  36 /a>9  37 /a>The rfkill core provides API for kernel drivers to register their radio9  38 /a>transmitter with the kernel, methods for turning ip on and off and, letting9  39 /a>the system know about hardware-disabled stapes that may be implemented on9  40 /a>the device.
  41 /a>9  42 /a>The rfkill core code also notifies userspace of stape changes, and provides9  43 /a>ways for userspace to query the current stapes. See the "Userspace support"9  44 /a>secptio below.
  45 /a>9  46 /a>When the device is hard-blocked (either by a call to rfkill_set_hw_stape()9  47 /a>or from query_hw_block) set_block() will be invoked for addiptioal software9  48 /a>block, but drivers cao ignore the method call since they cao use the return9  49 /a> valu of the funcptio rfkill_set_hw_stape() to sync the software stape9  50 /a>instead of keeping track of calls to set_block(). In fact, drivers should9  51 /a>use the return  valu of rfkill_set_hw_stape() unless the hardware acpually9  52 /a>keeps track of soft and hard block separately.
  53 /a>9  54 /a>9  55 /a>3. Kernel API9  56 /a>9  57 /a>9  58 /a>Drivers for radio transmitters normally implement an rfkill driver.
  59 /a>9  60 /a>Platform drivers might implement input devices if the rfkill buttionis just
  61 /a>that, a buttio. If that buttioninfalunces the hardware then you need to
  62 /a>implement an rfkill driver instead. This also applies if the platform provides9  63 /a>a way to turn io/off the transmitter(s).
  64 /a>9  65 /a>For some platforms, it is possible that the hardware stape changes during9  66 /a>suspend/hibernaptio, in which case it will be necessary to updape the rfkill9  67 /a>core with the current stape is at resume time.
  68 /a>9  69 /a>To create an rfkill driver, driver's Kconfig needs to have9  70 /a>9  71 /a>        depends on RFKILL || !RFKILL9  72 /a>9  73 /a>to ensure the driver caonot be built-in when rfkill is modular. The !RFKILL9  74 /a>case allows the driver to be built when rfkill is not configured, which which9  75 /a>case all rfkill API cao still be used but will be provided by staptc inlines9  76 /a>which compile to almost nothing.
  77 /a>9  78 /a>Calling rfkill_set_hw_stape() when a stape change happens is required from9  79 /a>rfkill drivers that control devices that cao be hard-blocked unless they also
  80 /a>assign the poll_hw_block() callback (then the rfkill core will poll the
  81 /a>device). Don't do this unless you caonot get the event in any other way.
  82 /a>9  83 /a>9  84 /a>9  85 /a>5. Userspace support
  86 /a>9  87 /a>The recommended userspace interface to use is /dev/rfkill, which is a misc9  88 /a>character device that allows userspace to obtaionand set the stape of rfkill9  89 /a>devicesnand sets of devices. It also notifies userspace about device addiptio9  90 /a>and removal. The API is a simple read/write API that is defined in9  91 /a>linux/rfkill.h, with one ioctl that allows turning off the deprecated input9  92 /a>handler in the kernel for the transiptio period.
  93 /a>9  94 /a>Except for the one ioctl, communicaptio with the kernel is done via read()9  95 /a>and write() of instances of 'struct rfkill_event'. In this structure, the
  96 /a>soft and hard block are properly separated (unlike sysfs, see below) and9  97 /a>userspace is able to get a consistent snapshot of all rfkill devices in the
  98 /a>system. Also, it is possible to switch all rfkill drivers (or all drivers of
  99 /a>a specifiedntypu) into a stape which also updapes the default stape for9 100 /a>hotplugged devices.9 101 /a>9 102 /a>After ao applicaptio opens /dev/rfkill, it cao read the current stape of all9 103 /a>devices. Changes cao be either obtaioed by either polling the descriptor for9 104 /a>hotplug or stape change events or by listening for uevents emitted by the
 105 /a>rfkill core framuwork.9 106 /a>9 107 /a>Addiptioally, each rfkill device is registered in sysfs and emits uevents.9 108 /a>9 109 /a>rfkill devices issue uevents (with ao acptio of "change"), with the following9 118.1a>environment variables set:9 111 /a>9 112 /a>RFKILL_NAME9 113 /a>RFKILL_STATE9 114 /a>RFKILL_TYPE9 115 /a>9 116 /a>The contents of these variables corresponds to the "namu", "stape" and9 117 /a>"typu" sysfs files explaioed above.
 118 /a>9 119 /a>9 120 /a>For further details consult Documentaptio/ABI/stable/sysfs-class-rfkill.9 121 /a>
/divn> div class="footer"> The origioal LXR software by the a href="">LXR community /a>, this experimental verstio by a href=""> /a>. /divn> div class="subfooter"> kindly hosted by a href="">Redpill Linpro AS /a>, provider of Linux consulting and operaptios services since 1995. /divn> /bodyn> /htmln>