summaryrefslogtreecommitdiffstats
path: root/fastboot/usb_osx.c
diff options
context:
space:
mode:
authorScott Anderson <saa@android.com>2012-04-06 12:39:30 -0700
committerScott Anderson <saa@android.com>2012-04-19 11:59:09 -0700
commit13081c6915220db03886b177f1a8e0b2c63467c9 (patch)
treea57de4a1fef7b3124971dabe4ddc44deff6c9bdc /fastboot/usb_osx.c
parent5383476727659544875b90d49a5371886a31c1fe (diff)
downloadsystem_core-13081c6915220db03886b177f1a8e0b2c63467c9.zip
system_core-13081c6915220db03886b177f1a8e0b2c63467c9.tar.gz
system_core-13081c6915220db03886b177f1a8e0b2c63467c9.tar.bz2
fastboot: Add ability to specify device path
For manufacturing and testing, there is a need to talk to whatever device is connected to a given port on the host. This change modifies fastboot's "-s" option to take either a serial number or a device path. The device paths of the connected devices can be listed using "fastboot -l devices" whose output will resemble: 016B75D60A00600D usb:2-5 fastboot AD3C12020173 usb:1-4.3 fastboot The second column lists the device paths. If the -l option is not given, the output from "fastboot devices" will be the same as it used to be (i.e. the paths will not be printed). Finally, note that the format of the device paths are platform dependent. The example above is from Linux. On OS-X, the paths will be "usb:" followed by hex digits. For Windows, the device paths will be printed as "????????????" and the -s option will not be able to select a device until someone implements the underlying functionality in usb_windows.c. Change-Id: I1f01b8f47acd32edb0ac18db107316a2c923bbde Signed-off-by: Scott Anderson <saa@android.com>
Diffstat (limited to 'fastboot/usb_osx.c')
-rw-r--r--fastboot/usb_osx.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/fastboot/usb_osx.c b/fastboot/usb_osx.c
index 570a456..605c8e2 100644
--- a/fastboot/usb_osx.c
+++ b/fastboot/usb_osx.c
@@ -264,6 +264,7 @@ static int try_device(io_service_t device, usb_handle *handle) {
SInt32 score;
HRESULT result;
UInt8 serialIndex;
+ UInt32 locationId;
// Create an intermediate plugin.
kr = IOCreatePlugInInterfaceForService(device,
@@ -322,6 +323,13 @@ static int try_device(io_service_t device, usb_handle *handle) {
goto error;
}
+ kr = (*dev)->GetLocationID(dev, &locationId);
+ if (kr != 0) {
+ ERR("GetLocationId");
+ goto error;
+ }
+ snprintf(handle->info.device_path, sizeof(handle->info.device_path), "usb:%lX", locationId);
+
kr = (*dev)->USBGetSerialNumberStringIndex(dev, &serialIndex);
if (serialIndex > 0) {