Hi, I think, wireshark already does this with better GUI, but I just wanted to learn shell scripting, so I thought this could be the best thing to try, So I tried to parse usbmon data using shell script. I have attached the same script, to get some review/feedback regarding the current implementation, to get some more error logs, and If I am misunderstanding anything. Right now, for non control endpoints, it only works for mass-storage class, and wish to add more interface if it is worth doing. You can run this script as, 1. mount -t debugfs none_debugs /sys/kernel/debug 2. modprobe usbmon [only, if module not already loaded] 3. cat /sys/kernel/debug/usbmon/0u > ~/usbmonlog.txt 4. connect mass-storage usb device and do necessary operations 5. On another terminal, start parsing using "bash parse_usbmon.sh -f ~/usbmonlog.txt" along with -f , following _optional_ variable args are supported "-e X" parse only endpoint X [currently supported only ept 0] "-a XXX" parse only device addr XXX "-v" print URB Tag, Timestamp in microseconds, Event Type & addr "-h" print this help Thanks for all your feedback and error logs. Regards, Shivdas Gujare
Attachment:
parse_usbmon.sh
Description: Bourne shell script