drinki
Posts: 3
Joined: Thu Feb 07, 2019 5:50 pm

Bluetooth LE: HCI ACL Data packets

Thu Feb 07, 2019 5:58 pm

Hi,

I'm facing the following problem with my RPi 3B: I'd like to send some HCI ACL Data Packets to a connected BLE device. I did the connection to the BLE device via

Code: Select all

sudo hcitool cmd 0x08 0x000D 60 00 60 00 00 01 FF FF FF FF FF FF 00 18 00 28 00 00 00 2A 00 00 00 00 00


where FF FF FF FF FF FF stands for my MAC address. The connection is successfully opened.


Then I'd like to send a HCI_ACLDATA_PKT to this connected device. I can't do this with hcitool cmd as this supports only HCI_COMMAND_PKT.

My idea is that there might be a serial interface where I can send the corresponding HCI-Bytes to.
Does anybody can help me, how I can submit HCI ACL Data Packets to a connected device? Is there a different tool than hcitool?



Thank you very much for your help!
drink

drinki
Posts: 3
Joined: Thu Feb 07, 2019 5:50 pm

Re: Bluetooth LE: HCI ACL Data packets

Mon Feb 11, 2019 9:52 am

Might this https://github.com/spotify/linux/blob/m ... hci_core.c lead to the solution? I found some functions about sending ACL data in there, but I actually don't know how to use this library. I don't know what the sk_buff * is and which functions I need to call.

petzval
Posts: 60
Joined: Sat Aug 10, 2013 12:15 pm

Re: Bluetooth LE: HCI ACL Data packets

Mon Feb 11, 2019 12:51 pm

Use gatttool to send ACL data packets that read and write private characteristics to an LE device.
Start gatttool in interactive mode by:

gatttool -i hci0 -b 01:23:45:67:89:AB -I

Where 01:.. is the address followed by minus upper case i for interactive mode.
gatttool commands in interactive mode:

connect
char-desc - lists services/characteristics
characteristics - lists characteristics

char-write-req 000B 1234 - writes 2 bytes (0x1234) to acknowledge characteristic handle 000B
char-write-req 000E 56 - writes 0x56 to 1 byte acknowledge characteristic handle 000E
char-write-cmd 000C 12 - writes to 1 byte non-acknowledge characteristic handle 000C
char-read-hnd 000B - reads characteristic with handle 000B

drinki
Posts: 3
Joined: Thu Feb 07, 2019 5:50 pm

Re: Bluetooth LE: HCI ACL Data packets

Mon Feb 18, 2019 10:11 am

Thank you, petzval!
The problem is solved with gatttool. According to the device you want to connect to, it might be useful to change the device type to random: -t random.

Return to “Advanced users”