aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2023-04-10 19:36:39 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-04-10 19:36:39 +0000
commit041e78a0a7205230fe582fd398909bc69428c464 (patch)
treeeae3a3f53ead9f89464c74852c2f955a653901d3
parente2b551e34279bb4b080b8b4f4181cf88420efee2 (diff)
parent812b81824c20e852d3218cb4e986f0f5fef8cd89 (diff)
downloadtoybox-041e78a0a7205230fe582fd398909bc69428c464.tar.gz
Upgrade toybox to 704278e45d0441c5a13777af727e4159f2ebffd9 am: 812b81824c
Original change: https://android-review.googlesource.com/c/platform/external/toybox/+/2528028 Change-Id: Ie03353d09adb4e627d37f063b3cbc30bdfb4e527 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--METADATA4
-rw-r--r--toys/other/lsusb.c26
2 files changed, 15 insertions, 15 deletions
diff --git a/METADATA b/METADATA
index f2b0ece1..16647e4b 100644
--- a/METADATA
+++ b/METADATA
@@ -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) {