diff options
| author | Ondrej Čerman <ondrej.cerman@gmail.com> | 2019-08-04 21:14:15 +0200 | 
|---|---|---|
| committer | Ondrej Čerman <ondrej.cerman@gmail.com> | 2019-08-04 21:14:15 +0200 | 
| commit | 9592e1fcab84dd9b5ab3af6c2e2623269ba47ecf (patch) | |
| tree | 6ae6ec1880fa8e5e9d38ef352464bbe6eff7ef5f | |
| parent | 7efea8df3316180be625309d52ce34475d924071 (diff) | |
usb: use sysfs by default (that is usually faster than lsusb)
| -rw-r--r-- | hardinfo/usb_util.c | 8 | 
1 files changed, 5 insertions, 3 deletions
| diff --git a/hardinfo/usb_util.c b/hardinfo/usb_util.c index 792750a6..c908eec4 100644 --- a/hardinfo/usb_util.c +++ b/hardinfo/usb_util.c @@ -427,10 +427,12 @@ usbd *usb_get_device(int bus, int dev, const gchar* sysfspath) {      usbd *s = usbd_new();      int ok = 0;      if (s) { -        /* try lsusb */ -        ok = usb_get_device_lsusb(bus, dev, s);          /* try sysfs */ -        ok |= usb_get_device_sysfs(bus, dev, sysfspath, s); +        ok = usb_get_device_sysfs(bus, dev, sysfspath, s); +        if (!ok) { +            /* try lsusb */ +            ok = usb_get_device_lsusb(bus, dev, s); +        }          if (!ok) {              usbd_free(s);              s = NULL; | 
