btsnoop.txt 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. BTSnoop/Monitor protocol formats
  2. ********************************
  3. Opcode definitions
  4. ==================
  5. New Index
  6. ---------
  7. Code: 0x0000
  8. Parameters: Type (1 Octet
  9. Bus (1 Octet)
  10. BD_Addr (6 Octets)
  11. Name (8 Octets)
  12. This opcode indicates that a new controller instance with a
  13. given index was added. With some protocols, like the TTY-based
  14. one there is only a single supported controller, meaning the
  15. index is implicitly 0.
  16. Deleted Index
  17. -------------
  18. Code: 0x0001
  19. This opcode indicates that the controller with a specific index
  20. was removed.
  21. Command Packet
  22. --------------
  23. Code: 0x0002
  24. HCI command packet.
  25. Event Packet
  26. ------------
  27. Code: 0x0003
  28. HCI event packet.
  29. ACL TX Packet
  30. -------------
  31. Code: 0x0004
  32. Outgoing ACL packet.
  33. ACL RX Packet
  34. -------------
  35. Code: 0x0005
  36. Incoming ACL packet.
  37. SCO TX Packet
  38. --------------
  39. Code: 0x0006
  40. Outgoing SCO packet.
  41. SCO RX Packet
  42. -------------
  43. Code: 0x0007
  44. Incomnig SCO packet.
  45. Open Index
  46. ----------
  47. Code: 0x0008
  48. The HCI transport for the specified controller has been opened.
  49. Close Index
  50. -----------
  51. Code: 0x0009
  52. The HCI transport for the specified controller has been closed.
  53. Index Information
  54. -----------------
  55. Code: 0x000a
  56. Parameters: BD_Addr (6 Octets)
  57. Manufacturer (2 Octets)
  58. Information about a specific controller.
  59. Vendor Diagnostics
  60. ------------------
  61. Code: 0x000b
  62. Vendor diagnostic information.
  63. System Note
  64. -----------
  65. Code: 0x000c
  66. System note.
  67. User Logging
  68. ------------
  69. Code: 0x000d
  70. Parameters: Priority (1 Octet)
  71. Ident_Length (1 Octet)
  72. Ident (Ident_Length Octets)
  73. User logging information.
  74. TTY-based protocol
  75. ==================
  76. This section covers the protocol that can be parsed by btmon when
  77. passing it the --tty parameter. The protocol is little endian, packet
  78. based, and has the following header for each packet:
  79. struct tty_hdr {
  80. uint16_t data_len;
  81. uint16_t opcode;
  82. uint8_t flags;
  83. uint8_t hdr_len;
  84. uint8_t ext_hdr[0];
  85. } __attribute__ ((packed));
  86. The actual payload starts at ext_hdr + hdr_len and has the length of
  87. data_len - 4 - hdr_len. Each field of the header is defined as follows:
  88. data_len:
  89. This is the total length of the entire packet, excuding the
  90. data_len field itself.
  91. opcode:
  92. The BTSnoop opcode
  93. flags:
  94. Special flags for the packet. Currently no flags are defined.
  95. hdr_len:
  96. Length of the extended header.
  97. ext_hdr:
  98. This is a sequence of header extension fields formatted as:
  99. struct {
  100. uint8_t type;
  101. uint8_t value[length];
  102. }
  103. The length of the value is dependent on the type. Currently the
  104. following types are defined:
  105. Type Length Meaning
  106. ----------------------------------------------------------------
  107. 1 Command drops 1 byte Dropped HCI command packets
  108. 2 Event drops 1 byte Dropped HCI event packets
  109. 3 ACL TX drops 1 byte Dropped ACL TX packets
  110. 4 ACL RX drops 1 byte Dropped ACL RX packets
  111. 5 SCO TX drops 1 byte Dropped SCO TX packets
  112. 6 SCO RX drops 1 byte Dropped SCO RX packets
  113. 7 Other drops 1 byte Dropped other packets
  114. 8 32-bit timestamp 4 bytes Timestamp in 1/10th ms
  115. The drops fields indicate the number of packets that the
  116. implementation had to drop (e.g. due to lack of buffers) since
  117. the last reported drop count.
  118. The fields of the extended header must be sorted by increasing
  119. type. This is essential so that unknown types can be ignored and
  120. the parser can jump to processing the payload.