From 2edd8faac3206b121feeb6a0bdf6a34835e0086d Mon Sep 17 00:00:00 2001 From: xyb Date: Sat, 6 Sep 2014 22:54:54 +0800 Subject: [PATCH] try to find Jawbreaker and HackRF One --- host/python/max2837_dump.py | 10 ++++++++++ host/python/set_transceiver_mode.py | 11 +++++++++++ 2 files changed, 21 insertions(+) diff --git a/host/python/max2837_dump.py b/host/python/max2837_dump.py index 3e85d6a7..c1732b2e 100755 --- a/host/python/max2837_dump.py +++ b/host/python/max2837_dump.py @@ -22,8 +22,18 @@ import usb import struct +import sys device = usb.core.find(idVendor=0x1d50, idProduct=0x604b) +if device: + print 'Find: HackRF Jawbreaker' +else: + device = usb.core.find(idVendor=0x1d50, idProduct=0x6089) + if device: + print 'Find: HackRF One' + else: + print 'Not find any HackRF device.' + sys.exit() device.set_configuration() def read_max2837_register(register_number): diff --git a/host/python/set_transceiver_mode.py b/host/python/set_transceiver_mode.py index 479b86b2..c1307532 100755 --- a/host/python/set_transceiver_mode.py +++ b/host/python/set_transceiver_mode.py @@ -24,6 +24,15 @@ import sys import usb device = usb.core.find(idVendor=0x1d50, idProduct=0x604b) +if device: + print 'Find: HackRF Jawbreaker' +else: + device = usb.core.find(idVendor=0x1d50, idProduct=0x6089) + if device: + print 'Find: HackRF One' + else: + print 'Not find any HackRF device.' + sys.exit() device.set_configuration() def set_rx(): @@ -37,3 +46,5 @@ if len(sys.argv) == 2: set_tx() elif sys.argv[1] == 'rx': set_rx() +else: + print 'Usage: %s [rx|tx]' % sys.argv[0]