diff options
author | Elliott Hughes <enh@google.com> | 2023-04-10 21:07:16 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2023-04-10 21:07:16 +0000 |
commit | 19cda32cfd156b940cad0a35e331445f004d23e0 (patch) | |
tree | eae3a3f53ead9f89464c74852c2f955a653901d3 | |
parent | 907b337c46b6b4e2a4808ec6041e9423601184bc (diff) | |
parent | d7a79762d22f8afbfb607d721e240e23d568ceff (diff) | |
download | toybox-19cda32cfd156b940cad0a35e331445f004d23e0.tar.gz |
Upgrade toybox to 704278e45d0441c5a13777af727e4159f2ebffd9 am: 812b81824c am: 041e78a0a7 am: 421d6b883a am: d7a79762d2
Original change: https://android-review.googlesource.com/c/platform/external/toybox/+/2528028
Change-Id: I36e19823e3dad553c897f546ec8c536d5ea0b536
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | METADATA | 4 | ||||
-rw-r--r-- | toys/other/lsusb.c | 26 |
2 files changed, 15 insertions, 15 deletions
@@ -13,11 +13,11 @@ third_party { type: GIT value: "https://github.com/landley/toybox" } - version: "9f683b843678048d6008bf26f3e6cdef085258db" + version: "704278e45d0441c5a13777af727e4159f2ebffd9" license_type: UNENCUMBERED last_upgrade_date { year: 2023 month: 4 - day: 6 + day: 10 } } diff --git a/toys/other/lsusb.c b/toys/other/lsusb.c index c4f64529..600858bb 100644 --- a/toys/other/lsusb.c +++ b/toys/other/lsusb.c @@ -58,7 +58,7 @@ struct scanloop { // note that %s is omitted (because pointer is into toybuf, avoiding copy). static int scan_uevent(struct dirtree *new, int len, struct scanloop *sl) { - int ii, count = 0; + int ii, saw = 0; off_t flen = sizeof(toybuf); char *ss, *yy; @@ -75,18 +75,18 @@ static int scan_uevent(struct dirtree *new, int len, struct scanloop *sl) // Try each pattern for (ii = 0; ii<len; ii++) { if (strchr(sl[ii].pattern, '%')) { - if (2-!sl[ii].d2==sscanf(ss, sl[ii].pattern, sl[ii].d1, sl[ii].d2)) - break; - } else if (strstart(&ss, sl[ii].pattern)) { - *(void **)sl[ii].d1 = ss; - break; - } + if (2-!sl[ii].d2!=sscanf(ss, sl[ii].pattern, sl[ii].d1, sl[ii].d2)) + continue; + } else if (strstart(&ss, sl[ii].pattern)) *(void **)sl[ii].d1 = ss; + else continue; + saw |= 1<<ii; + + break; } - if (ii!=len) count++; ss = yy; } - return count; + return saw; } static void get_names(struct dev_ids *ids, int id1, int id2, @@ -165,7 +165,7 @@ static int list_usb(struct dirtree *new) char *n1, *n2; if (!new->parent) return DIRTREE_RECURSE; - if (3 == scan_uevent(new, 3, (struct scanloop[]){{"BUSNUM=%u", &busnum, 0}, + if (7 == scan_uevent(new, 3, (struct scanloop[]){{"BUSNUM=%u", &busnum, 0}, {"DEVNUM=%u", &devnum, 0}, {"PRODUCT=%x/%x", &pid, &vid}})) { get_names(TT.ids, pid, vid, &n1, &n2); @@ -207,7 +207,7 @@ static int list_pci(struct dirtree *new) } // Load uevent data, look up names in database - if (3 != scan_uevent(new, 3, (struct scanloop[]){{"DRIVER=", &driver, 0}, + if (6>scan_uevent(new, 3, (struct scanloop[]){{"DRIVER=", &driver, 0}, {"PCI_CLASS=%x", cvd, 0}, {"PCI_ID=%x:%x", cvd+1, cvd+2}})) return 0; get_names(TT.class, 255&(cvd[0]>>16), 255&(cvd[0]>>8), names, names); get_names(TT.ids, cvd[1], cvd[2], names+1, names+2); @@ -226,8 +226,8 @@ static int list_pci(struct dirtree *new) break; } else printf(" \"%s [%s]\"", names[ii], buf); } - printf(FLAG(m) ? " -r%02x" : " (rev %02x)", revision); - if (FLAG(k)) printf(FLAG(m) ? " \"%s\"" : " %s", driver); + if (revision) printf(FLAG(m) ? " -r%02x" : " (rev %02x)", revision); + if (FLAG(k) && driver) printf(FLAG(m) ? " \"%s\"" : " %s", driver); xputc('\n'); if (TT.x) { |