cdc_ncm: Set NTB format again after altsetting switch for Huawei devices
Subsystems (2)
Quoted 3 lines · Enrico Mioso
From: Enrico Mioso <[email protected]>
commit
2b02c20ce0c28974b44e69a2e2f5ddc6a470ad6fupstream.
[...]
Quoted 10 lines
drivers/net/usb/cdc_ncm.c +2
-0@@ -724,8 +724,10 @@ int cdc_ncm_bind_common(struct usbnet *d u8 *buf; int len; int temp; +int err; u8 iface_no; struct usb_cdc_parsed_header hdr; +u16 curr_ntb_format;
[...]
drivers/net/usb/cdc_ncm.c
Quoted 8 lines
drivers/net/usb/cdc_ncm.c +8
-0+ err =usbnet_read_cmd (dev,USB_CDC_GET_NTB_FORMAT , + USB_TYPE_CLASS | USB_DIR_IN | USB_RECIP_INTERFACE, + 0, iface_no, &curr_ntb_format, 2); +if (err <0 ) { + goto error2; + } + +if (curr_ntb_format ==USB_CDC_NCM_NTB32_FORMAT ) {
[...]
usbnet_read_cmd() doesn't do any byte-swapping, so it looks like curr_ntb_format will have little-endian byte order (__le16 not u16). The comparison will then need to be done using le16_to_cpu(curr_ntb_format).
Ben.
Signature · 7 lines
Ben Hutchings Software Developer, Codethink Ltd. -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 26 lines · Ben Hutchings
Quoted 3 lines · Enrico Mioso
From: Enrico Mioso <[email protected]>
commit
2b02c20ce0c28974b44e69a2e2f5ddc6a470ad6fupstream.[...]
Quoted 10 lines
drivers/net/usb/cdc_ncm.c +2
-0@@ -724,8 +724,10 @@ int cdc_ncm_bind_common(struct usbnet *d u8 *buf; int len; int temp; +int err; u8 iface_no; struct usb_cdc_parsed_header hdr; +u16 curr_ntb_format;[...]
Quoted 8 lines
drivers/net/usb/cdc_ncm.c +8
-0+ err =usbnet_read_cmd (dev,USB_CDC_GET_NTB_FORMAT , + USB_TYPE_CLASS | USB_DIR_IN | USB_RECIP_INTERFACE, + 0, iface_no, &curr_ntb_format, 2); +if (err <0 ) { + goto error2; + } + +if (curr_ntb_format ==USB_CDC_NCM_NTB32_FORMAT ) {[...]
Quoted 4 lines
usbnet_read_cmd()doesn't do any byte-swapping, so it looks likecurr_ntb_formatwill have little-endian byte order (__le16not u16). The comparison will then need to be done usingle16_to_cpu(curr_ntb_format).
Right. Thanks. Fix coming up ASAP.
I cannot explain why since we are obviously reading and writing 2 bytes here, but for some reason I've always thought of this value as 8 bit.
Bjørn