diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index b9c1dd9..fb7e04c 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -9,3 +9,4 @@ Many thanks to everyone who contributed to this project: - clydebarrow (https://github.com/clydebarrow) - myfreeweb (https://github.com/myfreeweb) - cleitonbueno (https://github.com/cleitonbueno) +- idaniel86 (https://github.com/idaniel86) diff --git a/README.rst b/README.rst index 2941647..54b0976 100644 --- a/README.rst +++ b/README.rst @@ -126,6 +126,8 @@ Changelog --------- Beacontools follows the `semantic versioning `__ scheme. +* 2.1.0 + * Added support for extended BLE commands for devices using HCI >= 5.0 (Linux only, thanks to `idaniel86 `__) * 2.0.2 * Improved prefiltering of packets, fixes #48 * 2.0.1 diff --git a/beacontools/backend/freebsd.py b/beacontools/backend/freebsd.py index 497ff8b..e8df94c 100644 --- a/beacontools/backend/freebsd.py +++ b/beacontools/backend/freebsd.py @@ -55,3 +55,7 @@ def send_cmd(sock, group_field, command_field, data): """Send hci command to device.""" opcode = (((group_field & 0x3f) << 10) | (command_field & 0x3ff)) sock.send(struct.pack(' 0x4000: + if interval_fractions < 0x0004 or interval_fractions > max_interval: raise ValueError( - "Invalid interval given {}, must be in range of 2.5ms to 10240ms!".format( - interval_fractions)) + "Invalid interval given {}, must be in range of 2.5ms to {}ms!".format( + interval_fractions, max_interval * MS_FRACTION_DIVIDER)) window_fractions = window_ms / MS_FRACTION_DIVIDER - if window_fractions < 0x0004 or window_fractions > 0x4000: + if window_fractions < 0x0004 or window_fractions > max_interval: raise ValueError( - "Invalid window given {}, must be in range of 2.5ms to 10240ms!".format( - window_fractions)) + "Invalid window given {}, must be in range of 2.5ms to {}ms!".format( + window_fractions, max_interval * MS_FRACTION_DIVIDER)) interval_fractions, window_fractions = int(interval_fractions), int(window_fractions) - scan_parameter_pkg = struct.pack( - "