Lauscher.cpp
From ThorstensHome
Mit diesem Beispiel kann ein 5V Bus belauscht werden:
/* * lauscher.c (c) 2013 by Thorsten Staerk, www.staerk.de/thorsten * * This program allows you to listen to a USB wire. Just connect it to DTS * of an ftdi chip * * Compile with * gcc -lftdi lauscher.c */ #include <stdio.h> #include <ftdi.h> int main() { int result=0; struct ftdi_context context1; if (ftdi_init(&context1) >= 0) { if (ftdi_usb_open(&context1, 0x0403, 0x6001) >= 0) // ft232r { while (1) { unsigned char buf; printf("%d\n",ftdi_read_pins (&context1, &buf)); printf("%d\n",buf); } if (ftdi_usb_close(&context1) < 0) result = EXIT_FAILURE; } else result = EXIT_FAILURE; } else result = EXIT_FAILURE; if (result) fprintf(stderr, "Fehler: %s\n", ftdi_get_error_string(&context1)); return result; }
See also
- Das Elektronik Buch
- ftdi
- http://electroments.blogspot.de/2013/06/lauschangriff-auf-das-usb-kabel.html