Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to find out the amount of bandwidth my USB webcam occupies while I'm using it. I would prefer a command line solution.

share|improve this question
up vote 5 down vote accepted

I think this can be done with wireshark.

When it is plug a USB device, in syslog it appear a message like

Feb 7 21:35:42 Computer kernel: [ 1237.639216] usb 2-1.1.4: new high-speed USB device number 8 using ehci_hcd

With this information, we know the device was plugged in bus 2 with device number 8.

The fire up wireshark

$ sudo wireshark

It will appear a list of devices... choose the one with same bus id you plug the device, in this case, "USB bus number 2" and start the capture.

In menu, choose "Statistics" then "IO Graphs".

Then in the graphs options, you can create a filter with just de device you want.

For example:

(usb.bus_id == 2) && (usb.device_address == 8)

In "X Axis" and "Y Axis" ajust the values to have a graphic with 'normal' values, for example Tick Interval: 1 sec, Unit: Bits/tick, and with that the graphic should be in Bits/sec.

IO Graphics

share|improve this answer
1  
For this to work properly, the usbmon kernel module should be loaded first - wiki.wireshark.org/CaptureSetup/USB – guigouz Jan 24 '15 at 16:37

I've wrote a pair of shell scripts to get the throughput from a USB device. If someone what to use it, you can find it in this post.

share|improve this answer
    
Hi @Pipe. I tried to follow your blog but could not figure out how to build the usbmon userspace program from github.com/kkaempf/usbmon . It builds a usbdump program, not a usbmon program as your scripts are expecting. Can you clarify how you got the dependencies set up? – Lucas Feb 18 at 23:19
    
Hi Lucas, those scripts where a quick hack and I never try to make it run without root account. It is not very clear in the post, but getUsb.sh must be run as root. – Pipe Feb 22 at 10:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.