diff options
author | Mike Lockwood <lockwood@android.com> | 2011-03-10 16:12:49 -0500 |
---|---|---|
committer | Rohan Somvanshi <rsomvanshi@nvidia.com> | 2011-05-31 05:57:27 -0700 |
commit | bd33a5c6bd43b2269fc6113bfdb1680ad5b5a1e2 (patch) | |
tree | f588c37af9a19cb6f2601fbb46e623dd487fc81e /drivers | |
parent | e7cf9509a401e45acbc6bc8411edaeaf07efaf3a (diff) |
USB: gadget: f_accessory: Clear accessory strings when USB is disconnected
Signed-off-by: Mike Lockwood <lockwood@android.com>
(cherry picked from commit 6c778587651da91039ad09dea4a93988f1736843)
Change-Id: Ib5acd2ced156417b97d956e5baa11e801e14a491
Reviewed-on: http://git-master/r/32888
Reviewed-by: Suresh Mangipudi <smangipudi@nvidia.com>
Tested-by: Suresh Mangipudi <smangipudi@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/gadget/f_accessory.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/drivers/usb/gadget/f_accessory.c b/drivers/usb/gadget/f_accessory.c index 2ebc0363843e..ef21c05caaed 100644 --- a/drivers/usb/gadget/f_accessory.c +++ b/drivers/usb/gadget/f_accessory.c @@ -216,14 +216,25 @@ static struct usb_request *req_get(struct acc_dev *dev, struct list_head *head) return req; } +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) { struct acc_dev *dev = _acc_dev; - if (req->status != 0) { - dev->online = 0; - dev->disconnected = 1; - } + if (req->status != 0) + acc_set_disconnected(dev); req_put(dev, &dev->tx_idle, req); @@ -235,10 +246,8 @@ static void acc_complete_out(struct usb_ep *ep, struct usb_request *req) struct acc_dev *dev = _acc_dev; dev->rx_done = 1; - if (req->status != 0) { - dev->online = 0; - dev->disconnected = 1; - } + if (req->status != 0) + acc_set_disconnected(dev); wake_up(&dev->read_wq); } @@ -706,7 +715,7 @@ static void acc_function_disable(struct usb_function *f) struct usb_composite_dev *cdev = dev->cdev; DBG(cdev, "acc_function_disable\n"); - dev->online = 0; + acc_set_disconnected(dev); usb_ep_disable(dev->ep_in); usb_ep_disable(dev->ep_out); |