aguinet / usbtop

usbtop is a top-like utility that shows an estimated instantaneous bandwidth on USB buses and devices.
BSD 3-Clause "New" or "Revised" License
277 stars 45 forks source link

auto-load the usbmon module? #30

Open onlyjob opened 4 years ago

onlyjob commented 4 years ago

As reported in https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=906132 usbtop insists on manual loading of the usbmon module even when running as root:

$ sudo usbtop
Error while capturing traffic from usbmon1: usbmon1: Can't open USB bus file /sys/kernel/debug/usbmon/1t: No such file or directory
Error while capturing traffic from usbmon2: usbmon2: Can't open USB bus file /sys/kernel/debug/usbmon/2t: No such file or directory
Error while capturing traffic from usbmon3: usbmon3: Can't open USB bus file /sys/kernel/debug/usbmon/3t: No such file or directory
Error while capturing traffic from usbmon4: usbmon4: Can't open USB bus file /sys/kernel/debug/usbmon/4t: No such file or directory
Error while capturing traffic from usbmon5: usbmon5: Can't open USB bus file /sys/kernel/debug/usbmon/5t: No such file or directory
Error while capturing traffic from usbmon6: usbmon6: Can't open USB bus file /sys/kernel/debug/usbmon/6t: No such file or directory
FATAL ERROR: couldn't open any USB buses with pcap. Did you load the usbmon module (sudo modprobe usbmon)?
You might also need to run this software as root.

It'd be nice to coalesced the above errors into one, as they have a single well-known cause. The current spam is so long that an inattentive reader might miss the modprobe suggestion (as I did).

But, as usbtop already needs root, why not just load the module yourself?

aguinet commented 4 years ago

This is indeed something we could do. Do not hesitate to submit a PR for this!