1 <html devsite> 2 <head> 3 <title>USB Headset: Accessory Specification</title> 4 <meta name="project_path" value="/_project.yaml" /> 5 <meta name="book_path" value="/_book.yaml" /> 6 </head> 7 <body> 8 <!-- 9 Copyright 2017 The Android Open Source Project 10 11 Licensed under the Apache License, Version 2.0 (the "License"); 12 you may not use this file except in compliance with the License. 13 You may obtain a copy of the License at 14 15 http://www.apache.org/licenses/LICENSE-2.0 16 17 Unless required by applicable law or agreed to in writing, software 18 distributed under the License is distributed on an "AS IS" BASIS, 19 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 See the License for the specific language governing permissions and 21 limitations under the License. 22 --> 23 24 25 26 <p> 27 This documentation specifies USB headset buttons behavior to function uniformly 28 across the Android ecosystem. Device manufacturers should also consult the 29 <a href="/devices/audio/usb.html">USB 30 Digital Audio</a> page for more information about USB implementation on Android 31 and the <a href="http://source.android.com/compatibility/android-cdd.html">Android 32 Compatibility Definition Document (CDD)</a> for requirements related to Android 33 devices. 34 </p> 35 <p>There are also specifications for 36 <a href="plug-headset-spec.html">3.5 mm headsets</a> for accessory manufacturers and 37 <a href="jack-headset-spec.html">3.5 mm jacks</a> for device manufacturers. 38 </p> 39 <p> 40 This documentation specifies the minimum requirements: accessory manufacturers 41 are encouraged to add features while keeping these requirements in mind. 42 </p> 43 <h2 id="control-function-mapping">Control-function mapping</h2> 44 <table> 45 <tr> 46 <th>Control Function</th> 47 <th>Accessory Support</th> 48 <th>Description</th> 49 </tr> 50 <tr> 51 <td>A</td> 52 <td>Required</td> 53 <td>Play/pause (short press), launch voice command (long press), next (double 54 press)</td> 55 </tr> 56 <tr> 57 <td>B</td> 58 <td>Optional</td> 59 <td>Vol+</td> 60 </tr> 61 <tr> 62 <td>C</td> 63 <td>Optional</td> 64 <td>Vol-</td> 65 </tr> 66 <tr> 67 <td>D</td> 68 <td>Optional</td> 69 <td>Launch voice command</td> 70 </tr> 71 </table> 72 <p> 73 <strong>Assign functions to buttons as follows:</strong> 74 </p> 75 <ul> 76 <li>All one-button headsets must implement Function A.</li> 77 <li>Headsets with multiple buttons must implement functions according to the 78 following pattern: 79 <ul> 80 <li>2 functions: A and D</li> 81 <li>3 functions: A, B, C</li> 82 <li>4 functions: A, B, C, D</li> 83 </ul> 84 </li> 85 </ul> 86 <p class="note"> 87 <strong>Note</strong>: No key latching allowed. Each key press by the end user 88 must generate the corresponding "down" and "up" key event, matching the end user 89 action. In other words, the keys for functions A through D are never "latched" 90 or implemented to be used as a toggle (where the "up" event only follows "down" 91 on a second key press). 92 </p> 93 <h2 id="software-mapping">Software mapping</h2> 94 <p> 95 Compatible USB headsets are required to support the following software mappings 96 for the headset buttons. Device support is required for the following software 97 mappings. 98 </p> 99 100 <table> 101 <tr> 102 <th>Function</th> 103 <th>Mappings</th> 104 <th>Context</th> 105 <th>Behavior</th> 106 </tr> 107 <tr> 108 <td rowspan="6">A</td> 109 <td rowspan="6"><strong>HID usage page</strong>: 0x0C<br> 110 <strong>HID usage</strong>: 0x0CD<br> 111 <strong>Kernel key</strong>: <code>KEY_PLAYPAUSE</code><br> 112 <strong>Android key</strong>: <code>KEYCODE_MEDIA_PLAY_PAUSE</code></td> 113 <td rowspan="2">Media playback</td> 114 <td><strong>Input</strong>: Short press<br> 115 <strong>Output</strong>: Play or pause</td> 116 </tr> 117 <tr> 118 <td><strong>Input</strong>: Long press<br> 119 <strong>Output</strong>: Launch voice command<br> 120 <strong>Sends</strong>: 121 <code>android.intent.action.VOICE_SEARCH_HANDS_FREE</code></td> 122 </tr> 123 <tr> 124 <td rowspan="2">Incoming call</td> 125 <td><strong>Input</strong>: Short press<br> 126 <strong>Output</strong>: Accept call</td> 127 </tr> 128 <tr> 129 <td><strong>Input</strong>: Long press<br> 130 <strong>Output</strong>: Reject call</td> 131 </tr> 132 <tr> 133 <td rowspan="2">Ongoing call</td> 134 <td><strong>Input</strong>: Short press<br> 135 <strong>Output</strong>: End call</td> 136 </tr> 137 <tr> 138 <td><strong>Input</strong>: Long press<br> 139 <strong>Output</strong>: Mute or unmute microphone</td> 140 </tr> 141 <tr> 142 <td>B</td> 143 <td><strong>HID usage page</strong>: 0x0C<br> 144 <strong>HID usage</strong>: 0x0E9<br> 145 <strong>Kernel key</strong>: <code>KEY_VOLUMEUP</code><br> 146 <strong>Android key</strong>: <code>VOLUME_UP</code></td> 147 <td>Media playback, Ongoing call</td> 148 <td><strong>Input</strong>: Short or long press<br> 149 <strong>Output</strong>: Increases the system or headset volume</td> 150 </tr> 151 <tr> 152 <td>C</td> 153 <td><strong>HID usage page</strong>: 0x0C<br> 154 <strong>HID usage</strong>: 0x0EA<br> 155 <strong>Kernel key</strong>: <code>KEY_VOLUMEDOWN</code><br> 156 <strong>Android key</strong>: <code>VOLUME_DOWN</code></td> 157 <td>Media playback, Ongoing call</td> 158 <td><strong>Input</strong>: Short or long press<br> 159 <strong>Output</strong>: Decreases the system or headset volume</td> 160 </tr> 161 <tr> 162 <td>D</td> 163 <td><strong>HID usage page</strong>: 0x0C<br> 164 <strong>HID usage</strong>: 0x0CF<br> 165 <strong>Kernel key</strong>: <code>KEY_VOICECOMMAND</code><br> 166 <strong>Android key</strong>: <code>KEYCODE_VOICE_ASSIST</code></td> 167 <td>All. Can be triggered in any instance.</td> 168 <td><strong>Input</strong>: Short or long press<br> 169 <strong>Output</strong>: Launch voice command</td> 170 </tr> 171 </table> 172 173 <p class="note">Key mappings should be declared within a HID application 174 collection. For accessories without a microphone, use Headphone (Usage 175 Page: Consumer (0x0C), Usage: Headphone (0x05)). For accesories with a 176 microphone, use Headset (Usage Page: Telephony (0x0B), Usage: Headset (0x05)).</p> 177 178 <h2 id="mechanical">Mechanical</h2> 179 <p> 180 Accessory manufacturers must follow the requirements for USB connectors 181 as specified by <a href="http://www.usb.org/">USB.org</a>. 182 </p> 183 <p> 184 Device manufacturers must follow the requirements in the 185 <a href="/compatibility/android-cdd.html#7_7_usb">USB section</a> of 186 the Android CDD. 187 </p> 188 189 </body> 190 </html> 191