Reputation: 16144
I'm trying to find out the speed of a live data-transfer via USB on a Mac run from the command line with Android Debug Bridge.
Is there a way to do this with any Python-packages ?
Basically, I just want to the script to show me the speed as-is shown at the bottom of a file-transfer window. If not with Python, any command-line utility for the same are welcome.
Upvotes: 0
Views: 1679
Reputation: 9816
Are you doing the file transfer inside python? With a reader and writer?
If so, you can read a piece into a buffer, write it out, update a progressbar and repeat this until the file is completely transfered.
The progressbar module has options to calculate and display the transfer rate just by giving it updates on the writing progress.
See http://code.google.com/p/python-progressbar/ for more info and examples of the progressbar module.
edit: fixxer, you can use python to check the file size of the file(s) on the usb device and update the progressbar when the file grows. This is not really measuring the transfer speed of the usb bus, but if you're transfering files it will give an indication of how fast this is going.
If you are streaming a movie, or flashing a chip you'd have to talk to the usb bus directly. Maybe look into http://www.libusb.org/ and it's python wrapper https://github.com/walac/pyusb
Upvotes: 1