Changeset 43815 in vbox
- Timestamp:
- Nov 6, 2012 5:00:49 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/UsbMsd.cpp
r43789 r43815 40 40 #define USBMSD_STR_ID_MANUFACTURER 1 41 41 #define USBMSD_STR_ID_PRODUCT_HD 2 42 #define USBMSD_STR_ID_PRODUCT_CDROM 3 42 43 /** @} */ 43 44 … … 265 266 { USBMSD_STR_ID_MANUFACTURER, "VirtualBox" }, 266 267 { USBMSD_STR_ID_PRODUCT_HD, "USB Harddisk" }, 268 { USBMSD_STR_ID_PRODUCT_CDROM, "USB CD-ROM" } 267 269 }; 268 270 … … 272 274 }; 273 275 274 static const VUSBDESCENDPOINTEX g_aUsbMsdEndpointDescs [2] =276 static const VUSBDESCENDPOINTEX g_aUsbMsdEndpointDescsFS[2] = 275 277 { 276 278 { … … 280 282 /* .bEndpointAddress = */ 0x81 /* ep=1, in */, 281 283 /* .bmAttributes = */ 2 /* bulk */, 282 /* .wMaxPacketSize = */ 64 ,//512 /* or 64? */, <-- depends on device speed!283 /* .bInterval = */ 0 ,284 /* .wMaxPacketSize = */ 64 /* maximum possible */, 285 /* .bInterval = */ 0 /* not applicable for bulk EP */ 284 286 }, 285 287 /* .pvMore = */ NULL, … … 293 295 /* .bEndpointAddress = */ 0x02 /* ep=2, out */, 294 296 /* .bmAttributes = */ 2 /* bulk */, 295 /* .wMaxPacketSize = */ 64 ,//512 /* or 64? */, <-- depends on device speed!296 /* .bInterval = */ 0 ,297 /* .wMaxPacketSize = */ 64 /* maximum possible */, 298 /* .bInterval = */ 0 /* not applicable for bulk EP */ 297 299 }, 298 300 /* .pvMore = */ NULL, … … 302 304 }; 303 305 304 static const VUSBDESCINTERFACEEX g_UsbMsdInterfaceDesc = 306 static const VUSBDESCENDPOINTEX g_aUsbMsdEndpointDescsHS[2] = 307 { 308 { 309 { 310 /* .bLength = */ sizeof(VUSBDESCENDPOINT), 311 /* .bDescriptorType = */ VUSB_DT_ENDPOINT, 312 /* .bEndpointAddress = */ 0x81 /* ep=1, in */, 313 /* .bmAttributes = */ 2 /* bulk */, 314 /* .wMaxPacketSize = */ 512 /* HS bulk packet size */, 315 /* .bInterval = */ 0 /* no NAKs */ 316 }, 317 /* .pvMore = */ NULL, 318 /* .pvClass = */ NULL, 319 /* .cbClass = */ 0 320 }, 321 { 322 { 323 /* .bLength = */ sizeof(VUSBDESCENDPOINT), 324 /* .bDescriptorType = */ VUSB_DT_ENDPOINT, 325 /* .bEndpointAddress = */ 0x02 /* ep=2, out */, 326 /* .bmAttributes = */ 2 /* bulk */, 327 /* .wMaxPacketSize = */ 512 /* HS bulk packet size */, 328 /* .bInterval = */ 0 /* no NAKs */ 329 }, 330 /* .pvMore = */ NULL, 331 /* .pvClass = */ NULL, 332 /* .cbClass = */ 0 333 } 334 }; 335 336 static const VUSBDESCINTERFACEEX g_UsbMsdInterfaceDescFS = 305 337 { 306 338 { … … 318 350 /* .pvClass = */ NULL, 319 351 /* .cbClass = */ 0, 320 &g_aUsbMsdEndpointDescs [0]352 &g_aUsbMsdEndpointDescsFS[0] 321 353 }; 322 354 323 static const VUSBINTERFACE g_aUsbMsdInterfaces[] = 324 { 325 { &g_UsbMsdInterfaceDesc, /* .cSettings = */ 1 }, 355 static const VUSBDESCINTERFACEEX g_UsbMsdInterfaceDescHS = 356 { 357 { 358 /* .bLength = */ sizeof(VUSBDESCINTERFACE), 359 /* .bDescriptorType = */ VUSB_DT_INTERFACE, 360 /* .bInterfaceNumber = */ 0, 361 /* .bAlternateSetting = */ 0, 362 /* .bNumEndpoints = */ 2, 363 /* .bInterfaceClass = */ 8 /* Mass Storage */, 364 /* .bInterfaceSubClass = */ 6 /* SCSI transparent command set */, 365 /* .bInterfaceProtocol = */ 0x50 /* Bulk-Only Transport */, 366 /* .iInterface = */ 0 367 }, 368 /* .pvMore = */ NULL, 369 /* .pvClass = */ NULL, 370 /* .cbClass = */ 0, 371 &g_aUsbMsdEndpointDescsHS[0] 326 372 }; 327 373 328 static const VUSBDESCCONFIGEX g_UsbMsdConfigDesc = 374 static const VUSBINTERFACE g_aUsbMsdInterfacesFS[] = 375 { 376 { &g_UsbMsdInterfaceDescFS, /* .cSettings = */ 1 }, 377 }; 378 379 static const VUSBINTERFACE g_aUsbMsdInterfacesHS[] = 380 { 381 { &g_UsbMsdInterfaceDescHS, /* .cSettings = */ 1 }, 382 }; 383 384 static const VUSBDESCCONFIGEX g_UsbMsdConfigDescFS = 329 385 { 330 386 { … … 332 388 /* .bDescriptorType = */ VUSB_DT_CONFIG, 333 389 /* .wTotalLength = */ 0 /* recalculated on read */, 334 /* .bNumInterfaces = */ RT_ELEMENTS(g_aUsbMsdInterfaces ),390 /* .bNumInterfaces = */ RT_ELEMENTS(g_aUsbMsdInterfacesFS), 335 391 /* .bConfigurationValue =*/ 1, 336 392 /* .iConfiguration = */ 0, … … 339 395 }, 340 396 NULL, /* pvMore */ 341 &g_aUsbMsdInterfaces[0], 397 &g_aUsbMsdInterfacesFS[0], 398 NULL /* pvOriginal */ 399 }; 400 401 static const VUSBDESCCONFIGEX g_UsbMsdConfigDescHS = 402 { 403 { 404 /* .bLength = */ sizeof(VUSBDESCCONFIG), 405 /* .bDescriptorType = */ VUSB_DT_CONFIG, 406 /* .wTotalLength = */ 0 /* recalculated on read */, 407 /* .bNumInterfaces = */ RT_ELEMENTS(g_aUsbMsdInterfacesHS), 408 /* .bConfigurationValue =*/ 1, 409 /* .iConfiguration = */ 0, 410 /* .bmAttributes = */ RT_BIT(7), 411 /* .MaxPower = */ 50 /* 100mA */ 412 }, 413 NULL, /* pvMore */ 414 &g_aUsbMsdInterfacesHS[0], 342 415 NULL /* pvOriginal */ 343 416 }; … … 374 447 }; 375 448 376 static const PDMUSBDESCCACHE g_UsbMsdDescCache =449 static const PDMUSBDESCCACHE g_UsbMsdDescCacheFS = 377 450 { 378 451 /* .pDevice = */ &g_UsbMsdDeviceDesc, 379 /* .paConfigs = */ &g_UsbMsdConfigDesc, 452 /* .paConfigs = */ &g_UsbMsdConfigDescFS, 453 /* .paLanguages = */ g_aUsbMsdLanguages, 454 /* .cLanguages = */ RT_ELEMENTS(g_aUsbMsdLanguages), 455 /* .fUseCachedDescriptors = */ true, 456 /* .fUseCachedStringsDescriptors = */ true 457 }; 458 459 static const PDMUSBDESCCACHE g_UsbMsdDescCacheHS = 460 { 461 /* .pDevice = */ &g_UsbMsdDeviceDesc, 462 /* .paConfigs = */ &g_UsbMsdConfigDescHS, 380 463 /* .paLanguages = */ g_aUsbMsdLanguages, 381 464 /* .cLanguages = */ RT_ELEMENTS(g_aUsbMsdLanguages), … … 1171 1254 } 1172 1255 } 1256 LogRel(("DATA_FROM_HOST: %d bytes\n", cbData)); 1173 1257 return usbMsdCompleteOk(pThis, pUrb, cbData); 1174 1258 } … … 1231 1315 pReq->enmState = USBMSDREQSTATE_STATUS; 1232 1316 } 1317 LogRel(("DATA_TO_HOST: %d bytes\n", cbCopy)); 1233 1318 return usbMsdCompleteOk(pThis, pUrb, cbCopy); 1234 1319 } … … 1517 1602 PUSBMSD pThis = PDMINS_2_DATA(pUsbIns, PUSBMSD); 1518 1603 LogFlow(("usbMsdUsbGetDescriptorCache/#%u:\n", pUsbIns->iInstance)); 1519 return &g_UsbMsdDescCache; 1604 if (pThis->pUsbIns->iUsbHubVersion & VUSB_STDVER_20) 1605 return &g_UsbMsdDescCacheHS; 1606 else 1607 return &g_UsbMsdDescCacheFS; 1520 1608 } 1521 1609 … … 1635 1723 "USB Mass Storage Device, one LUN.", 1636 1724 /* fFlags */ 1637 0,1725 PDM_USBREG_HIGHSPEED_CAPABLE, 1638 1726 /* cMaxInstances */ 1639 1727 ~0U,
Note:
See TracChangeset
for help on using the changeset viewer.