I have rfkill switches under path "/sys/class/net/$INTERFACE/phy80211/rfkill*" but not "/sys/class/net/$INTERFACE/rfkill" on two systems with iwlagn and ath9k drivers. Guess someone else also has these. Signed-off-by: Ivan Shapovalov <intelfx100@gmail.com> --- src/rfkill | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/rfkill b/src/rfkill index 12e1832..330544b 100644 --- a/src/rfkill +++ b/src/rfkill @@ -29,10 +29,18 @@ get_rf_path() { report_fail "no rfkill switch with name $RFKILL_NAME" else path="/sys/class/net/$INTERFACE/rfkill" + + # There may be many rfkill switches attached to a single PHY + # For now take the first of them + path_phy=( $(find "/sys/class/net/$INTERFACE/phy80211/" -type d -name 'rfkill*') ) + if [[ -d "$path" ]]; then echo "$path" return 0 - fi + elif [[ -n "${path_phy[0]}" ]]; then + echo "${path_phy[0]}" + return 0 + fi report_fail "no rfkill switch available on interface $INTERFACE" fi return 1 -- 1.7.12.2