From 7774f7c8f2aa7af30526a9caef463a0aeb66bd7d Mon Sep 17 00:00:00 2001 From: Manthan Patil Date: Sat, 8 Mar 2025 22:29:04 +0000 Subject: [PATCH 1/6] Fix: Added rfkill as a feature flag --- swhkd/Cargo.toml | 4 ++++ swhkd/src/uinput.rs | 16 +++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/swhkd/Cargo.toml b/swhkd/Cargo.toml index 77fe2ab3..c09e7a04 100644 --- a/swhkd/Cargo.toml +++ b/swhkd/Cargo.toml @@ -12,6 +12,10 @@ authors = [ [build-dependencies] flate2 = "1.0.24" +[features] +rfkill = [] +default = ["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 f0684ae4..3453d87c 100644 --- a/swhkd/src/uinput.rs +++ b/swhkd/src/uinput.rs @@ -3,10 +3,14 @@ use evdev::{ AttributeSet, Key, RelativeAxisType, SwitchType, }; +#[cfg(feature = "rfkill")] use nix::ioctl_none; +#[cfg(feature = "rfkill")] use std::fs::File; +#[cfg(feature = "rfkill")] use std::os::unix::io::AsRawFd; +#[cfg(feature = "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(feature = "rfkill")] SwitchType::SW_RFKILL_ALL, SwitchType::SW_MICROPHONE_INSERT, SwitchType::SW_DOCK, From db1503e5650fabe5bb946bf0b7d6be8229eca83c Mon Sep 17 00:00:00 2001 From: Manthan Patil Date: Wed, 19 Mar 2025 22:19:49 +0000 Subject: [PATCH 2/6] Updated Makefile --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index 93b3b076..eec7e640 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_DEFAULT_FEATURES),) + BUILDFLAGS += --no-default-features +endif + all: build build: From de8d627a567101265631622006679a5b1702df08 Mon Sep 17 00:00:00 2001 From: Manthan Patil Date: Wed, 19 Mar 2025 22:26:16 +0000 Subject: [PATCH 3/6] docs: update build instructions --- INSTALL.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/INSTALL.md b/INSTALL.md index d90d65dd..6640feb6 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_DEFAULT_FEATURES=1` while buliding to disable rfkill support. + # Dependencies: **Runtime:** From 249245ef0f4e38d83340fd98a7a2455cdb3fd4e3 Mon Sep 17 00:00:00 2001 From: Manthan Patil Date: Wed, 19 Mar 2025 22:54:53 +0000 Subject: [PATCH 4/6] Remove rfkill feature from PKGBUILD --- contrib/PKGBUILD | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/PKGBUILD b/contrib/PKGBUILD index db0f4e1c..69d9f0cc 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.r91.gde8d627 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_DEFAULT_FEATURES=1 } package() { From 1fce2776610d6d4ade9ce386245a30dc3191c674 Mon Sep 17 00:00:00 2001 From: Manthan Patil Date: Mon, 31 Mar 2025 06:29:26 +0000 Subject: [PATCH 5/6] updated flag to no_rfkill --- Makefile | 4 ++-- contrib/PKGBUILD | 4 ++-- swhkd/Cargo.toml | 3 +-- swhkd/src/uinput.rs | 12 ++++++------ 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index eec7e640..b3e593ed 100644 --- a/Makefile +++ b/Makefile @@ -9,8 +9,8 @@ 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_DEFAULT_FEATURES),) - BUILDFLAGS += --no-default-features +ifneq ($(NO_RFKILL_SW_SUPPORT),) + BUILDFLAGS += --features "no_rfkill" endif all: build diff --git a/contrib/PKGBUILD b/contrib/PKGBUILD index 69d9f0cc..bc6718dc 100644 --- a/contrib/PKGBUILD +++ b/contrib/PKGBUILD @@ -4,7 +4,7 @@ _pkgname="swhkd" pkgname="${_pkgname}-git" -pkgver=1.2.1.r91.gde8d627 +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 NO_DEFAULT_FEATURES=1 + make NO_RFKILL_SW_SUPPORT=1 } package() { diff --git a/swhkd/Cargo.toml b/swhkd/Cargo.toml index c09e7a04..7c6a9f31 100644 --- a/swhkd/Cargo.toml +++ b/swhkd/Cargo.toml @@ -13,8 +13,7 @@ authors = [ flate2 = "1.0.24" [features] -rfkill = [] -default = ["rfkill"] +no_rfkill = [] [dependencies] clap = { version = "4.1.0", features = ["derive"] } diff --git a/swhkd/src/uinput.rs b/swhkd/src/uinput.rs index 3453d87c..ff6ae46a 100644 --- a/swhkd/src/uinput.rs +++ b/swhkd/src/uinput.rs @@ -3,14 +3,14 @@ use evdev::{ AttributeSet, Key, RelativeAxisType, SwitchType, }; -#[cfg(feature = "rfkill")] +#[cfg(not(feature = "no_rfkill"))] use nix::ioctl_none; -#[cfg(feature = "rfkill")] +#[cfg(not(feature = "no_rfkill"))] use std::fs::File; -#[cfg(feature = "rfkill")] +#[cfg(not(feature = "no_rfkill"))] use std::os::unix::io::AsRawFd; -#[cfg(feature = "rfkill")] +#[cfg(not(feature = "no_rfkill"))] ioctl_none!(rfkill_noinput, b'R', 1); pub fn create_uinput_device() -> Result> { @@ -41,7 +41,7 @@ pub fn create_uinput_switches_device() -> Result &'static [SwitchType] { SwitchType::SW_LID, SwitchType::SW_TABLET_MODE, SwitchType::SW_HEADPHONE_INSERT, - #[cfg(feature = "rfkill")] + #[cfg(not(feature = "no_rfkill"))] SwitchType::SW_RFKILL_ALL, SwitchType::SW_MICROPHONE_INSERT, SwitchType::SW_DOCK, From 3fceb010165d2fe2fb7d89aeebf30ce4a99c90cf Mon Sep 17 00:00:00 2001 From: Manthan Patil Date: Mon, 31 Mar 2025 06:37:52 +0000 Subject: [PATCH 6/6] updated docs --- INSTALL.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/INSTALL.md b/INSTALL.md index b5411500..cfd15406 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -6,7 +6,7 @@ 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_DEFAULT_FEATURES=1` while buliding to disable rfkill support. +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: