summaryrefslogtreecommitdiffstats
path: root/libs/usb/tests
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2011-03-09 22:03:57 -0500
committerMike Lockwood <lockwood@android.com>2011-03-09 22:12:49 -0500
commitac36d7c715a9cd793b2dce6de547594810101c3a (patch)
tree5f347132f5896785d47519c1ae728af1113db1f0 /libs/usb/tests
parentb966b9d9e882835691e5adda292d89dd704df71c (diff)
downloadframeworks_base-ac36d7c715a9cd793b2dce6de547594810101c3a.zip
frameworks_base-ac36d7c715a9cd793b2dce6de547594810101c3a.tar.gz
frameworks_base-ac36d7c715a9cd793b2dce6de547594810101c3a.tar.bz2
UsbAccessory: Add URI string, replace type string with description
This is a first step toward adding USB accessory URI support BUG: 4073248 Modified USB accessory matching logic to look only at manufacturer, model and version (description and URI are not considered when matching apps to accessories) Also added test for USB accessory protocol version to accessorytest BUG: 4080288 Change-Id: I992a3433c74efa7a7db37bf030f02c1f0c92f9e2 Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'libs/usb/tests')
-rw-r--r--libs/usb/tests/AccessoryChat/accessorychat/accessorychat.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/libs/usb/tests/AccessoryChat/accessorychat/accessorychat.c b/libs/usb/tests/AccessoryChat/accessorychat/accessorychat.c
index 94cc0ce..3c0de69 100644
--- a/libs/usb/tests/AccessoryChat/accessorychat/accessorychat.c
+++ b/libs/usb/tests/AccessoryChat/accessorychat/accessorychat.c
@@ -133,10 +133,19 @@ static int usb_device_added(const char *devname, void* client_data) {
} else {
printf("Found possible android device - attempting to switch to accessory mode\n");
+ uint16_t protocol;
+ ret = usb_device_control_transfer(device, USB_DIR_IN | USB_TYPE_VENDOR,
+ ACCESSORY_GET_PROTOCOL, 0, 0, &protocol, sizeof(protocol), 0);
+ if (ret == 2)
+ printf("device supports protocol version %d\n", protocol);
+ else
+ fprintf(stderr, "failed to read protocol version\n");
+
send_string(device, ACCESSORY_STRING_MANUFACTURER, "Google, Inc.");
send_string(device, ACCESSORY_STRING_MODEL, "AccessoryChat");
- send_string(device, ACCESSORY_STRING_TYPE, "Sample Program");
+ send_string(device, ACCESSORY_STRING_DESCRIPTION, "Sample Program");
send_string(device, ACCESSORY_STRING_VERSION, "1.0");
+ send_string(device, ACCESSORY_STRING_URI, "http://www.android.com");
ret = usb_device_control_transfer(device, USB_DIR_OUT | USB_TYPE_VENDOR,
ACCESSORY_START, 0, 0, 0, 0, 0);