@@ -3,12 +3,6 @@ use evdev::{
33 AttributeSet , Key , RelativeAxisType , SwitchType ,
44} ;
55
6- use nix:: ioctl_none;
7- use std:: fs:: File ;
8- use std:: os:: unix:: io:: AsRawFd ;
9-
10- ioctl_none ! ( rfkill_noinput, b'R' , 1 ) ;
11-
126pub fn create_uinput_device ( ) -> Result < VirtualDevice , Box < dyn std:: error:: Error > > {
137 let keys: AttributeSet < Key > = get_all_keys ( ) . iter ( ) . copied ( ) . collect ( ) ;
148
@@ -26,20 +20,6 @@ pub fn create_uinput_device() -> Result<VirtualDevice, Box<dyn std::error::Error
2620pub fn create_uinput_switches_device ( ) -> Result < VirtualDevice , Box < dyn std:: error:: Error > > {
2721 let switches: AttributeSet < SwitchType > = get_all_switches ( ) . iter ( ) . copied ( ) . collect ( ) ;
2822
29- // We have to disable rfkill-input to avoid blocking all radio devices. When
30- // a new device (virtual or physical) with the SW_RFKILL_ALL capability bit
31- // set appears, rfkill reacts immediately depending on the value bit. This
32- // value bit defaults to unset, which causes rfkill to use its default mode
33- // (which is eop - emergency power off). The uinput API does not give any
34- // way to set the corresponding value bit before creating the device, and we
35- // have no way to avoid rfkill acting upon the device creation or to change
36- // its default mode. Thus, we disable rfkill-input temporarily, hopefully
37- // fast enough that it won't impact anyone. rfkill-input will be enabled
38- // again when the file gets closed.
39- let rfkill_file = File :: open ( "/dev/rfkill" ) ?;
40- unsafe {
41- rfkill_noinput ( rfkill_file. as_raw_fd ( ) ) ?;
42- }
4323 let device = VirtualDeviceBuilder :: new ( ) ?
4424 . name ( "swhkd switches virtual output" )
4525 . with_switches ( & switches) ?
@@ -622,7 +602,6 @@ pub fn get_all_switches() -> &'static [SwitchType] {
622602 SwitchType :: SW_LID ,
623603 SwitchType :: SW_TABLET_MODE ,
624604 SwitchType :: SW_HEADPHONE_INSERT ,
625- SwitchType :: SW_RFKILL_ALL ,
626605 SwitchType :: SW_MICROPHONE_INSERT ,
627606 SwitchType :: SW_DOCK ,
628607 SwitchType :: SW_LINEOUT_INSERT ,
0 commit comments