From 6b41ae6b3bacb88bddd6f328069acd45308739f9 Mon Sep 17 00:00:00 2001 From: ArenM Date: Sun, 23 Oct 2022 19:32:04 -0400 Subject: [PATCH] udev rules: fix detection of community firmware `!=` doesn't seem to be the exact inverse of `==`. To prove this I added the following to the udev rules. On a system with the community firmware both COMM_FW and NOT_COMM_FW were set to true, with the quectel firmware only NOT_COMM_FW was true. ATTRS{serial}=="community_fw", ENV{COMM_FW}="true" ATTRS{serial}!="community_fw", ENV{NOT_COMM_FW}="true" --- udev/80-modem-eg25.rules | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/udev/80-modem-eg25.rules b/udev/80-modem-eg25.rules index b01b862..57f575e 100644 --- a/udev/80-modem-eg25.rules +++ b/udev/80-modem-eg25.rules @@ -1,22 +1,18 @@ -ACTION!="add", GOTO="eg25_end" -SUBSYSTEM!="usb", GOTO="eg25_end" -DRIVERS!="usb", GOTO="eg25_end" -ENV{DEVTYPE}!="usb_device", GOTO="eg25_end" +ACTION=="add", SUBSYSTEM=="usb", DRIVERS=="usb", ENV{DEVTYPE}=="usb_device", GOTO="eg25_start" +GOTO="eg25_end" # Default attributes values +LABEL="eg25_start" ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ATTR{power/control}="auto" ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ATTR{power/autosuspend_delay_ms}="3000" ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ATTR{power/wakeup}="enabled" ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ATTR{power/persist}="0" -# If running the stock firmware, stop processing here -ATTRS{serial}!="community_fw", GOTO="eg25_end" - # power/control needs to be "on" for the community-maintained firmware -ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ATTR{power/control}="on" +ATTRS{serial}=="community_fw", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ATTR{power/control}="on" # Special trick for the PinePhone Pro: set power/persist to 1 *only* with the community FW # We can identify the PPP by looking for the string "pinephone-pro" in the device tree "compatible" property -ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", PROGRAM=="/bin/grep pine64,pinephone-pro /proc/device-tree/compatible", ATTR{power/persist}="1" +ATTRS{serial}=="community_fw", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", PROGRAM=="/bin/grep pine64,pinephone-pro /proc/device-tree/compatible", ATTR{power/persist}="1" LABEL="eg25_end"