summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2022-04-12 22:56:15 +0000
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-04-14 18:06:51 +0000
commit9f530cd97ef5a64e4712128051a17d5de8b43e53 (patch)
tree84db220296c1101b18c1ab6b6a6013a921e8b6c1
parent7c396b2737621c02e33ec0709638ab436ab247a1 (diff)
downloadchrome-ec-9f530cd97ef5a64e4712128051a17d5de8b43e53.tar.gz
ectool: Read bInterfaceNumber correctly
This patch makes find_interface_with_endpoint use bInterfaceNumber explicitly instead of the i iterator, which could be different from the discovered interface number if there is no interface at index 0. BUG=b:229012657 BRANCH=None TEST=Run 'ectool -d 18d1:5022 rgbkbd clear 0' on Vell. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I43ccb1ad926b0f699eed22fb2567e6ae6f8e1eaa Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3584920 Reviewed-by: Parth Malkan <parthmalkan@google.com> Reviewed-by: Zhuohao Lee <zhuohao@chromium.org>
-rw-r--r--util/comm-usb.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/util/comm-usb.c b/util/comm-usb.c
index 3810af6ea8..9b362aa2f4 100644
--- a/util/comm-usb.c
+++ b/util/comm-usb.c
@@ -125,8 +125,9 @@ static int find_interface_with_endpoint(struct usb_endpoint *uep)
ep = &iface->endpoint[k];
if (ep->bEndpointAddress == uep->ep_num) {
uep->chunk_len = ep->wMaxPacketSize;
+ r = iface->bInterfaceNumber;
libusb_free_config_descriptor(conf);
- return i;
+ return r;
}
}
}