From 4282c8d843a144f20f0e1bd9f632751af7a5ff70 Mon Sep 17 00:00:00 2001 From: Stephan Gerhold Date: Wed, 9 Jun 2021 13:49:08 +0200 Subject: [PATCH] udev: Match WWAN "type" attribute instead of device name Recent changes in the WWAN framework in the kernel changed the WWAN port names from e.g. "wwan0p1AT" and "wwan0p2QMI" to "wwan0at0" and "wwan0qmi0" [1, 2]. This means that the udev rules no longer match since AT/QMI are now lower-case and no longer at the end of the name. However, recently additionally a "type" sysfs attribute was added for all WWAN ports [3], which makes it much more reliable to match the WWAN port names without relying on their exact device name. Add some additional udev rules to apply the port hints based on the "type" sysfs attributes. This fixes the port enumeration on newer Linux kernels that include the aforementioned commits. Note that we still need to keep the old udev rules for now since Linux 5.13 does not have the "type" attribute yet. [1]: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=392c26f7f133b9f09e5f58db1ce6ef4b3b4df49f [2]: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=f458709ff40b0d992fec496952f79c7820dd3fde [3]: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=b3e22e10fdda8e7be3830289a4a63ae8b88d450c --- src/80-mm-candidate.rules | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/80-mm-candidate.rules b/src/80-mm-candidate.rules index afa524a4..d33c232e 100644 --- a/src/80-mm-candidate.rules +++ b/src/80-mm-candidate.rules @@ -24,6 +24,12 @@ KERNEL=="cdc-wdm[0-9]*", SUBSYSTEM=="usbmisc", ENV{ID_MM_CANDIDATE}="1" SUBSYSTEMS=="usb", GOTO="mm_candidate_end" SUBSYSTEM=="wwan", ENV{DEVTYPE}=="wwan_dev", GOTO="mm_candidate_end" SUBSYSTEM=="wwan", ENV{ID_MM_CANDIDATE}="1" +SUBSYSTEM=="wwan", ATTR{type}=="AT", ENV{ID_MM_PORT_TYPE_AT_PRIMARY}="1" +SUBSYSTEM=="wwan", ATTR{type}=="MBIM", ENV{ID_MM_PORT_TYPE_MBIM}="1" +SUBSYSTEM=="wwan", ATTR{type}=="QMI", ENV{ID_MM_PORT_TYPE_QMI}="1" +SUBSYSTEM=="wwan", ATTR{type}=="QCDM", ENV{ID_MM_PORT_TYPE_QCDM}="1" + +# Linux 5.13 does not have "type" attribute yet, match kernel name instead SUBSYSTEM=="wwan", KERNEL=="*MBIM", ENV{ID_MM_PORT_TYPE_MBIM}="1" SUBSYSTEM=="wwan", KERNEL=="*QMI", ENV{ID_MM_PORT_TYPE_QMI}="1" SUBSYSTEM=="wwan", KERNEL=="*AT", ENV{ID_MM_PORT_TYPE_AT_PRIMARY}="1"