Add support for Whistler radio scanners TRX series, which have a union descriptor that designates a mass-storage interface as master. Handle that by generalising the NO_DATA_INTERFACE quirk to allow us to fall back to using the combined-interface detection.
Note that the NO_DATA_INTERFACE quirk was added by commit fd5054c169d2 ("USB: cdc_acm: Fix oops when Droids MuIn LCD is connected") to handle a combined-interface-type device with a broken call-management descriptor by hardcoding the "data" interface number.
Link: https://lore.kernel.org/r/5f4ca4f8.1c69fb81.a4487.0f5f@mx.google.com Reported-by: Daniel Caujolle-Bert f1rmb.daniel@gmail.com Tested-by: Daniel Caujolle-Bert f1rmb.daniel@gmail.com Cc: stable@vger.kernel.org Signed-off-by: Johan Hovold johan@kernel.org --- drivers/usb/class/cdc-acm.c | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-)
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 7f6f3ab5b8a6..816bb4859bfd 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c @@ -1220,27 +1220,26 @@ static int acm_probe(struct usb_interface *intf, if (cmgmd) call_intf_num = cmgmd->bDataInterface;
- if (!union_header) { - if (call_intf_num > 0) { + combined_interfaces = (quirks & NO_DATA_INTERFACE) != 0; + + if (!union_header || combined_interfaces) { + if (call_intf_num > 0 && !combined_interfaces) { dev_dbg(&intf->dev, "No union descriptor, using call management descriptor\n"); - /* quirks for Droids MuIn LCD */ - if (quirks & NO_DATA_INTERFACE) { - data_interface = usb_ifnum_to_if(usb_dev, 0); - } else { - data_intf_num = call_intf_num; - data_interface = usb_ifnum_to_if(usb_dev, data_intf_num); - } + data_intf_num = call_intf_num; + data_interface = usb_ifnum_to_if(usb_dev, data_intf_num); control_interface = intf; } else { if (intf->cur_altsetting->desc.bNumEndpoints != 3) { dev_dbg(&intf->dev,"No union descriptor, giving up\n"); return -ENODEV; - } else { + } + + if (!combined_interfaces) { dev_warn(&intf->dev,"No union descriptor, testing for castrated device\n"); combined_interfaces = 1; - control_interface = data_interface = intf; - goto look_for_collapsed_interface; } + control_interface = data_interface = intf; + goto look_for_collapsed_interface; } } else { data_intf_num = union_header->bSlaveInterface0; @@ -1807,6 +1806,19 @@ static const struct usb_device_id acm_ids[] = { .driver_info = CLEAR_HALT_CONDITIONS, },
+ { USB_DEVICE_INTERFACE_CLASS(0x2a59, 0x0010, USB_CDC_SUBCLASS_ACM), /* Whistler TRX-1 */ + .driver_info = NO_DATA_INTERFACE, + }, + { USB_DEVICE_INTERFACE_CLASS(0x2a59, 0x0011, USB_CDC_SUBCLASS_ACM), /* Whistler TRX-2 */ + .driver_info = NO_DATA_INTERFACE, + }, + { USB_DEVICE_INTERFACE_CLASS(0x2a59, 0x0012, USB_CDC_SUBCLASS_ACM), /* Whistler TRX-1e */ + .driver_info = NO_DATA_INTERFACE, + }, + { USB_DEVICE_INTERFACE_CLASS(0x2a59, 0x0013, USB_CDC_SUBCLASS_ACM), /* Whistler TRX-2e */ + .driver_info = NO_DATA_INTERFACE, + }, + /* Nokia S60 phones expose two ACM channels. The first is * a modem and is picked up by the standard AT-command * information below. The second is 'vendor-specific' but
linux-stable-mirror@lists.linaro.org