Changeset 36477 in vbox
- Timestamp:
- Mar 30, 2011 5:21:29 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/USB/USBProxyDevice.cpp
r36475 r36477 269 269 } 270 270 271 /* Given the pointer to an interface or endpoint descriptor, find any following 272 * non-standard (vendor or class) descriptors. 273 */ 274 static const void *collect_stray_bits(uint8_t *this_desc, uint8_t *end, uint16_t *cbExtra) 275 { 276 uint8_t *tmp, *buf; 277 uint8_t type; 278 279 Assert(*(this_desc + 1) == VUSB_DT_INTERFACE || *(this_desc + 1) == VUSB_DT_ENDPOINT); 280 buf = this_desc; 281 282 /* Skip the current interface/endpoint descriptor. */ 283 buf += *(uint8_t *)buf; 284 285 /* Loop until we find another descriptor we understand. */ 286 for (tmp = buf; ((tmp + 1) < end) && *tmp; tmp += *tmp) 287 { 288 type = *(tmp + 1); 289 if (type == VUSB_DT_INTERFACE || type == VUSB_DT_ENDPOINT) 290 break; 291 } 292 *cbExtra = tmp - buf; 293 if (*cbExtra) 294 return buf; 295 else 296 return NULL; 297 } 298 271 299 /* Setup a vusb_interface structure given some preallocated structures 272 300 * to use, (we counted them already) … … 279 307 uint32_t altmap[4] = {0,}; 280 308 uint8_t *tmp, *end = buf + len; 309 uint8_t *orig_desc = buf; 281 310 uint8_t alt; 282 311 int state; … … 328 357 cur_if->pvMore = NULL; 329 358 359 cur_if->pvClass = collect_stray_bits(tmp, end, &cur_if->cbClass); 360 330 361 pIf->cSettings++; 331 362 … … 356 387 else 357 388 cur_ep->pvMore = NULL; 389 390 cur_ep->pvClass = collect_stray_bits(tmp, end, &cur_ep->cbClass); 358 391 359 392 cur_ep->Core.wMaxPacketSize = RT_LE2H_U16(cur_ep->Core.wMaxPacketSize); … … 437 470 for(x=0; x < 32; x++) 438 471 if ( cnt.idmap[i] & (1 << x) ) 439 if ( !copy_interface(pIf++, (i << 6) | x, &ifd, &epd, (uint8_t *) descs, tot_len) ) {472 if ( !copy_interface(pIf++, (i << 6) | x, &ifd, &epd, (uint8_t *)out->pvOriginal, tot_len) ) { 440 473 Log(("copy_interface(%d,,) failed\n", pIf - 1)); 441 474 goto err;
Note:
See TracChangeset
for help on using the changeset viewer.