cros_scripts: Update vm usb passthrough

Change usb passthrough to take a vendorid, productid
pair instead of a hostbus, hostaddr pair.

BUG=chromium:542466
TEST=Tested passthrough with a peppy.

Change-Id: Idc9b01b2bf1f6c91ac59cdef66621bd0db8b47b9
Reviewed-on: https://chromium-review.googlesource.com/305265
Commit-Ready: Matthew Sartori <msartori@chromium.org>
Tested-by: Matthew Sartori <msartori@chromium.org>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
diff --git a/bin/cros_start_vm b/bin/cros_start_vm
index 11f178c..ee3dc8b 100755
--- a/bin/cros_start_vm
+++ b/bin/cros_start_vm
@@ -18,8 +18,8 @@
 DEFINE_string image_path "" "Full path of the VM image"
 DEFINE_string usb_devices "" \
     "Usb devices for passthrough. Specified in a comma-separated list
-     where each item is of the form <host_usb_bus>:<usb_device_id>
-     (eg. --usb_devices=1:3,2:7)"
+     where each item is of the form <vendor_id>:<product_id>
+     (eg. --usb_devices=1050:0211,0409:005a)"
 DEFINE_boolean moblab ${FLAGS_FALSE} "Setup environment for moblab"
 
 set -e
diff --git a/lib/cros_vm_lib.sh b/lib/cros_vm_lib.sh
index 3b41028..f4a40a3 100644
--- a/lib/cros_vm_lib.sh
+++ b/lib/cros_vm_lib.sh
@@ -202,14 +202,15 @@
 
     local usb_passthrough=""
     if [ -n "${FLAGS_usb_devices}" ]; then
-      usb_devices=(${FLAGS_usb_devices//,/ })
+      local bus_id
+      local usb_devices=(${FLAGS_usb_devices//,/ })
       for bus_id in "${usb_devices[@]}"; do
-        device=(${bus_id//:/ })
+        local device=(${bus_id//:/ })
         if [ ${#device[@]} -ne 2 ]; then
           continue
         fi
-        passthrough="-device usb-host,hostbus=${device[0]},hostaddr=${device[1]}"
-        usb_passthrough="${usb_passthrough} ${passthrough}"
+        usb_passthrough+="-device usb-host,vendorid=$((0x${device[0]}))"
+        usb_passthrough+=",productid=$((0x${device[1]}))"
       done
 
       if [ -n "${usb_passthrough}" ]; then