summaryrefslogtreecommitdiff
path: root/src/mbim-proxy
diff options
context:
space:
mode:
authorRoshan Pius <rpius@chromium.org>2014-12-22 09:33:19 -0800
committerAleksander Morgado <aleksander@aleksander.es>2014-12-22 21:36:53 +0100
commit3333eb4a5c2401559732023b9a4139a20d74743e (patch)
treef96797534d3f5cd4532aa43a40ff2eaa83e43d76 /src/mbim-proxy
parent0f7fa9f88710f34f1931d95b9f1b1b1f07b9c757 (diff)
downloadlibmbim-3333eb4a5c2401559732023b9a4139a20d74743e.tar.gz
libmbim-glib,proxy: Change ownership of MBIM devices to the configured user.
Adding a udev rule to change ownership of all MBIM devices to the configured user specified at compile time using --enable-mbim-username flag.
Diffstat (limited to 'src/mbim-proxy')
-rw-r--r--src/mbim-proxy/76-mbim-proxy-device-ownership.rules.in12
-rw-r--r--src/mbim-proxy/Makefile.am9
2 files changed, 21 insertions, 0 deletions
diff --git a/src/mbim-proxy/76-mbim-proxy-device-ownership.rules.in b/src/mbim-proxy/76-mbim-proxy-device-ownership.rules.in
new file mode 100644
index 0000000..9f82b96
--- /dev/null
+++ b/src/mbim-proxy/76-mbim-proxy-device-ownership.rules.in
@@ -0,0 +1,12 @@
+# do not edit this file, it will be overwritten on update
+
+ACTION!="add|change|move", GOTO="mbim_proxy_device_ownership_end"
+
+# A 'cdc-wdm' device is from a MBIM and MBIM-based modems.
+KERNEL=="cdc-wdm[0-9]", DRIVERS=="mbim_wwan", SUBSYSTEM=="usbmisc", GOTO="mbim_proxy_device_ownership_change"
+GOTO="mbim_proxy_device_ownership_end"
+
+LABEL="mbim_proxy_device_ownership_change"
+OWNER="@MBIM_USERNAME@"
+
+LABEL="mbim_proxy_device_ownership_end"
diff --git a/src/mbim-proxy/Makefile.am b/src/mbim-proxy/Makefile.am
index 83a8ce4..1558fe5 100644
--- a/src/mbim-proxy/Makefile.am
+++ b/src/mbim-proxy/Makefile.am
@@ -14,3 +14,12 @@ mbim_proxy_SOURCES = mbim-proxy.c
mbim_proxy_LDADD = \
$(MBIMPROXY_LIBS) \
$(top_builddir)/src/libmbim-glib/libmbim-glib.la
+
+#Install udev rules only if configured with --enable-mbim-username
+if INSTALL_MBIM_UDEV_RULES
+udevrulesdir = $(UDEV_BASE_DIR)/rules.d
+udevrules_DATA = 76-mbim-proxy-device-ownership.rules
+endif
+
+EXTRA_DIST = \
+ 76-mbim-proxy-device-ownership.rules.in