Changeset 70322 in vbox for trunk/src/VBox/VMM/VMMR3
- Timestamp:
- Dec 22, 2017 4:53:41 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 119922
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR3/PDMUsb.cpp
r70039 r70322 459 459 460 460 /** 461 * Translates a USB ve sion (a bit-mask) to USB speed (enum). Picks461 * Translates a USB version (a bit-mask) to USB speed (enum). Picks 462 462 * the highest available version. 463 463 * … … 480 480 481 481 return enmSpd; 482 } 483 484 485 /** 486 * Translates a USB speed (enum) to USB version. 487 * 488 * @returns USB version mask 489 * 490 * @param enmSpeed The USB connection speed. 491 * 492 */ 493 static uint32_t pdmR3UsbSpd2Ver(VUSBSPEED enmSpeed) 494 { 495 uint32_t iUsbVersion = 0; 496 Assert(enmSpeed != VUSB_SPEED_UNKNOWN); 497 498 switch (enmSpeed) 499 { 500 case VUSB_SPEED_LOW: 501 case VUSB_SPEED_FULL: 502 iUsbVersion = VUSB_STDVER_11; 503 break; 504 case VUSB_SPEED_HIGH: 505 iUsbVersion = VUSB_STDVER_20; 506 break; 507 case VUSB_SPEED_SUPER: 508 case VUSB_SPEED_SUPERPLUS: 509 default: 510 iUsbVersion = VUSB_STDVER_30; 511 break; 512 } 513 514 return iUsbVersion; 482 515 } 483 516 … … 987 1020 * @param pszAddress The address string. 988 1021 * @param pvBackend Pointer to the backend. 989 * @param iUsbVersion The preferred USB version.1022 * @param enmSpeed The speed the USB device is operating at. 990 1023 * @param fMaskedIfs The interfaces to hide from the guest. 991 1024 * @param pszCaptureFilename Path to the file for USB traffic capturing, optional. 992 1025 */ 993 1026 VMMR3DECL(int) PDMR3UsbCreateProxyDevice(PUVM pUVM, PCRTUUID pUuid, const char *pszBackend, const char *pszAddress, void *pvBackend, 994 uint32_t iUsbVersion, uint32_t fMaskedIfs, const char *pszCaptureFilename)1027 VUSBSPEED enmSpeed, uint32_t fMaskedIfs, const char *pszCaptureFilename) 995 1028 { 996 1029 /* … … 1003 1036 AssertPtrReturn(pUuid, VERR_INVALID_POINTER); 1004 1037 AssertPtrReturn(pszAddress, VERR_INVALID_POINTER); 1005 AssertReturn( iUsbVersion == VUSB_STDVER_30 1006 || iUsbVersion == VUSB_STDVER_20 1007 || iUsbVersion == VUSB_STDVER_11, VERR_INVALID_PARAMETER); 1038 AssertReturn( enmSpeed == VUSB_SPEED_LOW 1039 || enmSpeed == VUSB_SPEED_FULL 1040 || enmSpeed == VUSB_SPEED_HIGH 1041 || enmSpeed == VUSB_SPEED_SUPER 1042 || enmSpeed == VUSB_SPEED_SUPERPLUS, VERR_INVALID_PARAMETER); 1008 1043 1009 1044 /* … … 1021 1056 */ 1022 1057 PPDMUSBHUB pHub; 1058 uint32_t iUsbVersion = pdmR3UsbSpd2Ver(enmSpeed); 1023 1059 int rc = pdmR3UsbFindHub(pVM, iUsbVersion, &pHub); 1024 1060 if (RT_FAILURE(rc)) … … 1042 1078 rc = CFGMR3InsertString(pConfig, "UUID", szUuid); AssertRCBreak(rc); 1043 1079 rc = CFGMR3InsertString(pConfig, "Backend", pszBackend); AssertRCBreak(rc); 1044 rc = CFGMR3InsertInteger(pConfig, "USBVersion", iUsbVersion); AssertRCBreak(rc);1045 1080 rc = CFGMR3InsertInteger(pConfig, "pvBackend", (uintptr_t)pvBackend); AssertRCBreak(rc); 1046 1081 rc = CFGMR3InsertInteger(pConfig, "MaskedIfs", fMaskedIfs); AssertRCBreak(rc); … … 1054 1089 } 1055 1090 1056 VUSBSPEED enmSpeed = pdmR3UsbVer2Spd(iUsbVersion); 1091 if (enmSpeed == VUSB_SPEED_UNKNOWN) 1092 enmSpeed = pdmR3UsbVer2Spd(iUsbVersion); 1057 1093 1058 1094 /*
Note:
See TracChangeset
for help on using the changeset viewer.