Blame doc/btsnoop.txt

Packit 34410b
BTSnoop/Monitor protocol formats
Packit 34410b
********************************
Packit 34410b
Packit 34410b
Opcode definitions
Packit 34410b
==================
Packit 34410b
Packit 34410b
New Index
Packit 34410b
---------
Packit 34410b
Packit 34410b
	Code:        0x0000
Packit 34410b
	Parameters:  Type (1 Octet
Packit 34410b
		     Bus (1 Octet)
Packit 34410b
		     BD_Addr (6 Octets)
Packit 34410b
		     Name (8 Octets)
Packit 34410b
Packit 34410b
	This opcode indicates that a new controller instance with a
Packit 34410b
	given index was added. With some protocols, like the TTY-based
Packit 34410b
	one there is only a single supported controller, meaning the
Packit 34410b
	index is implicitly 0.
Packit 34410b
Packit 34410b
Deleted Index
Packit 34410b
-------------
Packit 34410b
Packit 34410b
	Code:        0x0001
Packit 34410b
Packit 34410b
	This opcode indicates that the controller with a specific index
Packit 34410b
	was removed.
Packit 34410b
Packit 34410b
Command Packet
Packit 34410b
--------------
Packit 34410b
Packit 34410b
	Code:        0x0002
Packit 34410b
Packit 34410b
	HCI command packet.
Packit 34410b
Packit 34410b
Event Packet
Packit 34410b
------------
Packit 34410b
Packit 34410b
	Code:        0x0003
Packit 34410b
Packit 34410b
	HCI event packet.
Packit 34410b
Packit 34410b
ACL TX Packet
Packit 34410b
-------------
Packit 34410b
Packit 34410b
	Code:        0x0004
Packit 34410b
Packit 34410b
	Outgoing ACL packet.
Packit 34410b
Packit 34410b
ACL RX Packet
Packit 34410b
-------------
Packit 34410b
Packit 34410b
	Code:        0x0005
Packit 34410b
Packit 34410b
	Incoming ACL packet.
Packit 34410b
Packit 34410b
SCO TX Packet
Packit 34410b
--------------
Packit 34410b
Packit 34410b
	Code:        0x0006
Packit 34410b
Packit 34410b
	Outgoing SCO packet.
Packit 34410b
Packit 34410b
SCO RX Packet
Packit 34410b
-------------
Packit 34410b
Packit 34410b
	Code:        0x0007
Packit 34410b
Packit 34410b
	Incomnig SCO packet.
Packit 34410b
Packit 34410b
Open Index
Packit 34410b
----------
Packit 34410b
Packit 34410b
	Code:        0x0008
Packit 34410b
Packit 34410b
	The HCI transport for the specified controller has been opened.
Packit 34410b
Packit 34410b
Close Index
Packit 34410b
-----------
Packit 34410b
Packit 34410b
	Code:        0x0009
Packit 34410b
Packit 34410b
	The HCI transport for the specified controller has been closed.
Packit 34410b
Packit 34410b
Index Information
Packit 34410b
-----------------
Packit 34410b
Packit 34410b
	Code:        0x000a
Packit 34410b
	Parameters:  BD_Addr (6 Octets)
Packit 34410b
		     Manufacturer (2 Octets)
Packit 34410b
Packit 34410b
	Information about a specific controller.
Packit 34410b
Packit 34410b
Vendor Diagnostics
Packit 34410b
------------------
Packit 34410b
Packit 34410b
	Code:        0x000b
Packit 34410b
Packit 34410b
	Vendor diagnostic information.
Packit 34410b
Packit 34410b
System Note
Packit 34410b
-----------
Packit 34410b
Packit 34410b
	Code:        0x000c
Packit 34410b
Packit 34410b
	System note.
Packit 34410b
Packit 34410b
User Logging
Packit 34410b
------------
Packit 34410b
Packit 34410b
	Code:        0x000d
Packit 34410b
	Parameters:  Priority (1 Octet)
Packit 34410b
		     Ident_Length (1 Octet)
Packit 34410b
		     Ident (Ident_Length Octets)
Packit 34410b
Packit 34410b
	User logging information.
Packit 34410b
Packit 34410b
Packit 34410b
TTY-based protocol
Packit 34410b
==================
Packit 34410b
Packit 34410b
This section covers the protocol that can be parsed by btmon when
Packit 34410b
passing it the --tty parameter. The protocol is little endian, packet
Packit 34410b
based, and has the following header for each packet:
Packit 34410b
Packit 34410b
struct tty_hdr {
Packit 34410b
	uint16_t data_len;
Packit 34410b
	uint16_t opcode;
Packit 34410b
	uint8_t  flags;
Packit 34410b
	uint8_t  hdr_len;
Packit 34410b
	uint8_t  ext_hdr[0];
Packit 34410b
} __attribute__ ((packed));
Packit 34410b
Packit 34410b
The actual payload starts at ext_hdr + hdr_len and has the length of
Packit 34410b
data_len - 4 - hdr_len. Each field of the header is defined as follows:
Packit 34410b
Packit 34410b
data_len:
Packit 34410b
	This is the total length of the entire packet, excuding the
Packit 34410b
	data_len field itself.
Packit 34410b
Packit 34410b
opcode:
Packit 34410b
	The BTSnoop opcode
Packit 34410b
Packit 34410b
flags:
Packit 34410b
	Special flags for the packet. Currently no flags are defined.
Packit 34410b
Packit 34410b
hdr_len:
Packit 34410b
	Length of the extended header.
Packit 34410b
Packit 34410b
ext_hdr:
Packit 34410b
	This is a sequence of header extension fields formatted as:
Packit 34410b
Packit 34410b
	struct {
Packit 34410b
		uint8_t type;
Packit 34410b
		uint8_t value[length];
Packit 34410b
	}
Packit 34410b
Packit 34410b
	The length of the value is dependent on the type. Currently the
Packit 34410b
	following types are defined:
Packit 34410b
Packit 34410b
	Type                 Length    Meaning
Packit 34410b
	----------------------------------------------------------------
Packit 34410b
	1  Command drops     1 byte    Dropped HCI command packets
Packit 34410b
	2  Event drops       1 byte    Dropped HCI event packets
Packit 34410b
	3  ACL TX drops      1 byte    Dropped ACL TX packets
Packit 34410b
	4  ACL RX drops      1 byte    Dropped ACL RX packets
Packit 34410b
	5  SCO TX drops      1 byte    Dropped SCO TX packets
Packit 34410b
	6  SCO RX drops      1 byte    Dropped SCO RX packets
Packit 34410b
	7  Other drops       1 byte    Dropped other packets
Packit 34410b
	8  32-bit timestamp  4 bytes   Timestamp in 1/10th ms
Packit 34410b
Packit 34410b
	The drops fields indicate the number of packets that the
Packit 34410b
	implementation had to drop (e.g. due to lack of buffers) since
Packit 34410b
	the last reported drop count.
Packit 34410b
Packit 34410b
	The fields of the extended header must be sorted by increasing
Packit 34410b
	type. This is essential so that unknown types can be ignored and
Packit 34410b
	the parser can jump to processing the payload.