usb: gadget: set correct usb_configuration for os_desc_config
The current way to set cdev->os_desc_config is wrong if user restart fastboot, as the old config is not used anymore and new allocated usb_configuration will be used, so set the os_desc_config while usb_add_config. Reviewed-by: Ye Li <ye.li@nxp.com> Signed-off-by: Li Jun <jun.li@nxp.com> Signed-off-by: Peter Chen <peter.chen@nxp.com> Signed-off-by: Peng Fan <peng.fan@nxp.com>
This commit is contained in:
@@ -399,10 +399,6 @@ static int set_config(struct usb_composite_dev *cdev,
|
|||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
cdev->config = c;
|
cdev->config = c;
|
||||||
if (cdev->use_os_string) {
|
|
||||||
cdev->os_desc_config = c;
|
|
||||||
os_desc_config = c;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initialize all interfaces by setting them to altsetting zero. */
|
/* Initialize all interfaces by setting them to altsetting zero. */
|
||||||
for (tmp = 0; tmp < MAX_CONFIG_INTERFACES; tmp++) {
|
for (tmp = 0; tmp < MAX_CONFIG_INTERFACES; tmp++) {
|
||||||
@@ -516,6 +512,9 @@ int usb_add_config(struct usb_composite_dev *cdev,
|
|||||||
|
|
||||||
usb_ep_autoconfig_reset(cdev->gadget);
|
usb_ep_autoconfig_reset(cdev->gadget);
|
||||||
|
|
||||||
|
if (os_desc_config)
|
||||||
|
cdev->os_desc_config = os_desc_config;
|
||||||
|
|
||||||
done:
|
done:
|
||||||
if (status)
|
if (status)
|
||||||
debug("added config '%s'/%u --> %d\n", config->label,
|
debug("added config '%s'/%u --> %d\n", config->label,
|
||||||
@@ -1373,9 +1372,6 @@ static int composite_bind(struct usb_gadget *gadget)
|
|||||||
/* Microsoft OS String Descriptor */
|
/* Microsoft OS String Descriptor */
|
||||||
utf8_to_utf16le(qw_sign_buf, (__le16 *)cdev->qw_sign,
|
utf8_to_utf16le(qw_sign_buf, (__le16 *)cdev->qw_sign,
|
||||||
OS_STRING_QW_SIGN_LEN / 2);
|
OS_STRING_QW_SIGN_LEN / 2);
|
||||||
|
|
||||||
if (os_desc_config)
|
|
||||||
cdev->os_desc_config = os_desc_config;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
debug("%s: ready\n", composite->name);
|
debug("%s: ready\n", composite->name);
|
||||||
|
|||||||
Reference in New Issue
Block a user