80 | | DumpAudioCSInterfaceDescriptorHeader(const usb_generic_descriptor* descriptor) { |
81 | | printf(" bLength: %u\n", descriptor->length); |
82 | | printf(" bDescriptorType: %u (CS_INTERFACE)\n", descriptor->descriptor_type); |
83 | | |
84 | | printf(" bDescriptorSubtype: %u (HEADER)\n", (uint8)descriptor->data[0]); |
85 | | printf(" bcdADC: 0x%04x\n", (uint16)descriptor->data[1]); |
86 | | printf(" wTotalLength: %u\n", (uint16)descriptor->data[3]); |
87 | | printf(" bInCollection: %u\n", (uint8)descriptor->data[5]); |
88 | | |
89 | | uint8 bInCollection = (uint8)descriptor->data[5]; |
90 | | for (uint8 i = 0; i < bInCollection; i++) |
91 | | printf(" baInterfaceNr %u: %u\n", i+1, (uint8)descriptor->data[6+i]); |
| 83 | DumpAudioCSInterfaceDescriptorHeader( |
| 84 | const usb_audiocontrol_header_descriptor* descriptor) |
| 85 | { |
| 86 | printf(" bDescriptorType: %u (CS_INTERFACE)\n", |
| 87 | descriptor->descriptor_type); |
| 88 | |
| 89 | printf(" bDescriptorSubtype: %u (HEADER)\n", |
| 90 | descriptor->descriptor_subtype); |
| 91 | printf(" bcdADC: 0x%04x\n", |
| 92 | descriptor->bcd_release_no); |
| 93 | printf(" wTotalLength: %u\n", |
| 94 | descriptor->r1.total_length); |
| 95 | printf(" bInCollection: %u\n", |
| 96 | descriptor->r1.in_collection); |
| 97 | |
| 98 | for (uint8 i = 0; i < descriptor->r1.in_collection; i++) |
| 99 | printf(" baInterfaceNr %u: %u\n", i + 1, |
| 100 | descriptor->r1.interface_numbers[i]); |
97 | | if(wChannelConfig & mask) |
98 | | puts(" Left Front (L)"); |
99 | | mask <<= 2; |
100 | | if(wChannelConfig & mask) |
101 | | puts(" Right Front (R)"); |
102 | | mask <<= 2; |
103 | | if(wChannelConfig & mask) |
104 | | puts(" Center Front (C)"); |
105 | | mask <<= 2; |
106 | | if(wChannelConfig & mask) |
107 | | puts(" Low Frequency Enchancement (LFE)"); |
108 | | mask <<= 2; |
109 | | if(wChannelConfig & mask) |
110 | | puts(" Left Surround (Ls)"); |
111 | | mask <<= 2; |
112 | | if(wChannelConfig & mask) |
113 | | puts(" Right Surround (Rs)"); |
114 | | mask <<= 2; |
115 | | if(wChannelConfig & mask) |
116 | | puts(" Left of Center (Lc)"); |
117 | | mask <<= 2; |
118 | | if(wChannelConfig & mask) |
119 | | puts(" Right of Center (Rc)"); |
120 | | mask <<= 2; |
121 | | if(wChannelConfig & mask) |
122 | | puts(" Surround (S)"); |
123 | | mask <<= 2; |
124 | | if(wChannelConfig & mask) |
125 | | puts(" Side Left (Sl)"); |
126 | | mask <<= 2; |
127 | | if(wChannelConfig & mask) |
128 | | puts(" Side Right (Sr)"); |
129 | | mask <<= 2; |
130 | | if(wChannelConfig & mask) |
131 | | puts(" Top (T)"); |
| 123 | for (uint8 i = 0; i < 13; i++) { |
| 124 | if (wChannelConfig & mask) |
| 125 | puts(kChannelConfigStrings[i]); |
| 126 | mask <<= 2; |
| 127 | } |
135 | | DumpAudioCSInterfaceDescriptorInputTerminal(const usb_generic_descriptor* descriptor) { |
136 | | printf(" bLength: %u\n", descriptor->length); |
137 | | printf(" bDescriptorType: %u (CS_INTERFACE)\n", descriptor->descriptor_type); |
138 | | |
139 | | printf(" bDescriptorSubtype: %u (INPUT_TERMINAL)\n", (uint8)descriptor->data[0]); |
140 | | printf(" bTerminalID: %u\n", (uint8)descriptor->data[1]); |
141 | | printf(" wTerminalType: %u\n", (uint16)descriptor->data[2]); |
142 | | printf(" bAssocTerminal: %u\n", (uint8)descriptor->data[4]); |
143 | | printf(" bNrChannels: %u\n", (uint8)descriptor->data[5]); |
144 | | |
145 | | uint16 wChannelConfig = (uint16)descriptor->data[6]; |
146 | | printf(" wChannelConfig: %u\n", wChannelConfig); |
147 | | DumpChannelConfig(wChannelConfig); |
148 | | |
149 | | printf(" iChannelNames: %u\n", (uint8)descriptor->data[8]); |
150 | | printf(" iTerminal: %u\n", (uint8)descriptor->data[9]); |
| 132 | DumpAudioCSInterfaceDescriptorInputTerminal( |
| 133 | const usb_audio_input_terminal_descriptor* descriptor) |
| 134 | { |
| 135 | printf(" bDescriptorType: %u (CS_INTERFACE)\n", |
| 136 | descriptor->descriptor_type); |
| 137 | printf(" bDescriptorSubtype: %u (INPUT_TERMINAL)\n", |
| 138 | descriptor->descriptor_subtype); |
| 139 | printf(" bTerminalID: %u\n", |
| 140 | descriptor->terminal_id); |
| 141 | printf(" wTerminalType: %u\n", |
| 142 | descriptor->terminal_type); |
| 143 | printf(" bAssocTerminal: %u\n", |
| 144 | descriptor->assoc_terminal); |
| 145 | printf(" bNrChannels: %u\n", |
| 146 | descriptor->r1.num_channels); |
| 147 | printf(" wChannelConfig: %u\n", |
| 148 | descriptor->r1.channel_config); |
| 149 | DumpChannelConfig(descriptor->r1.channel_config); |
| 150 | |
| 151 | printf(" iChannelNames: %u\n", |
| 152 | descriptor->r1.channel_names); |
| 153 | printf(" iTerminal: %u\n", |
| 154 | descriptor->r1.terminal); |
155 | | DumpAudioCSInterfaceDescriptorOutputTerminal(const usb_generic_descriptor* descriptor) { |
156 | | printf(" bLength: %u\n", descriptor->length); |
157 | | printf(" bDescriptorType: %u (CS_INTERFACE)\n", descriptor->descriptor_type); |
158 | | |
159 | | printf(" bDescriptorSubtype: %u (OUTPUT_TERMINAL)\n", (uint8)descriptor->data[0]); |
160 | | printf(" bTerminalID: %u\n", (uint8)descriptor->data[1]); |
161 | | printf(" wTerminalType: %u\n", (uint16)descriptor->data[2]); |
162 | | printf(" bAssocTerminal: %u\n", (uint8)descriptor->data[4]); |
163 | | printf(" bSourceID: %u\n", (uint8)descriptor->data[5]); |
164 | | printf(" iTerminal: %u\n", (uint8)descriptor->data[6]); |
| 159 | DumpAudioCSInterfaceDescriptorOutputTerminal( |
| 160 | const usb_audio_output_terminal_descriptor* descriptor) |
| 161 | { |
| 162 | printf(" bDescriptorType: %u (CS_INTERFACE)\n", |
| 163 | descriptor->descriptor_type); |
| 164 | printf(" bDescriptorSubtype: %u (OUTPUT_TERMINAL)\n", |
| 165 | descriptor->descriptor_subtype); |
| 166 | printf(" bTerminalID: %u\n", |
| 167 | descriptor->terminal_id); |
| 168 | printf(" wTerminalType: %u\n", |
| 169 | descriptor->terminal_type); |
| 170 | printf(" bAssocTerminal: %u\n", |
| 171 | descriptor->assoc_terminal); |
| 172 | printf(" bSourceID: %u\n", |
| 173 | descriptor->source_id); |
| 174 | printf(" iTerminal: %u\n", |
| 175 | descriptor->r1.terminal); |
169 | | DumpAudioCSInterfaceDescriptorMixerUnit(const usb_generic_descriptor* descriptor) { |
170 | | printf(" bLength: %u\n", descriptor->length); |
171 | | printf(" bDescriptorType: %u (CS_INTERFACE)\n", descriptor->descriptor_type); |
172 | | |
173 | | printf(" bDescriptorSubtype: %u (MIXER_UNIT)\n", (uint8)descriptor->data[0]); |
174 | | printf(" bUnitID: %u\n", (uint8)descriptor->data[1]); |
175 | | |
176 | | uint8 bNrInPins = (uint8)descriptor->data[2]; |
177 | | printf(" bNrInPins: %u\n", bNrInPins); |
178 | | for(uint8 i = 0; i < bNrInPins; i++) |
179 | | printf(" baSourceID %u: %u\n", i+1, (uint8)descriptor->data[3+i]); |
180 | | |
181 | | int idx = 3+bNrInPins; |
182 | | printf(" bNrChannels: %u\n", (uint8)descriptor->data[idx++]); |
183 | | |
184 | | uint16 wChannelConfig = (uint16)descriptor->data[idx]; |
185 | | printf(" wChannelConfig: %u\n", wChannelConfig); |
186 | | DumpChannelConfig(wChannelConfig); |
187 | | |
188 | | printf(" iChannelNames: %u\n", (uint8)descriptor->data[idx += 2]); |
189 | | |
190 | | for(uint i = 1; idx < descriptor->length-3; idx++, i++) |
191 | | printf(" bmControl %u: %u\n", i, (uint8)descriptor->data[idx]); |
192 | | |
193 | | printf(" iMixer: %u\n", (uint8)descriptor->data[descriptor->length-3]); |
| 180 | DumpAudioCSInterfaceDescriptorMixerUnit( |
| 181 | const usb_audio_mixer_unit_descriptor* descriptor) |
| 182 | { |
| 183 | printf(" bDescriptorType: %u (CS_INTERFACE)\n", |
| 184 | descriptor->descriptor_type); |
| 185 | printf(" bDescriptorSubtype: %u (MIXER_UNIT)\n", |
| 186 | descriptor->descriptor_subtype); |
| 187 | printf(" bUnitID: %u\n", |
| 188 | descriptor->unit_id); |
| 189 | |
| 190 | printf(" bNrInPins: %u\n", descriptor->num_input_pins); |
| 191 | for (uint8 i = 0; i < descriptor->num_input_pins; i++) |
| 192 | printf(" baSourceID %u: %u\n", |
| 193 | i + 1, descriptor->input_pins[i]); |
| 194 | |
| 195 | usb_audio_output_channels_descriptor_r1* channels = |
| 196 | (usb_audio_output_channels_descriptor_r1*) |
| 197 | descriptor + descriptor->num_input_pins + 5; |
| 198 | printf(" bNrChannels: %u\n", channels->num_output_pins); |
| 199 | printf(" wChannelConfig: %u\n", |
| 200 | channels->channel_config); |
| 201 | DumpChannelConfig(channels->channel_config); |
| 202 | printf(" iChannelNames: %u\n", channels->channel_names); |
| 203 | |
| 204 | usb_generic_descriptor* generic = (usb_generic_descriptor*)descriptor; |
| 205 | uint8 idx = 7 + descriptor->num_input_pins; |
| 206 | for (uint i = 1; idx < descriptor->length - 3; idx++, i++) |
| 207 | printf(" bmControl %u: %u\n", i, |
| 208 | (uint8)generic->data[idx]); |
| 209 | |
| 210 | printf(" iMixer: %u\n", |
| 211 | generic->data[generic->length - 3]); |
204 | | uint8 bNrInPins = (uint8)descriptor->data[2]; |
205 | | printf(" bNrInPins: %u\n", bNrInPins); |
206 | | for(uint8 i = 0; i < bNrInPins; i++) |
207 | | printf(" baSourceID %u: %u\n", i+1, (uint8)descriptor->data[3+i]); |
| 215 | void |
| 216 | DumpAudioCSInterfaceDescriptorSelectorUnit( |
| 217 | const usb_audio_selector_unit_descriptor* descriptor) |
| 218 | { |
| 219 | printf(" bDescriptorType: %u (CS_INTERFACE)\n", |
| 220 | descriptor->descriptor_type); |
| 221 | printf(" bDescriptorSubtype: %u (SELECTOR_UNIT)\n", |
| 222 | descriptor->descriptor_subtype); |
| 223 | printf(" bUnitID: %u\n", |
| 224 | descriptor->unit_id); |
| 225 | |
| 226 | printf(" bNrInPins: %u\n", descriptor->num_input_pins); |
| 227 | for (uint8 i = 0; i < descriptor->num_input_pins; i++) |
| 228 | printf(" baSourceID %u: %u\n", |
| 229 | i + 1, descriptor->input_pins[i]); |
249 | | DumpAudioCSInterfaceDescriptorFeatureUnit(const usb_generic_descriptor* descriptor) { |
250 | | printf(" bLength: %u\n", descriptor->length); |
251 | | printf(" bDescriptorType: %u (CS_INTERFACE)\n", descriptor->descriptor_type); |
252 | | |
253 | | printf(" bDescriptorSubtype: %u (FEATURE_UNIT)\n", (uint8)descriptor->data[0]); |
254 | | printf(" bUnitID: %u\n", (uint8)descriptor->data[1]); |
255 | | printf(" bSourceID: %u\n", (uint8)descriptor->data[2]); |
256 | | |
257 | | uint8 bControlSize = (uint8)descriptor->data[3]; |
258 | | printf(" bControlSize: %u\b", bControlSize); |
259 | | uint8 channels = ((descriptor->length-2)-4) / bControlSize; |
260 | | if (bControlSize == 1) { |
261 | | for(uint8 i = 0; i < channels; i++) { |
262 | | printf(" bmaControl %u: %u\n", i+1, (uint8)descriptor->data[4+i]); |
263 | | DumpBMAControl((uint8)descriptor->data[4+i]); |
| 263 | DumpAudioCSInterfaceDescriptorFeatureUnit( |
| 264 | const usb_audio_feature_unit_descriptor* descriptor) |
| 265 | { |
| 266 | printf(" bDescriptorType: %u (CS_INTERFACE)\n", |
| 267 | descriptor->descriptor_type); |
| 268 | printf(" bDescriptorSubtype: %u (FEATURE_UNIT)\n", |
| 269 | descriptor->descriptor_subtype); |
| 270 | printf(" bUnitID: %u\n", |
| 271 | descriptor->unit_id); |
| 272 | printf(" bSourceID: %u\n", |
| 273 | descriptor->source_id); |
| 274 | |
| 275 | printf(" bControlSize: %u\n", |
| 276 | descriptor->r1.control_size); |
| 277 | uint8 channels = (descriptor->length - 6) / descriptor->r1.control_size; |
| 278 | if (descriptor->r1.control_size == 1) { |
| 279 | for (uint8 i = 0; i < channels; i++) { |
| 280 | printf(" bmaControl %u: %u\n", |
| 281 | i + 1, (uint8)descriptor->r1.bma_controls[i]); |
| 282 | DumpBMAControl((uint8)descriptor->r1.bma_controls[i]); |
265 | | } else if (bControlSize == 2) { |
266 | | for(uint8 i = 0; i < channels; i++) { |
267 | | printf(" bmaControl %u: %u\n", i+1, (uint16)descriptor->data[4+i*2]); |
268 | | DumpBMAControl((uint16)descriptor->data[4+i*2]); |
| 284 | } else if (descriptor->r1.control_size == 2) { |
| 285 | for (uint8 i = 0; i < channels; i++) { |
| 286 | printf(" bmaControl %u: %u\n", |
| 287 | i + 1, (uint16)descriptor->r1.bma_controls[i * 2]); |
| 288 | DumpBMAControl((uint16)descriptor->r1.bma_controls[i * 2]); |
282 | | DumpAudioCSInterfaceDescriptorAssociated(const usb_generic_descriptor* descriptor) { |
283 | | printf(" bLength: %u\n", descriptor->length); |
284 | | printf(" bDescriptorType: %u (CS_INTERFACE)\n", descriptor->descriptor_type); |
285 | | |
286 | | printf(" bDescriptorSubtype: %u (ASSOC_INTERFACE)\n", (uint8)descriptor->data[0]); |
287 | | printf(" bInterfaceNr: %u\n", (uint8)descriptor->data[1]); |
288 | | printf(" Association-specific data:"); |
289 | | for(uint8 i = 0; i < descriptor->length-2; i++) |
290 | | printf("%02x ", descriptor->data[i+2]); |
| 305 | DumpAudioCSInterfaceDescriptorAssociated( |
| 306 | const usb_generic_descriptor* descriptor) |
| 307 | { |
| 308 | printf(" bDescriptorType: %u (CS_INTERFACE)\n", |
| 309 | descriptor->descriptor_type); |
| 310 | printf(" bDescriptorSubtype: %u (ASSOC_INTERFACE)\n", |
| 311 | (uint8)descriptor->data[0]); |
| 312 | printf(" bInterfaceNr: %u\n", |
| 313 | (uint8)descriptor->data[1]); |
| 314 | |
| 315 | printf(" Association-specific data: "); |
| 316 | for(uint8 i = 0; i < descriptor->length - 2; i++) |
| 317 | printf("%02x ", descriptor->data[i]); |