diff options
author | Elliott Hughes <enh@google.com> | 2023-04-10 17:40:53 +0000 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2023-04-10 17:40:53 +0000 |
commit | 812b81824c20e852d3218cb4e986f0f5fef8cd89 (patch) | |
tree | eae3a3f53ead9f89464c74852c2f955a653901d3 | |
parent | 6cc4588ba6d8b2ecaca09c269456e006a1b6db0a (diff) | |
parent | 704278e45d0441c5a13777af727e4159f2ebffd9 (diff) | |
download | toybox-812b81824c20e852d3218cb4e986f0f5fef8cd89.tar.gz |
Upgrade toybox to 704278e45d0441c5a13777af727e4159f2ebffd9android-u-beta-1-gpl
This project was upgraded with external_updater.
Usage: tools/external_updater/updater.sh update toybox
For more info, check https://cs.android.com/android/platform/superproject/+/master:tools/external_updater/README.md
Test: TreeHugger
Change-Id: Id26d1612559801afa577b6981e787b585cf4854b
-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) { |