Giter Site home page Giter Site logo

ultraembedded / usb2sniffer Goto Github PK

View Code? Open in Web Editor NEW
48.0 4.0 10.0 1.23 MB

USB2Sniffer: High Speed USB 2.0 capture (for LambdaConcept USB2Sniffer hardware)

Verilog 43.59% C++ 23.39% Makefile 1.54% C 30.97% Tcl 0.51%
usb-scanning usb-debugging usb usb2 fpga xilinx-vivado rtl verilog usb-analyzer usb-sniffer

usb2sniffer's Introduction

USB2Sniffer: High Speed USB 2.0 capture (alternate SW/FPGA bitstream for LambdaConcept USB2Sniffer)

Github: https://github.com/ultraembedded/usb2sniffer

Intro

This repo contains an alternative set of FPGA gateware and SW for performing USB2.0 capture with the LambaConcept USB2Sniffer FPGA board (buy).

The key difference between this and the stock FPGA gateware for this board is that this version contains more advanced USB protocol decoding within the FPGA, allowing for more powerful on-target device id / endpoint / SOF filtering.
Capturing USB traffic is done via a command-line tool, and the resulting binary can be converted into several 3rd party output formats for display or can be parsed using the provided SW library.

USB2Sniffer

Getting Started

Cloning

To clone this project and its dependencies;

git clone --recursive https://github.com/ultraembedded/usb2sniffer.git

Usage

With the bitstream loaded onto the target board, the following sequence can be used to capture some USB traffic;

# Build the command line applications
cd sw
make

# Start a capture
./capture/capture -f /tmp/capture.bin

# Convert to PCAP
./convert/convert -f /tmp/capture.bin -o capture.pcap

# Convert to txt file
./convert/convert -f /tmp/capture.bin -o capture.txt

# Convert to USB file (readable using LcSniff)
./convert/convert -f /tmp/capture.bin -o capture.usb

LambdaConcept Lcsniff

After converting captured data from binary to .usb file format, the LambdaConcept Lcsniff GUI can be used to view the captured data;

Lcsniff

Wireshark - Raw USB (DLT_USB_2_0)

To view PCAPs with Wireshark, a recent version is required (>= 2019).

To get a recent dev build of Wireshark on Ubuntu/Debian/Mint;

sudo add-apt-repository ppa:wireshark-dev/stable
sudo apt-get update
sudo apt-get install wireshark

Wireshark Raw

Wireshark - Decoded data (DLT_USB_LINUX)

Wireshark has some more advanced protocol dissectors available if you are willing to lose some lower-level USB details;

./usbmonpcap/usbmonpcap -f /tmp/capture.bin -o capture.pcap

Wireshark Decoded

Example - Audio capture

As a demo, the following example shows how the USB2Sniffer can be used to capture USB audio traffic;

# Find the USB audio device number
$ lsusb
Bus 001 Device 025: ID 0d8c:013c C-Media Electronics, Inc. CM108 Audio Controller

# Start the capture
./sw/capture/capture -f capture_audio.bin

# [Play some audio through the USB device, stop the capture]

# Extract stream of bytes going to device 25 (audio controller) endpoint 1 (audio output)
./sw/dump_bin/dump_bin -f capture_audio.bin -o capture.pcm -d 25 -e 1

# Convert back to WAV file using FFMpeg
ffmpeg -ac 2 -f s16le -i capture.pcm output.wav

# Done..

IP Designs Used

Most of the IP cores used in this project are designed by myself and available as easy to follow open-source Verilog modules. The remainder (DDR3, CDC, PLL) are IP cores built with Xilinx Vivado.

Name Description Provider
usb_sniffer USB Sniffer Core -
ulpi_wrapper ULPI PHY Interface -
ft60x_axi FTDI USB3.0 to AXI bus master -
mig_axis.xci MIG DDR3 Controller Xilinx
axi_cdc_buffer.xci AXI4 Clock Domain Converter Xilinx

usb2sniffer's People

Contributors

ultraembedded avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.