Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions killerbee/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ def __init__(self, device: Optional[str]=None, hardware: Optional[str]=None, dat
gps_devstring = gps

if hardware is not None and device is not None:
if ":" in device:
result = search_usb(None)
if result is not None:
device = result
else:
raise KBInterfaceError("Did not find a USB device matching %s." % device)

if hardware == "apimote":
from .dev_apimote import APIMOTE
self.driver = APIMOTE(device)
Expand Down
9 changes: 5 additions & 4 deletions killerbee/dev_cc253x.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,12 @@ def pnext(self, timeout=100):
# in last two bytes of framedata. Note that we remove these before return of the frame.

# RSSI is signed value, offset by 73 (see CC2530 data sheet for offset)
rssi = framedata[-2] - 73
rssi = struct.unpack('b', framedata[-2:-1])[0] - 73
# Dirty hack to compensate for possible RSSI overflow
if rssi > 255:
rssi = 255 # assumed to be max, could also report error/0

if rssi > 127 or rssi < -127:
print(f"Rssi = {rssi}, out of range, setting to invalid valuei (-128)")
rssi = -128 # invalid value according to PPI spec

fcsx = framedata[-1]
# validcrc is the bit 7 in fcsx
validcrc = (fcsx & 0x80) == 0x80
Expand Down