summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksandermj@chromium.org>2023-11-20 13:32:34 +0000
committerAleksander Morgado <aleksander@aleksander.es>2023-12-01 13:38:18 +0000
commit7df94a1195115340245f7bfbdb680e005e799586 (patch)
tree7af3a8af5ac6d8a2e7c1a143983a5aa5a7c3dadc
parent6662764338d3127924cfefaa9cf1b0cc4f90a189 (diff)
libqmi-glib,udev: change qmi_wwan sysfs attr ownership to QMI_USERNAME if set
If the build system has defined a username to change the ownership of the QMI control device, use the same username to change ownership of the sysfs attributes exposed by the qmi_wwan driver, which allow us to control e.g. raw-ip vs 802.3 link layer protocol management or multiplexing support features. # ls -ltr /sys/class/net/wwan0/qmi total 0 -rw-r--r--. 1 modem root 4096 Nov 20 05:35 del_mux -rw-r--r--. 1 modem root 4096 Nov 20 05:35 add_mux -rw-r--r--. 1 modem root 4096 Nov 20 05:36 pass_through -rw-r--r--. 1 modem root 4096 Nov 20 05:36 raw_ip
-rw-r--r--src/libqmi-glib/76-qmi-device-ownership.rules.in5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libqmi-glib/76-qmi-device-ownership.rules.in b/src/libqmi-glib/76-qmi-device-ownership.rules.in
index 22a7e7b..f0442a5 100644
--- a/src/libqmi-glib/76-qmi-device-ownership.rules.in
+++ b/src/libqmi-glib/76-qmi-device-ownership.rules.in
@@ -4,4 +4,9 @@ ACTION!="add|change|move", GOTO="qmi_device_ownership_end"
KERNEL=="cdc-wdm*", DRIVERS=="qmi_wwan", SUBSYSTEM=="usbmisc", OWNER="@QMI_USERNAME@"
+SUBSYSTEM=="net", DRIVERS=="qmi_wwan", TEST=="qmi/raw_ip", RUN+="/bin/chown @QMI_USERNAME@ \"$sys/$devpath/qmi/raw_ip\""
+SUBSYSTEM=="net", DRIVERS=="qmi_wwan", TEST=="qmi/pass_through", RUN+="/bin/chown @QMI_USERNAME@ \"$sys/$devpath/qmi/pass_through\""
+SUBSYSTEM=="net", DRIVERS=="qmi_wwan", TEST=="qmi/del_mux", RUN+="/bin/chown @QMI_USERNAME@ \"$sys/$devpath/qmi/del_mux\""
+SUBSYSTEM=="net", DRIVERS=="qmi_wwan", TEST=="qmi/add_mux", RUN+="/bin/chown @QMI_USERNAME@ \"$sys/$devpath/qmi/add_mux\""
+
LABEL="qmi_device_ownership_end"