diff options
author | Steffen Dirkwinkel <s.dirkwinkel@beckhoff.com> | 2023-01-17 07:58:46 +0000 |
---|---|---|
committer | Corvin Köhne <corvink@FreeBSD.org> | 2023-01-18 11:17:09 +0000 |
commit | 73c3e8b1dee6cd42de32287ea8a57762b961d8ee (patch) | |
tree | ebb0437711e8612eac6fe766a16a66ded8b91a9a /sys/dev/usb | |
parent | 896f556205c8d87ef842dc844752daa7d2385336 (diff) | |
download | src-73c3e8b1dee6cd42de32287ea8a57762b961d8ee.tar.gz src-73c3e8b1dee6cd42de32287ea8a57762b961d8ee.zip |
umodem: add quirk to ignore CDC_CM descriptor
Some devices have CDC_CM descriptors that would point us to
the wrong interfaces. Add a quirk to ignore those (prefering the
CDC_UNION descriptor effectively)
Reviewed by: manu
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D37942
Diffstat (limited to 'sys/dev/usb')
-rw-r--r-- | sys/dev/usb/quirk/usb_quirk.c | 1 | ||||
-rw-r--r-- | sys/dev/usb/quirk/usb_quirk.h | 1 | ||||
-rw-r--r-- | sys/dev/usb/serial/umodem.c | 4 |
3 files changed, 5 insertions, 1 deletions
diff --git a/sys/dev/usb/quirk/usb_quirk.c b/sys/dev/usb/quirk/usb_quirk.c index 68e4910202b0..3baa3acba187 100644 --- a/sys/dev/usb/quirk/usb_quirk.c +++ b/sys/dev/usb/quirk/usb_quirk.c @@ -662,6 +662,7 @@ static const char *usb_quirk_str[USB_QUIRK_MAX] = { [UQ_CFG_INDEX_4] = "UQ_CFG_INDEX_4", [UQ_CFG_INDEX_0] = "UQ_CFG_INDEX_0", [UQ_ASSUME_CM_OVER_DATA] = "UQ_ASSUME_CM_OVER_DATA", + [UQ_IGNORE_CDC_CM] = "UQ_IGNORE_CDC_CM", [UQ_MSC_NO_TEST_UNIT_READY] = "UQ_MSC_NO_TEST_UNIT_READY", [UQ_MSC_NO_RS_CLEAR_UA] = "UQ_MSC_NO_RS_CLEAR_UA", [UQ_MSC_NO_START_STOP] = "UQ_MSC_NO_START_STOP", diff --git a/sys/dev/usb/quirk/usb_quirk.h b/sys/dev/usb/quirk/usb_quirk.h index 85bec036f84d..755465576684 100644 --- a/sys/dev/usb/quirk/usb_quirk.h +++ b/sys/dev/usb/quirk/usb_quirk.h @@ -66,6 +66,7 @@ enum { UQ_CFG_INDEX_4, /* select configuration index 4 by default */ UQ_CFG_INDEX_0, /* select configuration index 0 by default */ UQ_ASSUME_CM_OVER_DATA, /* assume cm over data feature */ + UQ_IGNORE_CDC_CM, /* ignore cm descriptor */ /* * USB Mass Storage Quirks. See "storage/umass.c" for a diff --git a/sys/dev/usb/serial/umodem.c b/sys/dev/usb/serial/umodem.c index e9de2950fb9d..d059559bd39f 100644 --- a/sys/dev/usb/serial/umodem.c +++ b/sys/dev/usb/serial/umodem.c @@ -359,7 +359,9 @@ umodem_attach(device_t dev) /* get the data interface number */ - cmd = umodem_get_desc(uaa, UDESC_CS_INTERFACE, UDESCSUB_CDC_CM); + cmd = NULL; + if (!usb_test_quirk(uaa, UQ_IGNORE_CDC_CM)) + cmd = umodem_get_desc(uaa, UDESC_CS_INTERFACE, UDESCSUB_CDC_CM); if ((cmd == NULL) || (cmd->bLength < sizeof(*cmd))) { cud = usbd_find_descriptor(uaa->device, NULL, |