mirror of
https://github.com/google/bumble.git
synced 2026-05-08 03:58:01 +00:00
Merge pull request #603 from google/gbg/fix-pair-oob
fix oob support in pair.py
This commit is contained in:
21
apps/pair.py
21
apps/pair.py
@@ -373,7 +373,9 @@ async def pair(
|
|||||||
shared_data = (
|
shared_data = (
|
||||||
None
|
None
|
||||||
if oob == '-'
|
if oob == '-'
|
||||||
else OobData.from_ad(AdvertisingData.from_bytes(bytes.fromhex(oob)))
|
else OobData.from_ad(
|
||||||
|
AdvertisingData.from_bytes(bytes.fromhex(oob))
|
||||||
|
).shared_data
|
||||||
)
|
)
|
||||||
legacy_context = OobLegacyContext()
|
legacy_context = OobLegacyContext()
|
||||||
oob_contexts = PairingConfig.OobConfig(
|
oob_contexts = PairingConfig.OobConfig(
|
||||||
@@ -381,16 +383,19 @@ async def pair(
|
|||||||
peer_data=shared_data,
|
peer_data=shared_data,
|
||||||
legacy_context=legacy_context,
|
legacy_context=legacy_context,
|
||||||
)
|
)
|
||||||
oob_data = OobData(
|
|
||||||
address=device.random_address,
|
|
||||||
shared_data=shared_data,
|
|
||||||
legacy_context=legacy_context,
|
|
||||||
)
|
|
||||||
print(color('@@@-----------------------------------', 'yellow'))
|
print(color('@@@-----------------------------------', 'yellow'))
|
||||||
print(color('@@@ OOB Data:', 'yellow'))
|
print(color('@@@ OOB Data:', 'yellow'))
|
||||||
print(color(f'@@@ {our_oob_context.share()}', 'yellow'))
|
if shared_data is None:
|
||||||
|
oob_data = OobData(
|
||||||
|
address=device.random_address, shared_data=our_oob_context.share()
|
||||||
|
)
|
||||||
|
print(
|
||||||
|
color(
|
||||||
|
f'@@@ SHARE: {bytes(oob_data.to_ad()).hex()}',
|
||||||
|
'yellow',
|
||||||
|
)
|
||||||
|
)
|
||||||
print(color(f'@@@ TK={legacy_context.tk.hex()}', 'yellow'))
|
print(color(f'@@@ TK={legacy_context.tk.hex()}', 'yellow'))
|
||||||
print(color(f'@@@ HEX: ({bytes(oob_data.to_ad()).hex()})', 'yellow'))
|
|
||||||
print(color('@@@-----------------------------------', 'yellow'))
|
print(color('@@@-----------------------------------', 'yellow'))
|
||||||
else:
|
else:
|
||||||
oob_contexts = None
|
oob_contexts = None
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ if TYPE_CHECKING:
|
|||||||
# pylint: disable=line-too-long
|
# pylint: disable=line-too-long
|
||||||
|
|
||||||
ATT_CID = 0x04
|
ATT_CID = 0x04
|
||||||
|
ATT_PSM = 0x001F
|
||||||
|
|
||||||
ATT_ERROR_RESPONSE = 0x01
|
ATT_ERROR_RESPONSE = 0x01
|
||||||
ATT_EXCHANGE_MTU_REQUEST = 0x02
|
ATT_EXCHANGE_MTU_REQUEST = 0x02
|
||||||
|
|||||||
Reference in New Issue
Block a user