btashton opened a new pull request #1655:
URL: https://github.com/apache/incubator-nuttx/pull/1655
## Summary
There is also support on a Linux Host for attaching the Bluetooth hardware
from the host to the NuttX Bluetoooth stack via the HCI Socket interface over
the User Channel. This is enabled in the bthcisock configuration. In order to
use this you must give the nuttx elf additional capabilities:
`sudo setcap 'cap_net_raw,cap_net_admin=eip' ./nuttx`
You can then monitor the HCI traffic on the host with wireshark or btmon:
`sudo btmon`
## Impact
This enables much more powerful testing on the simulation target than we
have with the null driver.
## Testing
In the simulation:
```
❯ sudo setcap 'cap_net_raw,cap_net_admin=eip' ./nuttx
❯ ./nuttx
NuttShell (NSH) NuttX-9.1.0
nsh> bt bnep0 scan start -d
nsh> bt bnep0 scan stop
nsh> bt bnep0 scan get
Scan result:
1. addr: 4f:0f:8f:dd:3b:a3 type: 1
rssi: -74
response type: 2
advertiser data: 03 03 9f fe 17 16 9f fe 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00
2. addr: 4f:0f:8f:dd:3b:a3 type: 1
rssi: -74
response type: 4
advertiser data: 09 ff e0 00 56 f6 ca 68 26 96
3. addr: 71:ad:8c:45:b1:f7 type: 1
rssi: -62
response type: 0
advertiser data: 02 01 1a 0a ff 4c 00 10 05 03 1c 78 c4 7b
4. addr: 71:ad:8c:45:b1:f7 type: 1
rssi: -62
response type: 4
advertiser data: 5. addr: c8:ff:77:be:b8:a0 type: 0
rssi: -83
response type: 0
advertiser data: 02 01 06 11 06 a4 d0 87 a7 b4 d1 79 89 2d 45 37
1c 10 00 d1 2d
nsh>
```
```
❯ sudo btmon
= Close Index: 60:57:18:EE:03:FD
[hci0] 4.204320
@ MGMT Event: Index Removed (0x0005) plen 0
{0x0002} [hci0] 4.204520
@ MGMT Event: Index Removed (0x0005) plen 0
{0x0001} [hci0] 4.204520
= Open Index: 60:57:18:EE:03:FD
[hci0] 4.204551
= Index Info: 60:57:18:EE:03:FD (Intel Corp.)
[hci0] 4.204553
@ RAW Close: nuttx
{0x0003} 4.204557
@ USER Open: nuttx (privileged) version 2.22
{0x0003} [hci0] 4.204560
< HCI Command: Reset (0x03|0x0003) plen 0
#5 [hci0] 4.204602
= bluetoothd: Endpoint unregistered: sender=:1.74
path=/MediaEndpoint/A2DPSink/sbc 4.207973
= bluetoothd: Endpoint unregistered: sender=:1.74
path=/MediaEndpoint/A2DPSource/sbc 4.208031
> HCI Event: Command Complete (0x0e) plen 4
#6 [hci0] 4.218155
Reset (0x03|0x0003) ncmd 2
Status: Success (0x00)
< HCI Command: Read Local Supported Features (0x04|0x0003) plen 0
#7 [hci0] 4.224783
> HCI Event: Command Complete (0x0e) plen 12
#8 [hci0] 4.225184
```
...
```
> HCI Event: LE Meta Event (0x3e) plen 12
#58 [hci0] 49.428408
LE Advertising Report (0x02)
Num reports: 1
Event type: Scan response - SCAN_RSP (0x04)
Address type: Random (0x01)
Address: 71:AD:8C:45:B1:F7 (Resolvable)
Data length: 0
RSSI: -62 dBm (0xc2)
> HCI Event: LE Meta Event (0x3e) plen 33
#59 [hci0] 51.635490
LE Advertising Report (0x02)
Num reports: 1
Event type: Connectable undirected - ADV_IND (0x00)
Address type: Public (0x00)
Address: C8:FF:77:BE:B8:A0 (Dyson Limited)
Data length: 21
Flags: 0x06
LE General Discoverable Mode
BR/EDR Not Supported
128-bit Service UUIDs (partial): 1 entry
Vendor specific (2dd10010-1c37-452d-8979-d1b4a787d0a4)
RSSI: -83 dBm (0xad)
> HCI Event: LE Meta Event (0x3e) plen 38
#60 [hci0] 53.513519
LE Advertising Report (0x02)
Num reports: 1
Event type: Scan response - SCAN_RSP (0x04)
Address type: Public (0x00)
Address: C8:FF:77:BE:B8:A0 (Dyson Limited)
Data length: 26
Name (complete): VV6-US-KFA1546A
TX power: 0 dBm
Slave Conn. Interval: 0x000c - 0x0018
RSSI: -80 dBm (0xb0)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2
#61 [hci0] 59.354996
Scanning: Disabled (0x00)
Filter duplicates: Disabled (0x00)
> HCI Event: Command Complete (0x0e) plen 4
#62 [hci0] 59.458558
LE Set Scan Enable (0x08|0x000c) ncmd 2
Status: Success (0x00)
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]