diff options
author | Mike Lockwood <lockwood@android.com> | 2011-03-12 19:59:12 -0500 |
---|---|---|
committer | Xinyu Chen <xinyu.chen@freescale.com> | 2011-10-24 13:55:47 +0800 |
commit | 6885228c5db180e355bf7e94b30f32f05d5c08db (patch) | |
tree | 95f4c24fad202c41d9366199cf43eae81528a90b /drivers | |
parent | 2ef364114fadeb222e05737c0374fba1973d26cf (diff) |
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.
Change-Id: Ica5e113c085cbecda648f1849a550c0dbac2cbbd
Signed-off-by: Mike Lockwood <lockwood@android.com>
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Shruthi Krishna <skrish@codeaurora.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/gadget/f_accessory.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/usb/gadget/f_accessory.c b/drivers/usb/gadget/f_accessory.c index ef21c05caaed..f6a5922e8c3b 100644 --- a/drivers/usb/gadget/f_accessory.c +++ b/drivers/usb/gadget/f_accessory.c @@ -220,13 +220,6 @@ static void acc_set_disconnected(struct acc_dev *dev) { dev->online = 0; 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) @@ -657,6 +650,13 @@ static int acc_function_setup(struct usb_function *f, if (b_request == ACCESSORY_GET_PROTOCOL) { *((u16 *)cdev->req->buf) = PROTOCOL_VERSION; 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)); } } } |