summaryrefslogtreecommitdiff
path: root/extra
diff options
context:
space:
mode:
authorNick Sanders <nsanders@chromium.org>2018-07-02 18:44:50 -0700
committerchrome-bot <chrome-bot@chromium.org>2019-05-24 15:09:15 -0700
commit94468b6b0077e27ab1d25d6a8266deae73bc0e32 (patch)
tree036536ed7ce545408327cb83ab8f9e97c66e848b /extra
parentea1f2d28c3618556cb6d18032eafd15f2d215a6f (diff)
downloadchrome-ec-94468b6b0077e27ab1d25d6a8266deae73bc0e32.tar.gz
ec-devutils: update for pyusb-1.0.2
pyusb 1.0.2 changed two API calls upon which we depend: b3ee6cdfef8f find function returns an iterator. dac78933f6a6 Removed unnecessary length argument to util.get_string This CL only updates callers of these APIs (the previous CL contained some unrelated changes around kernel driver detach and closing stm32usb). Signed-off-by: Nick Sanders <nsanders@chromium.org> Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Based-on: https://chromium-review.googlesource.com/1125354 BRANCH=None BUG=chromium:958677 TEST=precq passes TEST=chromiumos-sdk tryjob buildbucketId=8915374561970847360 TEST=using servo v2 servod -b grunt => no python exceptions when starting servod TEST=using servo v4 servod -b grunt => no python exceptions when starting servod TEST=using u-Servo: servod -b grunt => no python exceptions when starting servod for i in {1..10000} ; do echo $i $(dut-control ec_uart_en spi1_buf_en ); done => No stability regression versus pyusb-1.0.0b1 TEST=servo_updater, EC console via servo Cq-Depend: chromium:1597548,chromium:1597156,chromium:1597157 Change-Id: Ic8101707838e5d19e901cf1f7125b97b5102f089 Reviewed-on: https://chromium-review.googlesource.com/1597156 Commit-Ready: Daniel Kurtz <djkurtz@chromium.org> Tested-by: Daniel Kurtz <djkurtz@chromium.org> Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Chris McDonald <cjmcdonald@chromium.org>
Diffstat (limited to 'extra')
-rw-r--r--extra/tigertool/ecusb/stm32usb.py6
-rwxr-xr-xextra/usb_power/powerlog.py3
-rwxr-xr-xextra/usb_serial/console.py3
-rwxr-xr-xextra/usb_updater/fw_update.py5
4 files changed, 11 insertions, 6 deletions
diff --git a/extra/tigertool/ecusb/stm32usb.py b/extra/tigertool/ecusb/stm32usb.py
index b8ffb2765e..5a91c57d13 100644
--- a/extra/tigertool/ecusb/stm32usb.py
+++ b/extra/tigertool/ecusb/stm32usb.py
@@ -57,8 +57,10 @@ class Susb(object):
def _find_device(self):
"""Set up the usb endpoint"""
# Find the stm32.
- dev_list = usb.core.find(idVendor=self._vendor, idProduct=self._product,
+ dev_g = usb.core.find(idVendor=self._vendor, idProduct=self._product,
find_all=True)
+ dev_list = list(dev_g)
+
if not dev_list:
raise SusbError('USB device not found')
@@ -66,7 +68,7 @@ class Susb(object):
dev = None
if self._serialname:
for d in dev_list:
- dev_serial = usb.util.get_string(d, 256, d.iSerialNumber)
+ dev_serial = usb.util.get_string(d, d.iSerialNumber)
if dev_serial == self._serialname:
dev = d
break
diff --git a/extra/usb_power/powerlog.py b/extra/usb_power/powerlog.py
index a025bd75ec..44754ad663 100755
--- a/extra/usb_power/powerlog.py
+++ b/extra/usb_power/powerlog.py
@@ -154,7 +154,8 @@ class Spower(object):
self._board = board
# Find the stm32.
- dev_list = usb.core.find(idVendor=vendor, idProduct=product, find_all=True)
+ dev_g = usb.core.find(idVendor=vendor, idProduct=product, find_all=True)
+ dev_list = list(dev_g)
if dev_list is None:
raise Exception("Power", "USB device not found")
diff --git a/extra/usb_serial/console.py b/extra/usb_serial/console.py
index 3ab73890d5..bc03ea869e 100755
--- a/extra/usb_serial/console.py
+++ b/extra/usb_serial/console.py
@@ -71,7 +71,8 @@ class Susb():
SusbError: An error accessing Susb object
"""
# Find the device.
- dev_list = usb.core.find(idVendor=vendor, idProduct=product, find_all=True)
+ dev_g = usb.core.find(idVendor=vendor, idProduct=product, find_all=True)
+ dev_list = list(dev_g)
if dev_list is None:
raise SusbError("USB device not found")
diff --git a/extra/usb_updater/fw_update.py b/extra/usb_updater/fw_update.py
index 367c0cad14..8a73070ccf 100755
--- a/extra/usb_updater/fw_update.py
+++ b/extra/usb_updater/fw_update.py
@@ -67,7 +67,8 @@ class Supdate(object):
vendor = self._brdcfg['vid']
product = self._brdcfg['pid']
- dev_list = usb.core.find(idVendor=vendor, idProduct=product, find_all=True)
+ dev_g = usb.core.find(idVendor=vendor, idProduct=product, find_all=True)
+ dev_list = list(dev_g)
if dev_list is None:
raise Exception("Update", "USB device not found")
@@ -75,7 +76,7 @@ class Supdate(object):
dev = None
if serialname:
for d in dev_list:
- if usb.util.get_string(d, 256, d.iSerialNumber) == serialname:
+ if usb.util.get_string(d, d.iSerialNumber) == serialname:
dev = d
break
if dev is None: