Sniffer with ringbuf, works SOMETIMES

* Sniffer uses phone endpoints for communication and the ringbuffer
    routines the phone communication uses
* Most times the Usart1 interrupt is not triggered, and therefore
    no values are recorded
This commit is contained in:
Christina Quast
2015-04-12 09:31:36 +02:00
parent 5c6a299c71
commit 2b8a18bf3a
11 changed files with 80 additions and 72 deletions

View File

@@ -3,7 +3,9 @@
import usb.core
import usb.util
import sys
import array
from constants import PHONE_RD
def find_dev():
dev = usb.core.find(idVendor=0x03eb, idProduct=0x6004)
@@ -46,14 +48,18 @@ def find_eps(dev):
# main code
def sniff():
dev = find_dev()
ans = array.array('B', [])
while True:
#ep_out.write("Hello")
try:
ans = dev.read(0x82, 64, 1000)
print("".join("%02x " % b for b in ans))
ans += dev.read(PHONE_RD, 64, 1000)
except KeyboardInterrupt:
print("Bye")
sys.exit()
except:
print("Timeout")
except Exception as e:
print e
if len(ans) >= 15:
print("".join("%02x " % b for b in ans))
ans = array.array('B', [])