DS4-BT: Difference between revisions
m (→Response) |
m (→Response) |
||
Line 308: | Line 308: | ||
Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F | Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F | ||
00000000 07 00 01 02 BF 02 BC 36 02 B9 36 02 61 09 00 00 ....¿.¼6.¹6.a... | 00000000 07 00 01 02 BF 02 BC 36 02 B9 36 <span style="background:#66ff66;">02 61</span> 09 00 00 ....¿.¼6.¹6.a... | ||
00000010 0A 00 01 00 01 09 00 01 35 03 19 11 24 09 00 04 ........5...$... | 00000010 0A 00 01 00 01 09 00 01 35 03 19 11 24 09 00 04 ........5...$... | ||
00000020 35 0D 35 06 19 01 00 09 00 11 35 03 19 00 11 09 5.5.......5..... | 00000020 35 0D 35 06 19 01 00 09 00 11 35 03 19 00 11 09 5.5.......5..... | ||
Line 346: | Line 346: | ||
00000240 08 35 06 09 04 09 09 01 00 09 02 08 28 00 09 02 .5..........(... | 00000240 08 35 06 09 04 09 09 01 00 09 02 08 28 00 09 02 .5..........(... | ||
00000250 09 28 01 09 02 0A 28 01 09 02 0B 09 01 00 09 02 .(....(......... | 00000250 09 28 01 09 02 0A 28 01 09 02 0B 09 01 00 09 02 .(....(......... | ||
00000260 0C 09 1F 40 09 02 0D 28 00 09 02 0E 28 00 36 00 ...@...(....(.6. | 00000260 0C 09 1F 40 09 02 0D 28 00 09 02 0E 28 00 36 <span style="background:#66ff66;">00</span> ...@...(....(.6. | ||
00000270 52 09 00 00 0A 00 01 00 02 09 00 01 35 03 19 12 R...........5... | 00000270 <span style="background:#66ff66;">52</span> 09 00 00 0A 00 01 00 02 09 00 01 35 03 19 12 R...........5... | ||
00000280 00 09 00 04 35 0D 35 06 19 01 00 09 00 01 35 03 ....5.5.......5. | 00000280 00 09 00 04 35 0D 35 06 19 01 00 09 00 01 35 03 ....5.5.......5. | ||
00000290 19 00 01 09 00 09 35 08 35 06 19 12 00 09 01 03 ......5.5....... | 00000290 19 00 01 09 00 09 35 08 35 06 19 12 00 09 01 03 ......5.5....... | ||
Line 354: | Line 354: | ||
000002C0 09 '''00 02''' 00 .... | 000002C0 09 '''00 02''' 00 .... | ||
0x07 PDU | |||
0x0001 Transaction ID | |||
0x02BF Length | |||
0x02BC Length | |||
0x36|02B9 type:6, size index:6 + Length | |||
<span style="background:#66ff66;">0x36|0261</span> type:6, size index:6 + Length first chunk | |||
0x0000 Service Record Handle-->value {0x010001} | 0x0000 Service Record Handle-->value {0x010001} | ||
Line 369: | Line 379: | ||
... | ... | ||
<span style="background:#66ff66;">0x36|0052</span> type:6, size index:6 + Length second chunk | |||
0x0000 Service Record Handle-->value {0x010002} | |||
*0x0001 Service Class ID List-->value {0x1200 Device Identification (DID)} | |||
*0x0004 Protocol Descriptor List--> | |||
*0x0200 Specification ID-->value: 0x0103 | *0x0200 Specification ID-->value: 0x0103 |
Revision as of 02:11, 11 May 2014
Source: http://eleccelerator.com/wiki/index.php?title=DualShock_4 (full paste 17:50 UTC, 18 January 2014 )
Bluetooth
Bluetooth is a wireless technology for creating personal networks operating in the 2.4 GHz unlicensed band, with a range of 10 meters.
Capable of streaming 32Khz sound to the controllers speakers for up to 2 players, but that reduces to 16Khz when 3 or more players are hooked up.
If you spoof a previously paired DS4's BDADDR (is the unique address of a Bluetooth device, similar to the MAC address of a network card) and class, then using "sudo hcitool cc <ps4's bdaddr>" will wake up the PS4. If the same cc request comes from an unknown BDADDR, nothing happens.
The DualShock 4 has two modes, one where you can pair it with a computer (hold PS and share at the same time until the light blinks twice in quick succession rapidly), and another mode when it is used with a PS4.
Class of Device/Service (CoD)
In the PS4 mode, it appears to advertise as two devices (neither has a name), one is a game controller and the other is an audio device:
The game controller has a class of Device/Service (CoD) 0x002508:
- Major Service Class: Limited Discoverable Mode (0x2000)
- Major Device Class : Peripheral (mouse, joystick, keyboards etc) (0x500)
- Minor Device Class : Gamepad (0x08)
The audio device is class 0x200404:
- Major Service Class: Audio (Speaker, Microphone, Headset service, ...)
- Major Device Class : Audio/Video (headset, speaker, stereo, video display, VCR, ...)
- Minor Device Class : Wearable Headset Device
(Online Generator http://bluetooth-pentest.narod.ru/software/bluetooth_class_of_device-service_generator.html)
UART HCI
On the DS4 circuit itself is a Qualcomm Atheros AR3002 module and the UART pins have test points.
You can clearly see the UART HCI receiving/transmitting data when you analyze the traffic on the RX and TX pins (See testpoints).
The data seems to be at a baud rate of exactly 3Mbit/s , sticking with HCI standards, meaning it's 8N1 (8 data bits, No parity, 1 stop bit). The report rate seems to be once every 1.3 millisecond, but there are some occasional gaps in between that can reach 15 milliseconds.
This file is a capture of the traffic over the UART HCI, Wireshark is required to view this PCAP file.
Similar to the file before but uses data while running "the Playroom" app on the PS4, so that it shows motors, speaker, and LED activity. This file needs to be decompressed using gzip first, then opened with Wireshark. Once opened, it needs to be sorted by timestamp.
Service Discovery Protocol (SDP)
SDP used by the PS4 the first time a device tries to connect, whereas the DS4 does it each time it connects to the PS4. (you can use Wireshark for SDP, but double check manually due to wrong interpretation or not standard )
PDU
- SDP uses a request/response model where each transaction consists of one request PDU (protocol
data unit) and one response PDU.
PDU value | Description |
---|---|
0x00 | Reserved |
0x01 | Error Response |
0x02 | Search Request |
0x03 | Search Response |
0x04 | Attribute Request |
0x05 | Attribute Response |
0x06 | Search Attribute Request |
0x07 | Search Attribute Response |
0x08-0xFF | Reserved |
Data Element
- an attribute id or an attribute value is often represented as a data element.
- The format of a data element follows the TLV (type-length-value) convention.
byte index | bit 7 | bit 6 | bit 5 | bit 4 | bit 3 | bit 2 | bit 1 | bit 0 |
---|---|---|---|---|---|---|---|---|
[0] | Type | Length | ||||||
[1-4] | additional field | |||||||
[x] | Value |
Type descriptor
Type Descriptor value | Valid Size descriptor values | type description |
---|---|---|
0 | 0 | Nil |
1 | 0, 1, 2, 3, 4 | Unsigned Integer |
2 | 0, 1, 2, 3, 4 | Signed twos-complements integer |
3 | 1, 2, 4 | Universally Unique Identifier (UUID) |
4 | 5, 6, 7 | text string |
5 | 0 | booleans |
6 | 5, 6, 7 | Data element sequence, a data element whose data field is a sequence of data elements |
7 | 5, 6, 7 | Data element alternative, data element whose data filed is a sequence of data elements from which one data elements is to be selected |
8 | 5, 6, 7 | Uniform Resource Locator (URL) |
9-31 | Reserved |
Length descriptor
Size Index | Additional bits | Data size |
---|---|---|
0 | 0 | 1 byte |
1 | 0 | 2 bytes |
2 | 0 | 4 bytes |
3 | 0 | 8 bytes |
4 | 0 | 16 bytes |
5 | 8 | The data size is contained in the additional 8 bits, which are interpreted as an unsigned integer |
6 | 16 | The data size is contained in the additional 16 bits, which are interpreted as an unsigned integer |
7 | 32 | The data size is contained in the additional 32 bits, which are interpreted as an unsigned integer |
e.g.: 0x35 = 00110101 (binary) = 00110 | 101 = type 6 | size index 5
PS4
Request
(without 0x02 0x1520 0x1800 0x1400 0x4000 see header section)
06 00 01 00 0f 35 03 19 01 00 08 00 35 05 0a 00 00 ff ff 00
- 0x06 PDU Service Search Attribute Request
- 0x0001 Transaction ID
- 0x000F Length
- 0x3503: Data element (Type descriptor: 6, Size index: 5) 3 bytes
- 0x19: Data element (type: 3 (UUID), size index: 1 (2 bytes))
- 0x0100: L2CAP
- 0x0800: Maximum Attribute Byte count (2048)?
- 0x0A: Data element (type:1, Size index: 2 (4 bytes)
- 0x0000FFFF: Attribute ID list
- 0x00: Continuation State
Response
(without 0x02 0x1520 0x5C01 0x5801 0x4000), see header section)
Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00000000 07 00 01 01 53 01 50 36 01 4D 36 00 32 09 00 00 ....S.P6.M6.2... 00000010 0A 00 01 00 05 09 00 01 35 03 19 11 0A 09 00 04 ........5....... 00000020 35 10 35 06 19 01 00 09 00 19 35 06 19 00 19 09 5.5.......5..... 00000030 01 02 09 00 09 35 08 35 06 19 11 0D 09 01 02 36 .....5.5.......6 00000040 00 32 09 00 00 0A 00 01 00 06 09 00 01 35 03 19 .2...........5.. 00000050 11 0B 09 00 04 35 10 35 06 19 01 00 09 00 19 35 .....5.5.......5 00000060 06 19 00 19 09 01 02 09 00 09 35 08 35 06 19 11 ..........5.5... 00000070 0D 09 01 02 36 00 3B 09 00 00 0A 00 01 00 07 09 ....6.;......... 00000080 00 01 35 06 19 11 0E 19 11 0F 09 00 04 35 10 35 ..5..........5.5 00000090 06 19 01 00 09 00 17 35 06 19 00 17 09 01 03 09 .......5........ 000000A0 00 09 35 08 35 06 19 11 0E 09 01 04 09 03 11 09 ..5.5........... 000000B0 00 02 36 00 4D 09 00 00 0A 00 01 00 08 09 00 01 ..6.M........... 000000C0 35 03 19 11 0C 09 00 04 35 10 35 06 19 01 00 09 5.......5.5..... 000000D0 00 17 35 06 19 00 17 09 01 03 09 00 09 35 08 35 ..5..........5.5 000000E0 06 19 11 0E 09 01 04 09 00 0D 35 10 35 06 19 01 ..........5.5... 000000F0 00 09 00 1B 35 06 19 00 17 09 01 03 09 03 11 09 ....5........... 00000100 00 01 36 00 52 09 00 00 0A 00 01 00 0A 09 00 01 ..6.R........... 00000110 35 03 19 12 00 09 00 04 35 0D 35 06 19 01 00 09 5.......5.5..... 00000120 00 01 35 03 19 00 01 09 00 09 35 08 35 06 19 12 ..5.......5.5... 00000130 00 09 01 03 09 02 00 09 01 03 09 02 01 09 05 4C ...............L 00000140 09 02 02 09 08 1F 09 02 03 09 01 00 09 02 04 28 ...............( 00000150 01 09 02 05 09 00 02 00 ........
Universal Attributes
Universally Unique Identifier (UUID)
UUID Protocol Identifiers(shall be used only in the Profile Descriptor List attribute).
- 07 PDU Service Search Attribute Response
- 00 01 Transaction ID
- 01 53 Length
- 01 50 Length
- 36| 01 4D type:6, size index:6 + Length
See assigned IDs:
36 00 32 Length
- 0x0000 Service Record Handle-->value:
{0x010005 (65541)}
- 0x0001 Service Class ID List-->value:
{0x110A Audio Source} //Advanced Audio Distribution Profile (A2DP)
- 0x0004 Protocol Descriptor List-->value:
{0x0100 L2CAP , 0x0019 } ,{ 0x0019 Audio/Video Distribution Transport Protocol (AVDTP) , 0x0102 (258)}
- 0x0009 Bluetooth Profile Descriptor List-->value:
{0x110D Advanced Audio Distribution , 0x0102 (258)}
36 00 32 Length
- 0x0000 Service Record Handle-->value:
{ 0x010006 (65542) }
- 0x0001 Service Class ID List-->value:
{ 0x110B Audio Sink } //A2DP
- 0x0004 Protocol Descriptor List-->value:
{ 0x0100 L2CAP , 0x0019 (25) } , { 0x0019 Audio/Video Distribution Transport Protocol (AVDTP) , 0x0102 (258) }
- 0x0009 Bluetooth Profile Descriptor List-->value:
{0x110D Advanced Audio Distribution , 0x0102 (258)}
36 00 3B Length
- 0x0000 Service Record Handle-->value:
{ 0x010007 (65543) }
- 0x0001 Service ClassID List-->value:
{ 0x110E Audio/Video Remote Control , 0x110F Video Conferencing / A/V Remote Control Controller } [1]
- 0x0004 Protocol Descriptor List-->value:
{ 0x0100 L2CAP , 0x0017 (23) } , { 0x0017 Audio/Video Control Transport Protocol (AVCTP) , 0x0103 (259) }
- 0x0009 Bluetooth Profile Descriptor List-->value:
{ 0x110E Audio/Video Remote Control , 0x0104 (260) }
- 0x0311 Supported Features-->value:
{ 0x02 }
36 00 4D Length
- 0x0000 Service Record Handle-->value:
{ 0x010008 (65544) }
- 0x0001 Service Class ID List-->value:
{ 0x110C Audio/Video Remote Control Target }
- 0x0004 Protocol Descriptor List-->value:
{ 0x0100 L2CAP , 0x0017 (23) } , { 0x0017 Audio/Video Control Transport Protocol (AVCTP) , 0x0103 (259) }
- 0x0009 Bluetooth Profile Descriptor List-->value:
{ 0x110E Audio/Video Remote Control , 0x0104 (260) }
- 0x000D Additional Protocol Descriptor Lists-->value:
{ 0x0100 L2CAP , 0x001B (27) } { 0x0017 Audio/Video Control Transport Protocol (AVCTP) , 0x0103 (259) }
- 0x0311 Supported Features-->value:
{ 0x01 } }}
36 00 52 Length
- 0x0000 Service Record Handle-->value:
{0x01000A (65546)}
- 0x0001 Service Class ID List-->value:
{ 0x1200 PnP Information }
- 0x0004 Protocol Descriptor List-->value:
{ 0x0100 L2CAP , 0x0001) } , { 0x0001 SDP }
- 0x0009 Bluetooth Profile Descriptor List-->value:
{ 0x1200 PnP Information , 0x0103 (259) }
- 0x0200 Specification ID-->value:
{ 0x0103 (259) }
- 0x0201 Vendor ID[2]-->value:
{ 0x054C } (Sony Corp.)
- 0x0202 Product ID-->value:
{ 0x081F }
- 0x0203 Version-->value:
{ 0x0100 }
- 0x0204 Primary Record-->value:
{ 0x01 }
- 0x0205 Vendor ID Source-->value:
{ 0x0002 }
DS4
Response
This response is 708-byte long: the DS4 does not respect the 672-byte outgoing L2CAP MTU.
Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00000000 07 00 01 02 BF 02 BC 36 02 B9 36 02 61 09 00 00 ....¿.¼6.¹6.a... 00000010 0A 00 01 00 01 09 00 01 35 03 19 11 24 09 00 04 ........5...$... 00000020 35 0D 35 06 19 01 00 09 00 11 35 03 19 00 11 09 5.5.......5..... 00000030 00 06 35 09 09 65 6E 09 00 6A 09 01 00 09 00 09 ..5..en..j...... 00000040 35 08 35 06 19 11 24 09 01 00 09 00 0D 35 0F 35 5.5...$......5.5 00000050 0D 35 06 19 01 00 09 00 13 35 03 19 00 11 09 01 .5.......5...... 00000060 00 25 13 57 69 72 65 6C 65 73 73 20 43 6F 6E 74 .%.Wireless Cont 00000070 72 6F 6C 6C 65 72 09 01 01 25 0F 47 61 6D 65 20 roller...%.Game 00000080 43 6F 6E 74 72 6F 6C 6C 65 72 09 01 02 25 1B 53 Controller...%.S 00000090 6F 6E 79 20 43 6F 6D 70 75 74 65 72 20 45 6E 74 ony Computer Ent 000000A0 65 72 74 61 69 6E 6D 65 6E 74 09 02 00 09 01 00 ertainment...... 000000B0 09 02 01 09 01 11 09 02 02 08 08 09 02 03 08 00 ................ 000000C0 09 02 04 28 00 09 02 05 28 01 09 02 06 36 01 6C ...(....(....6.l 000000D0 36 01 69 08 22 26 01 64 05 01 09 05 A1 01 85 01 6.i."&.d....¡.…. 000000E0 09 30 09 31 09 32 09 35 15 00 26 FF 00 75 08 95 .0.1.2.5..&ÿ.u.• 000000F0 04 81 02 09 39 15 00 25 07 75 04 95 01 81 42 05 ....9..%.u.•..B. 00000100 09 19 01 29 0E 15 00 25 01 75 01 95 0E 81 02 75 ...)...%.u.•...u 00000110 06 95 01 81 01 05 01 09 33 09 34 15 00 26 FF 00 .•......3.4..&ÿ. 00000120 75 08 95 02 81 02 06 04 FF 85 02 09 24 95 24 B1 u.•.....ÿ…..$•$± 00000130 02 85 A3 09 25 95 30 B1 02 85 05 09 26 95 28 B1 .…£.%•0±.…..&•(± 00000140 02 85 06 09 27 95 34 B1 02 85 07 09 28 95 30 B1 .…..'•4±.…..(•0± 00000150 02 85 08 09 29 95 2F B1 02 06 03 FF 85 03 09 21 .…..)•/±...ÿ…..! 00000160 95 26 B1 02 85 04 09 22 95 2E B1 02 85 F0 09 47 •&±.….."•.±.…ð.G 00000170 95 3F B1 02 85 F1 09 48 95 3F B1 02 85 F2 09 49 •?±.…ñ.H•?±.…ò.I 00000180 95 0F B1 02 06 00 FF 85 11 09 20 15 00 26 FF 00 •.±...ÿ….. ..&ÿ. 00000190 75 08 95 4D 81 02 09 21 91 02 85 12 09 22 95 8D u.•M...!‘.….."•. 000001A0 81 02 09 23 91 02 85 13 09 24 95 CD 81 02 09 25 ...#‘.…..$•Í...% 000001B0 91 02 85 14 09 26 96 0D 01 81 02 09 27 91 02 85 ‘.…..&–.....'‘.… 000001C0 15 09 28 96 4D 01 81 02 09 29 91 02 85 16 09 2A ..(–M....)‘.…..* 000001D0 96 8D 01 81 02 09 2B 91 02 85 17 09 2C 96 CD 01 –.....+‘.…..,–Í. 000001E0 81 02 09 2D 91 02 85 18 09 2E 96 0D 02 81 02 09 ...-‘.…...–..... 000001F0 2F 91 02 85 19 09 30 96 22 02 81 02 09 31 91 02 /‘.…..0–"....1‘. 00000200 06 80 FF 85 82 09 22 95 3F B1 02 85 83 09 23 B1 .€ÿ…‚."•?±.…ƒ.#± 00000210 02 85 84 09 24 B1 02 85 90 09 30 B1 02 85 91 09 .…„.$±.…..0±.…‘. 00000220 31 B1 02 85 92 09 32 B1 02 85 93 09 33 B1 02 85 1±.…’.2±.…“.3±.… 00000230 A0 09 40 B1 02 85 A4 09 44 B1 02 C0 09 02 07 35 .@±.…¤.D±.À...5 00000240 08 35 06 09 04 09 09 01 00 09 02 08 28 00 09 02 .5..........(... 00000250 09 28 01 09 02 0A 28 01 09 02 0B 09 01 00 09 02 .(....(......... 00000260 0C 09 1F 40 09 02 0D 28 00 09 02 0E 28 00 36 00 ...@...(....(.6. 00000270 52 09 00 00 0A 00 01 00 02 09 00 01 35 03 19 12 R...........5... 00000280 00 09 00 04 35 0D 35 06 19 01 00 09 00 01 35 03 ....5.5.......5. 00000290 19 00 01 09 00 09 35 08 35 06 19 12 00 09 01 03 ......5.5....... 000002A0 09 02 00 09 01 03 09 02 01 09 05 4C 09 02 02 09 ...........L.... 000002B0 05 C4 09 02 03 09 01 00 09 02 04 28 01 09 02 05 .Ä.........(.... 000002C0 09 00 02 00 ....
0x07 PDU
0x0001 Transaction ID
0x02BF Length
0x02BC Length
0x36|02B9 type:6, size index:6 + Length
0x36|0261 type:6, size index:6 + Length first chunk
0x0000 Service Record Handle-->value {0x010001}
- 0x0001 Service Class ID List-->value {0x1124 Human Interface Device (HID)}
- 0x0004 Protocol Descriptor List-->value {0x0100 L2CAP , 0x0011 } ,{ 0x0011 Human Interface Device Profile (HIDP) , 0x0102 (258)}
- 0x0006 Language Base Attribute ID List[3]-->: value = { 0x656E ("en"), 0x6A (106), 0x100(256) }
- 0x0009 Bluetooth Profile Descriptor List--> value = { 0x1124 Human Interface Device Service , 0x100(256)}
- 0x000D Additional Protocol Descriptor Lists--> value = { { 0x0100 L2CAP , 0x0013(19) } , { 0x00 11HIDP } }
- 0X0100 Service Name--> value = "Wireless Controller"
- 0x0101 Service Description--> value = "Game Controller"
- 0x0102 Provider Name--> value = "Sony Computer Entertainment"
- 0x0200 GOEP L2CAP PSM/Group Id/IP Subnet (0x200)--> value = 0x100 (256)
- 0x0201 Service Database State--> value = 273
...
0x36|0052 type:6, size index:6 + Length second chunk
0x0000 Service Record Handle-->value {0x010002}
- 0x0001 Service Class ID List-->value {0x1200 Device Identification (DID)}
- 0x0004 Protocol Descriptor List-->
- 0x0200 Specification ID-->value: 0x0103
- 0x0201 Vendor ID-->value: 0x054C (Sony Corp.)
- 0x0202 Product ID-->value: 0x05C4 (Sony Computer Entertainment Wireless Controller)
- 0x0203 Version-->value: 0x0100
- 0x0204 Primary Record-->value: 0x01
- 0x0205 Vendor ID Source-->value: 0x0002
Notes:
- ↑ The Audio/Video Remote Control Profile (AVRCP) specification v1.3 and later require that 0x110E also be included in the ServiceClassIDList before 0x110F for backwards compatibility
- ↑ See Device Descriptor
- ↑ A list of language bases that contains a language identifier according to ISO 639:1 , a character encoding identifier and a base attribute ID (0x0100) for the languages used in the service record.
Examples
0000 01 13 0c f8 57 69 72 65 6c 65 73 73 20 43 6f 6e ....Wireless Con 0010 74 72 6f 6c 6c 65 72 00 00 00 00 00 00 00 00 00 troller......... 0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0080 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0090 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00f0 00 00 00 00 00 00 00 00 00 00 00 00 ............
- 0x01: HCI Command Packet
- 0x130C (0x0C13) Op-code (16 bits): identifies the command:
OGF (Op-code Group Field, most significant 6 bits):
OCF (Op-code Command Field, least significant 10 bits):
- 0xF8 (248) Length of Packet
04 13 05 01 15 00 01 00
- 0x04 Packet Type: HCI Event Packet
- 0x13 Event code
- 0x05 Parameter total length
- 0x01 Number of Connection handles
- 0x1500 (0x15) Connection handle
- 0x0100 (1) Number of completed packets
Here's a sample HCI ACL Data Packet transaction that represents a report from the DS4 to the PS4:
Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00000000 02 15 20 53 00 4F 00 42 00 A1 11 C0 00 83 81 7E 00000010 7E 08 00 3C 00 00 83 A2 07 F1 FF F9 FF 04 00 21 00000020 03 17 1F 29 F9 00 00 00 00 00 08 00 00 00 00 80 00000030 00 00 00 80 00 00 00 00 80 00 00 00 80 00 00 00 00000040 00 80 00 00 00 80 00 00 00 00 80 00 00 00 80 00 00000050 00 00 00 00 7D 0A 5D 0B
Offset | Size | Value | Description | |
---|---|---|---|---|
Header | 0x00 | 0x01 | 0x02 | (2) Packet Type:
|
0x01 | 0x02 | 0x1520 | (0x2015) Control information (msb00 10 000000010101lsb):
for Packet type: 2
00 = point-to-point packet (no broadcast) (only two Bluetooth units involved) 01 = Active Slave Broadcast (Up to 7 slaves can be active in the Piconet) 10 = Parked Slave Broadcast (Up to 255 further slave devices can be inactive)
01 = continuing packet of a higher level message 10 = first packet of a higher level message
0x15 | |
0x03 | 0x02 | 0x5300 | (83) Total length | |
0x05 | 0x02 | 0x4F00 | (79) Data Length (Payload+Check) | |
0x07 | 0x02 | 0x4200 | (0x0042) Channel ID (CID) | |
HID portion | 0x09 | 0x03 | 0xA111C0 | Packet Payload header: INPUT DATA protocol code 0x11 (see Structure HID transaction) |
0x0C | 0x48 | 0x0083 … 0x00 | Data: See (speculation) USB data format for the first 64 bytes + 8 bytes NULL. | |
Check | 0x54 | 0x04 | 0x7D0A5D0B | (0x0B5D0A7D) Data Integrity Check (CRC-32)
To ensure that the packet is valid, this field is appended onto the end of the packet. Packet Payload is used to compute the Data Integrity Check (the CRC32's polynomial is 0x4C11DB7). You can use http://www.lammertbies.nl/comm/info/crc-calculation.html to try this yourself, enter the packet payload into the textbox (hex): First 75 bytes of the HID report
A1 11 C0 00 83 81 7E 7E 08 00 3C 00 00 83 A2 07 F1 FF F9 FF 04 00 21 03 17 1F 29 F9 00 00 00 00 00 08 00 00 00 00 80 00 00 00 80 00 00 00 00 80 00 00 00 80 00 00 00 00 80 00 00 00 80 00 00 00 00 80 00 00 00 80 00 00 00 00 00
|
Structure HID transaction (portion)
Input and output reports specify control data and feature reports specify configuration data.
byte index | bit 7 | bit 6 | bit 5 | bit 4 | bit 3 | bit 2 | bit 1 | bit 0 |
---|---|---|---|---|---|---|---|---|
[0] | transaction type:
|
parameters:
|
report type:
| |||||
[1] | protocol code | |||||||
[2] | - | |||||||
[3-end] | report content (e.g. buttons for report type input , see data structure) |
HID INPUT reports
Input controls are sources of data relevant to an application, for example, X and Y data (e.g.: axes stick) or buttons obtained from a pointing device.
Protocol code:
0x01
This report is sent until the GET REPORT FEATURE 0x02 is received.
0xa1, 0x01, 0x7d, 0x7d, 0x80, 0x7e, 0x08, 0x00, 0x00, 0x00, 0x00 ^Left Stick X ... ^D-PAD
0x11
This report is sent once the GET REPORT FEATURE 0x02 is received. See example
HID output reports
Output controls are a sink for application data, for example, an LED (or sound or rumbles) that indicates the state of a device.
Protocol code:
0x11
0x14
Speculation: contains sound.
Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 0000 0f 01 42 00 a2 14 40 a0 f4 69 02 9c 75 19 24 00 [email protected].$. 0010 00 00 00 00 00 00 00 76 db 6d bb 6d b6 dd b6 db .......v.m.m.... 0020 6e db 6d b7 6d b6 db b6 db 6d db 6d b6 ed b6 db n.m.m....m.m.... 0030 76 db 6d bb 6d b6 dd b6 db 6e db 6d b7 6d b6 db v.m.m....n.m.m.. 0040 b6 db 6d db 6d b6 ed b6 db 76 db 6d bb 6d b6 dd ..m.m....v.m.m.. 0050 b6 db 6e db 6d b7 6d b6 db b6 db 6d db 6d b6 ed ..n.m.m....m.m.. 0060 b6 db 76 db 6d bb 6d b6 dd b6 db 6e db 6d b7 6d ..v.m.m....n.m.m 0070 b6 db b6 db 6d db 6d b6 ed b6 db 9c 75 19 24 00 ....m.m.....u.$. 0080 00 00 00 00 00 00 00 76 db 6d bb 6d b6 dd b6 db .......v.m.m.... 0090 6e db 6d b7 6d b6 db b6 db 6d db 6d b6 ed b6 db n.m.m....m.m.... 00a0 76 db 6d bb 6d b6 dd b6 db 6e db 6d b7 6d b6 db v.m.m....n.m.m.. 00b0 b6 db 6d db 6d b6 ed b6 db 76 db 6d bb 6d b6 dd ..m.m....v.m.m.. 00c0 b6 db 6e db 6d b7 6d b6 db b6 db 6d db 6d b6 ed ..n.m.m....m.m.. 00d0 b6 db 76 db 6d bb 6d b6 dd b6 db 6e db 6d b7 6d ..v.m.m....n.m.m 00e0 b6 db b6 db 6d db 6d b6 ed b6 db 00 00 00 00 00 ....m.m......... 00f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0100 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 9f ................ 0110 42 86 54 B.T
0x15
Speculation: contains rumbles, LED color and sound.
Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 0000 4f 01 42 00 a2 15 c0 a0 f3 04 00 00 00 00 00 ff O.B............. 0010 00 00 00 00 00 00 00 00 00 00 49 49 00 4f 85 00 ..........II.O.. 0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0050 00 00 00 f6 69 02 9c 75 19 24 00 00 00 00 00 00 ....i..u.$...... 0060 00 00 76 db 6d bb 6d b6 dd b6 db 6e db 6d b7 6d ..v.m.m....n.m.m 0070 b6 db b6 db 6d db 6d b6 ed b6 db 76 db 6d bb 6d ....m.m....v.m.m 0080 b6 dd b6 db 6e db 6d b7 6d b6 db b6 db 6d db 6d ....n.m.m....m.m 0090 b6 ed b6 db 76 db 6d bb 6d b6 dd b6 db 6e db 6d ....v.m.m....n.m 00a0 b7 6d b6 db b6 db 6d db 6d b6 ed b6 db 76 db 6d .m....m.m....v.m 00b0 bb 6d b6 dd b6 db 6e db 6d b7 6d b6 db b6 db 6d .m....n.m.m....m 00c0 db 6d b6 ed b6 db 9c 75 19 24 00 00 00 00 00 00 .m.....u.$...... 00d0 00 00 76 db 6d bb 6d b6 dd b6 db 6e db 6d b7 6d ..v.m.m....n.m.m 00e0 b6 db b6 db 6d db 6d b6 ed b6 db 76 db 6d bb 6d ....m.m....v.m.m 00f0 b6 dd b6 db 6e db 6d b7 6d b6 db b6 db 6d db 6d ....n.m.m....m.m 0100 b6 ed b6 db 76 db 6d bb 6d b6 dd b6 db 6e db 6d ....v.m.m....n.m 0110 b7 6d b6 db b6 db 6d db 6d b6 ed b6 db 76 db 6d .m....m.m....v.m 0120 bb 6d b6 dd b6 db 6e db 6d b7 6d b6 db b6 db 6d .m....n.m.m....m 0130 db 6d b6 ed b6 db 00 00 00 00 00 00 00 00 00 00 .m.............. 0140 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 b5 ................ 0150 98 a9 0f ...
- 0x4F01: length (335)
- 0x4200: CID (42)
- 0xA2: DATA OUTPUT
- 0x15: Protocol Code
- 0xC0A0F30400: Unknown
- 0x00: Rumble right
- 0x00: Rumble left
- 0x00: LED (Red)
- 0x00: LED (Green)
- 0xFF: LED (Blue)
... 0xB598A90F: Check (CRC-32 from offset 0x04 to 0x14E)
0x17
0x18
0x19
HID features reports
A user-mode application can obtain (get) and set feature information by using this report designation.
GET FEATURE
0x02
0x04
0x06
0xA3
0xF1
02 15 20 08 00 04 00 41 00 4b f1 40 00
0xF2
SET FEATURE
0x03
0xF0
|