Skip to content
Snippets Groups Projects
Commit 6f992b5f authored by Mike Lockwood's avatar Mike Lockwood Committed by Dima Zavin
Browse files

USB: gadget: f_accessory: Clear previous strings on ACCESSORY_GET_PROTOCOL


Clearing strings on disconnect does not work since we may receive
a disconnect on some devices when transitioning into accessory mode.
We require an accessory to send ACCESSORY_GET_PROTOCOL before
sending any strings, so any strings from a previous session will be cleared.

Signed-off-by: default avatarMike Lockwood <lockwood@android.com>
parent 9cf8b580
No related branches found
No related tags found
No related merge requests found
...@@ -220,13 +220,6 @@ static void acc_set_disconnected(struct acc_dev *dev) ...@@ -220,13 +220,6 @@ static void acc_set_disconnected(struct acc_dev *dev)
{ {
dev->online = 0; dev->online = 0;
dev->disconnected = 1; dev->disconnected = 1;
/* clear all accessory strings */
memset(dev->manufacturer, 0, sizeof(dev->manufacturer));
memset(dev->model, 0, sizeof(dev->model));
memset(dev->description, 0, sizeof(dev->description));
memset(dev->version, 0, sizeof(dev->version));
memset(dev->uri, 0, sizeof(dev->uri));
} }
static void acc_complete_in(struct usb_ep *ep, struct usb_request *req) static void acc_complete_in(struct usb_ep *ep, struct usb_request *req)
...@@ -657,6 +650,13 @@ static int acc_function_setup(struct usb_function *f, ...@@ -657,6 +650,13 @@ static int acc_function_setup(struct usb_function *f,
if (b_request == ACCESSORY_GET_PROTOCOL) { if (b_request == ACCESSORY_GET_PROTOCOL) {
*((u16 *)cdev->req->buf) = PROTOCOL_VERSION; *((u16 *)cdev->req->buf) = PROTOCOL_VERSION;
value = sizeof(u16); value = sizeof(u16);
/* clear any strings left over from a previous session */
memset(dev->manufacturer, 0, sizeof(dev->manufacturer));
memset(dev->model, 0, sizeof(dev->model));
memset(dev->description, 0, sizeof(dev->description));
memset(dev->version, 0, sizeof(dev->version));
memset(dev->uri, 0, sizeof(dev->uri));
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment