HCI PacketLog Converter for Sublime Text 3

BTstack can output application logs inlined with HCI traffic. We internally just call it HCI dump, and use this feature on a daily basis, whether we are just developing BTstack or need to analyze a reported issue.

BTstack’s HCI Dump functionality is quite flexible and can also be used on an embedded target with just a regular UART debug output or the faster SEGGER RTT.

The usual HCI dump form that we encounter with an issue report, a user email, or our own embedded development with SEGGER Ozone is text output. The text output can be stored and converted into a PacketLogger file (.pklg) for further analysis in Wireshark or Apple’s PacketLogger tool.

Until now, to convert the textual HCI dump output into a PacketLogger file (.pklg), we needed to perform the following steps: 1. select and copy the HCI dump output 2. create a new file in a text editor – in our case, we love Sublime Text 3 for its speed and versatility 3. paste the HCI dump 4. store the new file somewhere – where somewhere either clutters the Desktop or home directory, or we won’t find it again 5. switch to the console and run BTstack’s create_packet_log.py script that creates a .pklg in the same folder as the .txt file with the HCI dump 6. open the generated .pklg in Wireshark/PacketLogger

While there’s not much we can do before we get the HCI Dump into Sublime Text editor, there’s certainly room for improvement on the last three steps. In fact, we decided to add a command to Sublime Text 3 that converts the current text window into a .pklg format and opens Wireshark/PacketLogger.

Creating a Plug-In for Sublime

Asides from using Google to find and fix small details, it was straight forward. In Sublime Text 3, Tool -> Develop -> New Plugin.. provides a template Python file that inserts ‘Hello World’ in the current editor view. In this template, we then copied the existing create_packet_log.py code. The only changes to let it process the text in the editor were:

  1. get the complete text
  2. parse the log from a string instead of a variable
  3. store in temp file
  4. open temp file with Wireshark/PacketLogger based on OS type

Install Plug-In via Package Control

In Sublime Text 3, go to Tools -> Command Palette, and select “Package Controls: Install Package”. In the search view, start entering BTstack HCI ... and confirm the installation.

Convert HCI Dump

To convert an HCI dump in your editor window, use “Command Palette” -> “BTstack: Convert HCI Packet Log (pklg)”.

BLESA: GATT Client Vulnerabilities
MSP432P401R + CC2564C Port: UART without Hardware RTS/CTS Flow Control