diff --git a/INSTALL.md b/INSTALL.md index 423b75b..cfd1540 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -6,6 +6,8 @@ We have packaged `swhkd-git`. `swhkd-bin` has been packaged separately by a user `swhkd` and `swhks` install to `/usr/local/bin/` by default. You can change this behaviour by editing the [Makefile](../Makefile) variable, `DESTDIR`, which acts as a prefix for all installed files. You can also specify it in the make command line, e.g. to install everything in `subdir`: `make DESTDIR="subdir" install`. +Note: On some systems swhkd daemon might disable wifi due to issues with rfkill, you could pass `make NO_RFKILL_SW_SUPPORT=1` while buliding to disable rfkill support. + # Dependencies: **Runtime:** diff --git a/Makefile b/Makefile index 93b3b07..b3e593e 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,10 @@ MAN1_DIR := /usr/share/man/man1 MAN5_DIR := /usr/share/man/man5 VERSION = $(shell awk -F ' = ' '$$1 ~ /version/ { gsub(/["]/, "", $$2); printf("%s",$$2) }' Cargo.toml) +ifneq ($(NO_RFKILL_SW_SUPPORT),) + BUILDFLAGS += --features "no_rfkill" +endif + all: build build: diff --git a/contrib/PKGBUILD b/contrib/PKGBUILD index db0f4e1..bc6718d 100644 --- a/contrib/PKGBUILD +++ b/contrib/PKGBUILD @@ -4,7 +4,7 @@ _pkgname="swhkd" pkgname="${_pkgname}-git" -pkgver=1.2.1.r17.g022466e +pkgver=1.2.1.r92.ge972f55 pkgrel=1 arch=("x86_64") url="https://github.com/waycrate/swhkd" @@ -21,7 +21,7 @@ sha256sums=("SKIP" build(){ cd "$_pkgname" make setup - make + make NO_RFKILL_SW_SUPPORT=1 } package() { diff --git a/swhkd/Cargo.toml b/swhkd/Cargo.toml index 77fe2ab..7c6a9f3 100644 --- a/swhkd/Cargo.toml +++ b/swhkd/Cargo.toml @@ -12,6 +12,9 @@ authors = [ [build-dependencies] flate2 = "1.0.24" +[features] +no_rfkill = [] + [dependencies] clap = { version = "4.1.0", features = ["derive"] } env_logger = "0.9.0" diff --git a/swhkd/src/uinput.rs b/swhkd/src/uinput.rs index f0684ae..ff6ae46 100644 --- a/swhkd/src/uinput.rs +++ b/swhkd/src/uinput.rs @@ -3,10 +3,14 @@ use evdev::{ AttributeSet, Key, RelativeAxisType, SwitchType, }; +#[cfg(not(feature = "no_rfkill"))] use nix::ioctl_none; +#[cfg(not(feature = "no_rfkill"))] use std::fs::File; +#[cfg(not(feature = "no_rfkill"))] use std::os::unix::io::AsRawFd; +#[cfg(not(feature = "no_rfkill"))] ioctl_none!(rfkill_noinput, b'R', 1); pub fn create_uinput_device() -> Result> { @@ -36,10 +40,15 @@ pub fn create_uinput_switches_device() -> Result &'static [SwitchType] { SwitchType::SW_LID, SwitchType::SW_TABLET_MODE, SwitchType::SW_HEADPHONE_INSERT, + #[cfg(not(feature = "no_rfkill"))] SwitchType::SW_RFKILL_ALL, SwitchType::SW_MICROPHONE_INSERT, SwitchType::SW_DOCK,