summaryrefslogtreecommitdiff
path: root/drivers/usb/gadget/f_accessory.c
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2011-03-14 18:28:55 -0400
committerRohan Somvanshi <rsomvanshi@nvidia.com>2011-05-31 05:58:17 -0700
commit84e582ad82a1eb610419e700d27c0799837cac0e (patch)
tree7d9b65bc712bcf34f2f5805662fd8be76e484c48 /drivers/usb/gadget/f_accessory.c
parent6cd10de16b93369d02f22c92b52d6a8303f73a37 (diff)
USB: gadget: f_accessory: Add string for accessory's unique serial number
Signed-off-by: Mike Lockwood <lockwood@android.com> (cherry picked from commit 99b7fdff26bdaa2dbdecd45db18834f9d7447632) Change-Id: Ic4e663abf1a3c6d0ea21983f5e2171a34c0e6641 Reviewed-on: http://git-master/r/32891 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/usb/gadget/f_accessory.c')
-rw-r--r--drivers/usb/gadget/f_accessory.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/usb/gadget/f_accessory.c b/drivers/usb/gadget/f_accessory.c
index baeae5976b66..38918cdf6c5b 100644
--- a/drivers/usb/gadget/f_accessory.c
+++ b/drivers/usb/gadget/f_accessory.c
@@ -71,6 +71,7 @@ struct acc_dev {
char description[ACC_STRING_SIZE];
char version[ACC_STRING_SIZE];
char uri[ACC_STRING_SIZE];
+ char serial[ACC_STRING_SIZE];
/* for acc_complete_set_string */
int string_index;
@@ -273,6 +274,9 @@ static void acc_complete_set_string(struct usb_ep *ep, struct usb_request *req)
case ACCESSORY_STRING_URI:
string_dest = dev->uri;
break;
+ case ACCESSORY_STRING_SERIAL:
+ string_dest = dev->serial;
+ break;
}
if (string_dest) {
unsigned long flags;
@@ -505,6 +509,9 @@ static long acc_ioctl(struct file *fp, unsigned code, unsigned long value)
case ACCESSORY_GET_STRING_URI:
src = dev->uri;
break;
+ case ACCESSORY_GET_STRING_SERIAL:
+ src = dev->serial;
+ break;
}
if (!src)
return -EINVAL;
@@ -658,6 +665,7 @@ static int acc_function_setup(struct usb_function *f,
memset(dev->description, 0, sizeof(dev->description));
memset(dev->version, 0, sizeof(dev->version));
memset(dev->uri, 0, sizeof(dev->uri));
+ memset(dev->serial, 0, sizeof(dev->serial));
}
}
}