From 97a9901f63d23d076a6d9d996a167ac4235c04aa Mon Sep 17 00:00:00 2001 From: hselasky Date: Mon, 8 Jun 2020 09:31:14 +0000 Subject: [PATCH] MFC r361582: Fix check for wMaxPacketSize in USB bluetooth driver, in case device is not FULL speed. Sponsored by: Mellanox Technologies git-svn-id: svn://svn.freebsd.org/base/stable/10@361916 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c b/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c index edbd32ccd..bf087ed73 100644 --- a/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c +++ b/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c @@ -540,7 +540,7 @@ ubt_attach(device_t dev) struct usb_endpoint_descriptor *ed; struct usb_interface_descriptor *id; struct usb_interface *iface; - uint16_t wMaxPacketSize; + uint32_t wMaxPacketSize; uint8_t alt_index, i, j; uint8_t iface_index[2] = { 0, 1 }; @@ -630,9 +630,10 @@ ubt_attach(device_t dev) if ((ed->bDescriptorType == UDESC_ENDPOINT) && (ed->bLength >= sizeof(*ed)) && (i == 1)) { - uint16_t temp; + uint32_t temp; - temp = UGETW(ed->wMaxPacketSize); + temp = usbd_get_max_frame_length( + ed, NULL, usbd_get_speed(uaa->device)); if (temp > wMaxPacketSize) { wMaxPacketSize = temp; alt_index = j; -- 2.42.0