aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Mogenson <mogenson@google.com>2024-01-31 10:26:51 -0500
committerMichael Mogenson <mogenson@google.com>2024-01-31 10:26:51 -0500
commit2a764fd6bbc80bd54e315ff238d5574c4293eaac (patch)
treee84ac1c35cc441fd729887734819f79dc4a95c76
parent071fc2723a768c4cf598bfd79fa656cbc3c4145b (diff)
downloadbumble-2a764fd6bbc80bd54e315ff238d5574c4293eaac.tar.gz
controller_loopback: LE support and max packet count
Bound the packet count CLI option. We're using the L2CAP header CID for a paket ID, so the max packet count value has to fit into this 16-bit field. Add support for controllers that are LE only by checking the le_acl_packet_queue.max_size. Tested with 65535 max packet count. Took 138 seconds at 481 kB/s with a USB BT dongle.
-rw-r--r--apps/controller_loopback.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/apps/controller_loopback.py b/apps/controller_loopback.py
index 9ec4ec3..2d16bb9 100644
--- a/apps/controller_loopback.py
+++ b/apps/controller_loopback.py
@@ -99,7 +99,12 @@ class Loopback:
# make sure data can fit in one l2cap pdu
l2cap_header_size = 4
- max_packet_size = host.acl_packet_queue.max_packet_size - l2cap_header_size
+
+ max_packet_size = (
+ host.acl_packet_queue
+ if host.acl_packet_queue
+ else host.le_acl_packet_queue
+ ).max_packet_size - l2cap_header_size
if self.packet_size > max_packet_size:
print(
color(
@@ -183,7 +188,7 @@ class Loopback:
'--packet-count',
'-c',
metavar='COUNT',
- type=int,
+ type=click.IntRange(1, 65535),
default=10,
help='Packet count',
)