提交 960c7339 编写于 作者: J Johan Hovold 提交者: Greg Kroah-Hartman

USB: cdc-acm: handle broken union descriptors

Handle broken union functional descriptors where the master-interface
doesn't exist or where its class is of neither Communication or Data
type (as required by the specification) by falling back to
"combined-interface" probing.

Note that this still allows for handling union descriptors with switched
interfaces.

This specifically makes the Whistler radio scanners TRX series devices
work with the driver without adding further quirks to the device-id
table.
Reported-by: NDaniel Caujolle-Bert <f1rmb.daniel@gmail.com>
Tested-by: NDaniel Caujolle-Bert <f1rmb.daniel@gmail.com>
Acked-by: NOliver Neukum <oneukum@suse.com>
Signed-off-by: NJohan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/20200921135951.24045-3-johan@kernel.orgSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 e3be44cd
......@@ -1241,9 +1241,21 @@ static int acm_probe(struct usb_interface *intf,
}
}
} else {
int class = -1;
data_intf_num = union_header->bSlaveInterface0;
control_interface = usb_ifnum_to_if(usb_dev, union_header->bMasterInterface0);
data_interface = usb_ifnum_to_if(usb_dev, data_intf_num);
if (control_interface)
class = control_interface->cur_altsetting->desc.bInterfaceClass;
if (class != USB_CLASS_COMM && class != USB_CLASS_CDC_DATA) {
dev_dbg(&intf->dev, "Broken union descriptor, assuming single interface\n");
combined_interfaces = 1;
control_interface = data_interface = intf;
goto look_for_collapsed_interface;
}
}
if (!control_interface || !data_interface) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册