From 7a4e147515fca42009953e1dfb7b2b5fcdd95b89 Mon Sep 17 00:00:00 2001 From: dlg Date: Sat, 1 Apr 2023 00:04:40 +0000 Subject: [PATCH] follow quectel guidance on which usb interfaces umsm should match. the Quectel LTE&5G Linux USB Driver User Guide V2.0 says umsm should only attach to usb interfaces 0 to 3 using the interface class UICLASS_VENDOR. their doco uses magic numbers, but this is what they mean. interfaces 4 and above provide network (not serial) via qmi, ecm, or mbim. preventing umsm from attaching to the high interfaces allows the appropriate network driver to use it instead. eg, umb is now able to attach to the network interface because it presents a standard mbim class. discussed with and tested by kevlo@ ok patric@ sthen@ kevlo@ --- sys/dev/usb/umsm.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/sys/dev/usb/umsm.c b/sys/dev/usb/umsm.c index bbe2af0c4dc..357842d03f8 100644 --- a/sys/dev/usb/umsm.c +++ b/sys/dev/usb/umsm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: umsm.c,v 1.123 2023/03/31 23:55:45 dlg Exp $ */ +/* $OpenBSD: umsm.c,v 1.124 2023/04/01 00:04:40 dlg Exp $ */ /* * Copyright (c) 2008 Yojiro UO @@ -340,6 +340,16 @@ umsm_match(struct device *parent, void *match, void *aux) (id->bInterfaceSubClass == 0x00 && id->bInterfaceProtocol == 0x00)))) { return UMATCH_NONE; + + /* See the Quectel LTE&5G Linux USB Driver User Guide */ + } else if (uaa->vendor == USB_VENDOR_QUECTEL) { + /* Some interfaces can be used as network devices */ + if (id->bInterfaceClass != UICLASS_VENDOR) + return UMATCH_NONE; + + /* Interface 4 can be used as a network device */ + if (uaa->ifaceno >= 4) + return UMATCH_NONE; } return UMATCH_VENDOR_IFACESUBCLASS; -- 2.20.1