Changeset 48983 in vbox
- Timestamp:
- Oct 8, 2013 9:57:15 PM (11 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp
r48538 r48983 744 744 pszCtl = "LsiLogic"; 745 745 break; 746 case StorageControllerType_LsiLogicSas: 747 pszCtl = "LsiLogicSas"; 748 break; 746 749 case StorageControllerType_BusLogic: 747 750 pszCtl = "BusLogic"; … … 761 764 case StorageControllerType_I82078: 762 765 pszCtl = "I82078"; 766 break; 767 case StorageControllerType_USB: 768 pszCtl = "USB"; 763 769 break; 764 770 -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageStorageController.cpp
r48734 r48983 1062 1062 ctl.asOutParam())); 1063 1063 } 1064 else if (!RTStrICmp(pszBusType, "usb")) 1065 { 1066 CHECK_ERROR(machine, AddStorageController(Bstr(pszCtl).raw(), 1067 StorageBus_USB, 1068 ctl.asOutParam())); 1069 } 1064 1070 else 1065 1071 { … … 1110 1116 { 1111 1117 CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_LsiLogicSas)); 1118 } 1119 else if (!RTStrICmp(pszCtlType, "usb")) 1120 { 1121 CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_USB)); 1112 1122 } 1113 1123 else -
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendCOM.cpp
r48587 r48983 446 446 case KStorageControllerType_I82078: return QApplication::translate("VBoxGlobal", "I82078", "StorageControllerType"); 447 447 case KStorageControllerType_LsiLogicSas: return QApplication::translate("VBoxGlobal", "LsiLogic SAS", "StorageControllerType"); 448 case KStorageControllerType_USB: return QApplication::translate("VBoxGlobal", "USB", "StorageControllerType"); 448 449 AssertMsgFailed(("No text for %d", type)); break; 449 450 } … … 598 599 list.insert(QApplication::translate("VBoxGlobal", "I82078", "StorageControllerType"), KStorageControllerType_I82078); 599 600 list.insert(QApplication::translate("VBoxGlobal", "LsiLogic SAS", "StorageControllerType"), KStorageControllerType_LsiLogicSas); 601 list.insert(QApplication::translate("VBoxGlobal", "USB", "StorageControllerType"), KStorageControllerType_USB); 600 602 if (!list.contains(strType)) 601 603 { -
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp
r48826 r48983 171 171 } 172 172 strResult = QApplication::translate("VBoxGlobal", "Floppy Device %1", "StorageSlot").arg(storageSlot.device); 173 break; 174 } 175 case KStorageBus_USB: 176 { 177 int iMaxPort = vboxGlobal().virtualBox().GetSystemProperties().GetMaxPortCountForStorageBus(storageSlot.bus); 178 if (storageSlot.port < 0 || storageSlot.port > iMaxPort) 179 { 180 AssertMsgFailed(("No text for bus=%d & port=%d", storageSlot.bus, storageSlot.port)); 181 break; 182 } 183 if (storageSlot.device != 0) 184 { 185 AssertMsgFailed(("No text for bus=%d & port=%d & device=%d", storageSlot.bus, storageSlot.port, storageSlot.device)); 186 break; 187 } 188 strResult = QApplication::translate("VBoxGlobal", "USB Port %1", "StorageSlot").arg(storageSlot.port); 173 189 break; 174 190 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp
r48577 r48983 156 156 mPixmaps [i] = (PixmapPool::PixmapType) (PixmapPool::SATAControllerNormal + i); 157 157 break; 158 case KStorageBus_USB: 159 mPixmaps [i] = (PixmapPool::PixmapType) (PixmapPool::SATAControllerNormal + i); 160 break; 158 161 default: 159 162 break; … … 275 278 return 1; 276 279 } 280 281 /* USB Controller Type */ 282 USBStorageControllerType::USBStorageControllerType (KStorageControllerType aSubType) 283 : AbstractControllerType (KStorageBus_USB, aSubType) 284 { 285 } 286 287 KStorageControllerType USBStorageControllerType::first() const 288 { 289 return KStorageControllerType_USB; 290 } 291 292 uint USBStorageControllerType::size() const 293 { 294 return 1; 295 } 296 277 297 278 298 /* Abstract Item */ … … 416 436 mCtrType = new SASControllerType (aControllerType); 417 437 break; 438 case KStorageBus_USB: 439 mCtrType = new USBStorageControllerType (aControllerType); 440 break; 441 418 442 default: 419 443 AssertMsgFailed (("Wrong Controller Type {%d}!\n", aBusType)); … … 1017 1041 vboxGlobal().virtualBox().GetSystemProperties().GetMaxInstancesOfStorageBus(chipsetType(), KStorageBus_SAS)); 1018 1042 } 1043 case R_IsMoreUSBControllersPossible: 1044 { 1045 return (m_dialogType == SettingsDialogType_Offline) && 1046 (static_cast<RootItem*>(mRootItem)->childCount(KStorageBus_USB) < 1047 vboxGlobal().virtualBox().GetSystemProperties().GetMaxInstancesOfStorageBus(chipsetType(), KStorageBus_USB)); 1048 } 1019 1049 case R_IsMoreAttachmentsPossible: 1020 1050 { … … 1552 1582 { 1553 1583 QMap<KStorageBus, int> currentMap; 1554 for (int iStorageBusType = KStorageBus_IDE; iStorageBusType <= KStorageBus_ SAS; ++iStorageBusType)1584 for (int iStorageBusType = KStorageBus_IDE; iStorageBusType <= KStorageBus_USB; ++iStorageBusType) 1555 1585 { 1556 1586 currentMap.insert((KStorageBus)iStorageBusType, … … 1563 1593 { 1564 1594 QMap<KStorageBus, int> maximumMap; 1565 for (int iStorageBusType = KStorageBus_IDE; iStorageBusType <= KStorageBus_ SAS; ++iStorageBusType)1595 for (int iStorageBusType = KStorageBus_IDE; iStorageBusType <= KStorageBus_USB; ++iStorageBusType) 1566 1596 { 1567 1597 maximumMap.insert((KStorageBus)iStorageBusType, … … 1722 1752 : mStorageModel(0) 1723 1753 , mAddCtrAction(0), mDelCtrAction(0) 1724 , mAddIDECtrAction(0), mAddSATACtrAction(0), mAddSCSICtrAction(0), mAddSASCtrAction(0), mAddFloppyCtrAction(0) 1754 , mAddIDECtrAction(0), mAddSATACtrAction(0), mAddSCSICtrAction(0), mAddSASCtrAction(0), mAddFloppyCtrAction(0), mAddUSBCtrAction(0) 1725 1755 , mAddAttAction(0), mDelAttAction(0) 1726 1756 , mAddHDAttAction(0), mAddCDAttAction(0), mAddFDAttAction(0) … … 1764 1794 mAddSASCtrAction = new QAction (this); 1765 1795 mAddSASCtrAction->setIcon(UIIconPool::iconSet(PixmapPool::pool()->pixmap (PixmapPool::SATAControllerAddEn), 1796 PixmapPool::pool()->pixmap (PixmapPool::SATAControllerAddDis))); 1797 1798 mAddUSBCtrAction = new QAction (this); 1799 mAddUSBCtrAction->setIcon(UIIconPool::iconSet(PixmapPool::pool()->pixmap (PixmapPool::SATAControllerAddEn), 1766 1800 PixmapPool::pool()->pixmap (PixmapPool::SATAControllerAddDis))); 1767 1801 … … 1844 1878 connect (mAddSASCtrAction, SIGNAL (triggered (bool)), this, SLOT (addSASController())); 1845 1879 connect (mAddFloppyCtrAction, SIGNAL (triggered (bool)), this, SLOT (addFloppyController())); 1880 connect (mAddUSBCtrAction, SIGNAL (triggered (bool)), this, SLOT (addUSBController())); 1846 1881 connect (mDelCtrAction, SIGNAL (triggered (bool)), this, SLOT (delController())); 1847 1882 connect (mAddAttAction, SIGNAL (triggered (bool)), this, SLOT (addAttachment())); … … 2168 2203 QMap<KStorageBus, int> currentType = mStorageModel->currentControllerTypes(); 2169 2204 QMap<KStorageBus, int> maximumType = mStorageModel->maximumControllerTypes(); 2170 for (int iStorageBusType = KStorageBus_IDE; iStorageBusType <= KStorageBus_ SAS; ++iStorageBusType)2205 for (int iStorageBusType = KStorageBus_IDE; iStorageBusType <= KStorageBus_USB; ++iStorageBusType) 2171 2206 { 2172 2207 if (currentType[(KStorageBus)iStorageBusType] > maximumType[(KStorageBus)iStorageBusType]) … … 2214 2249 mAddSASCtrAction->setText (tr ("Add SAS Controller")); 2215 2250 mAddFloppyCtrAction->setText (tr ("Add Floppy Controller")); 2251 mAddUSBCtrAction->setText (tr ("Add USB Controller")); 2216 2252 mDelCtrAction->setText (tr ("Remove Controller")); 2217 2253 mAddAttAction->setText (tr ("Add Attachment")); … … 2323 2359 menu.addAction (mAddSASCtrAction); 2324 2360 menu.addAction (mAddFloppyCtrAction); 2361 menu.addAction (mAddUSBCtrAction); 2325 2362 menu.exec (QCursor::pos()); 2326 2363 } … … 2349 2386 { 2350 2387 addControllerWrapper (generateUniqueName ("SAS"), KStorageBus_SAS, KStorageControllerType_LsiLogicSas); 2388 } 2389 2390 void UIMachineSettingsStorage::addUSBController() 2391 { 2392 addControllerWrapper (generateUniqueName ("USB"), KStorageBus_USB, KStorageControllerType_USB); 2351 2393 } 2352 2394 … … 2474 2516 KStorageBus bus = mStorageModel->data (index, StorageModel::R_CtrBusType).value <KStorageBus>(); 2475 2517 mLbPortCount->setVisible (bus == KStorageBus_SATA); 2476 mSbPortCount->setVisible (bus == KStorageBus_SATA );2518 mSbPortCount->setVisible (bus == KStorageBus_SATA || bus == KStorageBus_SAS); 2477 2519 uint uPortCount = mStorageModel->data (index, StorageModel::R_CtrPortCount).toUInt(); 2478 2520 mSbPortCount->setValue (uPortCount); … … 2755 2797 bool isFloppyPossible = mStorageModel->data (index, StorageModel::R_IsMoreFloppyControllersPossible).toBool(); 2756 2798 bool isSASPossible = mStorageModel->data (index, StorageModel::R_IsMoreSASControllersPossible).toBool(); 2799 bool isUSBPossible = mStorageModel->data (index, StorageModel::R_IsMoreUSBControllersPossible).toBool(); 2757 2800 2758 2801 bool isController = mStorageModel->data (index, StorageModel::R_IsController).toBool(); … … 2760 2803 bool isAttachmentsPossible = mStorageModel->data (index, StorageModel::R_IsMoreAttachmentsPossible).toBool(); 2761 2804 2762 mAddCtrAction->setEnabled (isIDEPossible || isSATAPossible || isSCSIPossible || isFloppyPossible || isSASPossible );2805 mAddCtrAction->setEnabled (isIDEPossible || isSATAPossible || isSCSIPossible || isFloppyPossible || isSASPossible || isUSBPossible); 2763 2806 mAddIDECtrAction->setEnabled (isIDEPossible); 2764 2807 mAddSATACtrAction->setEnabled (isSATAPossible); … … 2766 2809 mAddFloppyCtrAction->setEnabled (isFloppyPossible); 2767 2810 mAddSASCtrAction->setEnabled (isSASPossible); 2811 mAddUSBCtrAction->setEnabled (isUSBPossible); 2768 2812 2769 2813 mAddAttAction->setEnabled (isController && isAttachmentsPossible); … … 3049 3093 case KStorageBus_Floppy: 3050 3094 Assert (mStorageModel->data (index, StorageModel::R_IsMoreFloppyControllersPossible).toBool()); 3095 break; 3096 case KStorageBus_USB: 3097 Assert (mStorageModel->data (index, StorageModel::R_IsMoreUSBControllersPossible).toBool()); 3051 3098 break; 3052 3099 default: -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.h
r48264 r48983 229 229 }; 230 230 231 /* USB Controller Type */ 232 class USBStorageControllerType : public AbstractControllerType 233 { 234 public: 235 236 USBStorageControllerType (KStorageControllerType aSubType); 237 238 private: 239 240 KStorageControllerType first() const; 241 uint size() const; 242 }; 243 231 244 /* Abstract Item */ 232 245 class AbstractItem … … 436 449 R_IsMoreFloppyControllersPossible, 437 450 R_IsMoreSASControllersPossible, 451 R_IsMoreUSBControllersPossible, 438 452 R_IsMoreAttachmentsPossible, 439 453 … … 692 706 void addFloppyController(); 693 707 void addSASController(); 708 void addUSBController(); 694 709 void delController(); 695 710 … … 770 785 QAction *mAddSASCtrAction; 771 786 QAction *mAddFloppyCtrAction; 787 QAction *mAddUSBCtrAction; 772 788 QAction *mAddAttAction; 773 789 QAction *mDelAttAction; -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r48914 r48983 18312 18312 <enum 18313 18313 name="StorageBus" 18314 uuid=" eee67ab3-668d-4ef5-91e0-7025fe4a0d7a"18314 uuid="2dab9df1-9683-48fd-8c11-caada236fcb0" 18315 18315 > 18316 18316 <desc> … … 18326 18326 <const name="Floppy" value="4"/> 18327 18327 <const name="SAS" value="5"/> 18328 <const name="USB" value="6"/> 18328 18329 </enum> 18329 18330 18330 18331 <enum 18331 18332 name="StorageControllerType" 18332 uuid=" 8a412b8a-f43e-4456-bd37-b474f0879a58"18333 uuid="02e190af-b546-4109-b036-6deaa4ef6e69" 18333 18334 > 18334 18335 <desc> … … 18363 18364 <const name="LsiLogicSas" value="8"> 18364 18365 <desc>A variant of the LsiLogic controller using SAS.</desc> 18366 </const> 18367 <const name="USB" value="9"> 18368 <desc>Special USB based storage controller.</desc> 18365 18369 </const> 18366 18370 </enum> -
trunk/src/VBox/Main/include/ConsoleImpl.h
r48528 r48983 51 51 class DisplayMouseInterface; 52 52 53 #include <iprt/uuid.h> 53 54 #include <VBox/RemoteDesktop/VRDE.h> 54 55 #include <VBox/vmm/pdmdrv.h> … … 497 498 }; 498 499 500 /** 501 * Class for managing emulated USB MSDs. 502 */ 503 class USBStorageDevice 504 { 505 public: 506 USBStorageDevice() 507 { } 508 /** The UUID associated with the USB device. */ 509 RTUUID mUuid; 510 /** Port of the storage device. */ 511 LONG iPort; 512 }; 513 499 514 typedef std::map<Utf8Str, ComObjPtr<SharedFolder> > SharedFolderMap; 500 515 typedef std::map<Utf8Str, SharedFolderData> SharedFolderDataMap; 501 516 typedef std::map<Utf8Str, ComPtr<IMediumAttachment> > MediumAttachmentMap; 517 typedef std::list <USBStorageDevice> USBStorageDeviceList; 502 518 503 519 private: … … 827 843 iLedSas = iLedScsi + cLedScsi, 828 844 cLedSas = 8, 829 cLedStorage = cLedFloppy + cLedIde + cLedSata + cLedScsi + cLedSas 845 iLedUsb = iLedSas + cLedSas, 846 cLedUsb = 8, 847 cLedStorage = cLedFloppy + cLedIde + cLedSata + cLedScsi + cLedSas + cLedUsb 830 848 }; 831 849 DeviceType_T maStorageDevType[cLedStorage]; … … 836 854 837 855 MediumAttachmentMap mapMediumAttachments; 856 857 /** List of attached USB storage devices. */ 858 USBStorageDeviceList mUSBStorageDevices; 838 859 839 860 /* Note: FreeBSD needs this whether netflt is used or not. */ -
trunk/src/VBox/Main/src-client/ConsoleImpl.cpp
r48528 r48983 3462 3462 case StorageControllerType_I82078: 3463 3463 return "i82078"; 3464 case StorageControllerType_USB: 3465 return "Msd"; 3464 3466 default: 3465 3467 return NULL; … … 3484 3486 { 3485 3487 uLun = port; 3488 return S_OK; 3489 } 3490 case StorageBus_USB: 3491 { 3492 /* 3493 * It is always the first lun, the port denotes the device instance 3494 * for the Msd device. 3495 */ 3496 uLun = 0; 3486 3497 return S_OK; 3487 3498 } … … 3940 3951 } 3941 3952 3942 /* Determine the base path for the device instance. */ 3953 /* 3954 * Determine the base path for the device instance. USB Msd devices are handled different 3955 * because the PDM USB API requires a differnet CFGM tree when attaching a new USB device. 3956 */ 3943 3957 PCFGMNODE pCtlInst; 3944 pCtlInst = CFGMR3GetChildF(CFGMR3GetRootU(pUVM), "Devices/%s/%u/", pcszDevice, uInstance); 3958 3959 if (enmBus == StorageBus_USB) 3960 pCtlInst = CFGMR3CreateTree(pUVM); 3961 else 3962 pCtlInst = CFGMR3GetChildF(CFGMR3GetRootU(pUVM), "Devices/%s/%u/", pcszDevice, uInstance); 3963 3945 3964 AssertReturn(pCtlInst, VERR_INTERNAL_ERROR); 3946 3965 … … 3967 3986 /** @todo this dumps everything attached to this device instance, which 3968 3987 * is more than necessary. Dumping the changed LUN would be enough. */ 3969 CFGMR3Dump(pCtlInst); 3988 if (enmBus != StorageBus_USB) 3989 CFGMR3Dump(pCtlInst); 3970 3990 3971 3991 /* … … 4186 4206 PCFGMNODE pCtlInst; 4187 4207 pCtlInst = CFGMR3GetChildF(CFGMR3GetRootU(pUVM), "Devices/%s/%u/", pcszDevice, uInstance); 4188 AssertReturn(pCtlInst , VERR_INTERNAL_ERROR);4208 AssertReturn(pCtlInst || enmBus == StorageBus_USB, VERR_INTERNAL_ERROR); 4189 4209 4190 4210 #define H() AssertMsgReturn(!FAILED(hrc), ("hrc=%Rhrc\n", hrc), VERR_GENERAL_FAILURE) … … 4207 4227 #undef H 4208 4228 4209 /* First check if the LUN really exists. */ 4210 pLunL0 = CFGMR3GetChildF(pCtlInst, "LUN#%u", uLUN); 4211 if (pLunL0) 4212 { 4213 uint32_t fFlags = 0; 4214 4215 if (fSilent) 4216 fFlags |= PDM_TACH_FLAGS_NOT_HOT_PLUG; 4217 4218 rc = PDMR3DeviceDetach(pUVM, pcszDevice, uInstance, uLUN, fFlags); 4219 if (rc == VERR_PDM_NO_DRIVER_ATTACHED_TO_LUN) 4220 rc = VINF_SUCCESS; 4229 if (enmBus != StorageBus_USB) 4230 { 4231 /* First check if the LUN really exists. */ 4232 pLunL0 = CFGMR3GetChildF(pCtlInst, "LUN#%u", uLUN); 4233 if (pLunL0) 4234 { 4235 uint32_t fFlags = 0; 4236 4237 if (fSilent) 4238 fFlags |= PDM_TACH_FLAGS_NOT_HOT_PLUG; 4239 4240 rc = PDMR3DeviceDetach(pUVM, pcszDevice, uInstance, uLUN, fFlags); 4241 if (rc == VERR_PDM_NO_DRIVER_ATTACHED_TO_LUN) 4242 rc = VINF_SUCCESS; 4243 AssertRCReturn(rc, rc); 4244 CFGMR3RemoveNode(pLunL0); 4245 4246 Utf8Str devicePath = Utf8StrFmt("%s/%u/LUN#%u", pcszDevice, uInstance, uLUN); 4247 pConsole->mapMediumAttachments.erase(devicePath); 4248 4249 } 4250 else 4251 AssertFailedReturn(VERR_INTERNAL_ERROR); 4252 4253 CFGMR3Dump(pCtlInst); 4254 } 4255 else 4256 { 4257 /* Find the correct USB device in the list. */ 4258 USBStorageDeviceList::iterator it; 4259 for (it = pConsole->mUSBStorageDevices.begin(); it != pConsole->mUSBStorageDevices.end(); it++) 4260 { 4261 if (it->iPort == lPort) 4262 break; 4263 } 4264 4265 AssertReturn(it != pConsole->mUSBStorageDevices.end(), VERR_INTERNAL_ERROR); 4266 rc = PDMR3UsbDetachDevice(pUVM, &it->mUuid); 4221 4267 AssertRCReturn(rc, rc); 4222 CFGMR3RemoveNode(pLunL0); 4223 4224 Utf8Str devicePath = Utf8StrFmt("%s/%u/LUN#%u", pcszDevice, uInstance, uLUN); 4225 pConsole->mapMediumAttachments.erase(devicePath); 4226 4227 } 4228 else 4229 AssertFailedReturn(VERR_INTERNAL_ERROR); 4230 4231 CFGMR3Dump(pCtlInst); 4268 pConsole->mUSBStorageDevices.erase(it); 4269 } 4232 4270 4233 4271 /* … … 9452 9490 /* Determine the base path for the device instance. */ 9453 9491 PCFGMNODE pCtlInst; 9454 pCtlInst = CFGMR3GetChildF(CFGMR3GetRootU(pUVM), "Devices/%s/%u/", pcszDevice, uInstance); 9492 9493 if (enmBus == StorageBus_USB) 9494 pCtlInst = CFGMR3GetChildF(CFGMR3GetRootU(pUVM), "USB/%s/", pcszDevice); 9495 else 9496 pCtlInst = CFGMR3GetChildF(CFGMR3GetRootU(pUVM), "Devices/%s/%u/", pcszDevice, uInstance); 9497 9455 9498 AssertReturn(pCtlInst, VERR_INTERNAL_ERROR); 9456 9499 -
trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp
r48915 r48983 66 66 #include <VBox/param.h> 67 67 #include <VBox/vmm/pdmapi.h> /* For PDMR3DriverAttach/PDMR3DriverDetach */ 68 #include <VBox/vmm/pdmusb.h> /* For PDMR3UsbCreateEmulatedDevice */ 68 69 #include <VBox/version.h> 69 70 #include <VBox/HostServices/VBoxClipboardSvc.h> … … 1085 1086 1086 1087 1088 1087 1089 /* 1088 1090 * MM values. … … 1576 1578 1577 1579 /* 1580 * The USB Controllers. 1581 */ 1582 com::SafeIfaceArray<IUSBController> usbCtrls; 1583 hrc = pMachine->COMGETTER(USBControllers)(ComSafeArrayAsOutParam(usbCtrls)); H(); 1584 bool fOhciPresent = false; /**< Flag whether at least one OHCI controller is present. */ 1585 1586 for (size_t i = 0; i < usbCtrls.size(); ++i) 1587 { 1588 USBControllerType_T enmCtrlType; 1589 rc = usbCtrls[i]->COMGETTER(Type)(&enmCtrlType); H(); 1590 if (enmCtrlType == USBControllerType_OHCI) 1591 { 1592 fOhciPresent = true; 1593 break; 1594 } 1595 } 1596 1597 /* 1598 * Currently EHCI is only enabled when a OHCI controller is present too. 1599 * This might change when XHCI is supported. 1600 */ 1601 if (fOhciPresent) 1602 mfVMHasUsbController = true; 1603 1604 PCFGMNODE pUsbDevices = NULL; /**< Required for USB storage controller later. */ 1605 if (mfVMHasUsbController) 1606 { 1607 for (size_t i = 0; i < usbCtrls.size(); ++i) 1608 { 1609 USBControllerType_T enmCtrlType; 1610 rc = usbCtrls[i]->COMGETTER(Type)(&enmCtrlType); H(); 1611 1612 if (enmCtrlType == USBControllerType_OHCI) 1613 { 1614 InsertConfigNode(pDevices, "usb-ohci", &pDev); 1615 InsertConfigNode(pDev, "0", &pInst); 1616 InsertConfigNode(pInst, "Config", &pCfg); 1617 InsertConfigInteger(pInst, "Trusted", 1); /* boolean */ 1618 hrc = pBusMgr->assignPCIDevice("usb-ohci", pInst); H(); 1619 InsertConfigNode(pInst, "LUN#0", &pLunL0); 1620 InsertConfigString(pLunL0, "Driver", "VUSBRootHub"); 1621 InsertConfigNode(pLunL0, "Config", &pCfg); 1622 1623 /* 1624 * Attach the status driver. 1625 */ 1626 attachStatusDriver(pInst, &mapUSBLed[0], 0, 0, NULL, NULL, 0); 1627 } 1628 #ifdef VBOX_WITH_EHCI 1629 else if (enmCtrlType == USBControllerType_EHCI) 1630 { 1631 /* 1632 * USB 2.0 is only available if the proper ExtPack is installed. 1633 * 1634 * Note. Configuring EHCI here and providing messages about 1635 * the missing extpack isn't exactly clean, but it is a 1636 * necessary evil to patch over legacy compatability issues 1637 * introduced by the new distribution model. 1638 */ 1639 static const char *s_pszUsbExtPackName = "Oracle VM VirtualBox Extension Pack"; 1640 # ifdef VBOX_WITH_EXTPACK 1641 if (mptrExtPackManager->isExtPackUsable(s_pszUsbExtPackName)) 1642 # endif 1643 { 1644 InsertConfigNode(pDevices, "usb-ehci", &pDev); 1645 InsertConfigNode(pDev, "0", &pInst); 1646 InsertConfigNode(pInst, "Config", &pCfg); 1647 InsertConfigInteger(pInst, "Trusted", 1); /* boolean */ 1648 hrc = pBusMgr->assignPCIDevice("usb-ehci", pInst); H(); 1649 1650 InsertConfigNode(pInst, "LUN#0", &pLunL0); 1651 InsertConfigString(pLunL0, "Driver", "VUSBRootHub"); 1652 InsertConfigNode(pLunL0, "Config", &pCfg); 1653 1654 /* 1655 * Attach the status driver. 1656 */ 1657 attachStatusDriver(pInst, &mapUSBLed[1], 0, 0, NULL, NULL, 0); 1658 } 1659 # ifdef VBOX_WITH_EXTPACK 1660 else 1661 { 1662 /* Always fatal! Up to VBox 4.0.4 we allowed to start the VM anyway 1663 * but this induced problems when the user saved + restored the VM! */ 1664 return VMR3SetError(pUVM, VERR_NOT_FOUND, RT_SRC_POS, 1665 N_("Implementation of the USB 2.0 controller not found!\n" 1666 "Because the USB 2.0 controller state is part of the saved " 1667 "VM state, the VM cannot be started. To fix " 1668 "this problem, either install the '%s' or disable USB 2.0 " 1669 "support in the VM settings"), 1670 s_pszUsbExtPackName); 1671 } 1672 # endif 1673 } 1674 #endif 1675 } /* for every USB controller. */ 1676 1677 1678 /* 1679 * Virtual USB Devices. 1680 */ 1681 InsertConfigNode(pRoot, "USB", &pUsbDevices); 1682 1683 #ifdef VBOX_WITH_USB 1684 { 1685 /* 1686 * Global USB options, currently unused as we'll apply the 2.0 -> 1.1 morphing 1687 * on a per device level now. 1688 */ 1689 InsertConfigNode(pUsbDevices, "USBProxy", &pCfg); 1690 InsertConfigNode(pCfg, "GlobalConfig", &pCfg); 1691 // This globally enables the 2.0 -> 1.1 device morphing of proxied devices to keep windows quiet. 1692 //InsertConfigInteger(pCfg, "Force11Device", true); 1693 // The following breaks stuff, but it makes MSDs work in vista. (I include it here so 1694 // that it's documented somewhere.) Users needing it can use: 1695 // VBoxManage setextradata "myvm" "VBoxInternal/USB/USBProxy/GlobalConfig/Force11PacketSize" 1 1696 //InsertConfigInteger(pCfg, "Force11PacketSize", true); 1697 } 1698 #endif 1699 1700 #ifdef VBOX_WITH_USB_CARDREADER 1701 BOOL aEmulatedUSBCardReaderEnabled = FALSE; 1702 hrc = pMachine->COMGETTER(EmulatedUSBCardReaderEnabled)(&aEmulatedUSBCardReaderEnabled); H(); 1703 if (aEmulatedUSBCardReaderEnabled) 1704 { 1705 InsertConfigNode(pUsbDevices, "CardReader", &pDev); 1706 InsertConfigNode(pDev, "0", &pInst); 1707 InsertConfigNode(pInst, "Config", &pCfg); 1708 1709 InsertConfigNode(pInst, "LUN#0", &pLunL0); 1710 # ifdef VBOX_WITH_USB_CARDREADER_TEST 1711 InsertConfigString(pLunL0, "Driver", "DrvDirectCardReader"); 1712 InsertConfigNode(pLunL0, "Config", &pCfg); 1713 # else 1714 InsertConfigString(pLunL0, "Driver", "UsbCardReader"); 1715 InsertConfigNode(pLunL0, "Config", &pCfg); 1716 InsertConfigInteger(pCfg, "Object", (uintptr_t)mUsbCardReader); 1717 # endif 1718 } 1719 #endif 1720 1721 /* Virtual USB Mouse/Tablet */ 1722 if ( aPointingHID == PointingHIDType_USBMouse 1723 || aPointingHID == PointingHIDType_ComboMouse 1724 || aPointingHID == PointingHIDType_USBTablet 1725 || aPointingHID == PointingHIDType_USBMultiTouch) 1726 InsertConfigNode(pUsbDevices, "HidMouse", &pDev); 1727 if (aPointingHID == PointingHIDType_USBMouse) 1728 { 1729 InsertConfigNode(pDev, "0", &pInst); 1730 InsertConfigNode(pInst, "Config", &pCfg); 1731 1732 InsertConfigString(pCfg, "Mode", "relative"); 1733 InsertConfigNode(pInst, "LUN#0", &pLunL0); 1734 InsertConfigString(pLunL0, "Driver", "MouseQueue"); 1735 InsertConfigNode(pLunL0, "Config", &pCfg); 1736 InsertConfigInteger(pCfg, "QueueSize", 128); 1737 1738 InsertConfigNode(pLunL0, "AttachedDriver", &pLunL1); 1739 InsertConfigString(pLunL1, "Driver", "MainMouse"); 1740 InsertConfigNode(pLunL1, "Config", &pCfg); 1741 InsertConfigInteger(pCfg, "Object", (uintptr_t)pMouse); 1742 } 1743 if ( aPointingHID == PointingHIDType_USBTablet 1744 || aPointingHID == PointingHIDType_USBMultiTouch) 1745 { 1746 InsertConfigNode(pDev, "1", &pInst); 1747 InsertConfigNode(pInst, "Config", &pCfg); 1748 1749 InsertConfigString(pCfg, "Mode", "absolute"); 1750 InsertConfigNode(pInst, "LUN#0", &pLunL0); 1751 InsertConfigString(pLunL0, "Driver", "MouseQueue"); 1752 InsertConfigNode(pLunL0, "Config", &pCfg); 1753 InsertConfigInteger(pCfg, "QueueSize", 128); 1754 1755 InsertConfigNode(pLunL0, "AttachedDriver", &pLunL1); 1756 InsertConfigString(pLunL1, "Driver", "MainMouse"); 1757 InsertConfigNode(pLunL1, "Config", &pCfg); 1758 InsertConfigInteger(pCfg, "Object", (uintptr_t)pMouse); 1759 } 1760 if (aPointingHID == PointingHIDType_USBMultiTouch) 1761 { 1762 InsertConfigNode(pDev, "2", &pInst); 1763 InsertConfigNode(pInst, "Config", &pCfg); 1764 1765 InsertConfigString(pCfg, "Mode", "multitouch"); 1766 InsertConfigNode(pInst, "LUN#0", &pLunL0); 1767 InsertConfigString(pLunL0, "Driver", "MouseQueue"); 1768 InsertConfigNode(pLunL0, "Config", &pCfg); 1769 InsertConfigInteger(pCfg, "QueueSize", 128); 1770 1771 InsertConfigNode(pLunL0, "AttachedDriver", &pLunL1); 1772 InsertConfigString(pLunL1, "Driver", "MainMouse"); 1773 InsertConfigNode(pLunL1, "Config", &pCfg); 1774 InsertConfigInteger(pCfg, "Object", (uintptr_t)pMouse); 1775 } 1776 1777 /* Virtual USB Keyboard */ 1778 KeyboardHIDType_T aKbdHID; 1779 hrc = pMachine->COMGETTER(KeyboardHIDType)(&aKbdHID); H(); 1780 if (aKbdHID == KeyboardHIDType_USBKeyboard) 1781 { 1782 InsertConfigNode(pUsbDevices, "HidKeyboard", &pDev); 1783 InsertConfigNode(pDev, "0", &pInst); 1784 InsertConfigNode(pInst, "Config", &pCfg); 1785 1786 InsertConfigNode(pInst, "LUN#0", &pLunL0); 1787 InsertConfigString(pLunL0, "Driver", "KeyboardQueue"); 1788 InsertConfigNode(pLunL0, "Config", &pCfg); 1789 InsertConfigInteger(pCfg, "QueueSize", 64); 1790 1791 InsertConfigNode(pLunL0, "AttachedDriver", &pLunL1); 1792 InsertConfigString(pLunL1, "Driver", "MainKeyboard"); 1793 InsertConfigNode(pLunL1, "Config", &pCfg); 1794 pKeyboard = mKeyboard; 1795 InsertConfigInteger(pCfg, "Object", (uintptr_t)pKeyboard); 1796 } 1797 } 1798 1799 /* 1578 1800 * Storage controllers. 1579 1801 */ … … 1589 1811 StorageControllerType_T enmCtrlType; 1590 1812 rc = ctrls[i]->COMGETTER(ControllerType)(&enmCtrlType); H(); 1591 AssertRelease((unsigned)enmCtrlType < RT_ELEMENTS(aCtrlNodes)); 1813 AssertRelease((unsigned)enmCtrlType < RT_ELEMENTS(aCtrlNodes) 1814 || enmCtrlType == StorageControllerType_USB); 1592 1815 1593 1816 StorageBus_T enmBus; … … 1606 1829 rc = ctrls[i]->COMGETTER(Bootable)(&fBootable); H(); 1607 1830 1608 /* /Devices/<ctrldev>/ */1831 PCFGMNODE pCtlInst = NULL; 1609 1832 const char *pszCtrlDev = convertControllerTypeToDev(enmCtrlType); 1610 pDev = aCtrlNodes[enmCtrlType]; 1611 if (!pDev) 1612 { 1613 InsertConfigNode(pDevices, pszCtrlDev, &pDev); 1614 aCtrlNodes[enmCtrlType] = pDev; /* IDE variants are handled in the switch */ 1615 } 1616 1617 /* /Devices/<ctrldev>/<instance>/ */ 1618 PCFGMNODE pCtlInst = NULL; 1619 InsertConfigNode(pDev, Utf8StrFmt("%u", ulInstance).c_str(), &pCtlInst); 1620 1621 /* Device config: /Devices/<ctrldev>/<instance>/<values> & /ditto/Config/<values> */ 1622 InsertConfigInteger(pCtlInst, "Trusted", 1); 1623 InsertConfigNode(pCtlInst, "Config", &pCfg); 1833 if (enmCtrlType != StorageControllerType_USB) 1834 { 1835 /* /Devices/<ctrldev>/ */ 1836 pDev = aCtrlNodes[enmCtrlType]; 1837 if (!pDev) 1838 { 1839 InsertConfigNode(pDevices, pszCtrlDev, &pDev); 1840 aCtrlNodes[enmCtrlType] = pDev; /* IDE variants are handled in the switch */ 1841 } 1842 1843 /* /Devices/<ctrldev>/<instance>/ */ 1844 InsertConfigNode(pDev, Utf8StrFmt("%u", ulInstance).c_str(), &pCtlInst); 1845 1846 /* Device config: /Devices/<ctrldev>/<instance>/<values> & /ditto/Config/<values> */ 1847 InsertConfigInteger(pCtlInst, "Trusted", 1); 1848 InsertConfigNode(pCtlInst, "Config", &pCfg); 1849 } 1624 1850 1625 1851 switch (enmCtrlType) … … 1798 2024 &mapMediumAttachments, pszCtrlDev, ulInstance); 1799 2025 paLedDevType = &maStorageDevType[iLedSas]; 2026 break; 2027 } 2028 2029 case StorageControllerType_USB: 2030 { 2031 if (pUsbDevices) 2032 { 2033 /* 2034 * USB MSDs are handled a bit different as the device instance 2035 * doesn't match the storage controller instance but the port. 2036 */ 2037 InsertConfigNode(pUsbDevices, "Msd", &pDev); 2038 pCtlInst = pDev; 2039 } 2040 else 2041 return VMR3SetError(pUVM, VERR_NOT_FOUND, RT_SRC_POS, 2042 N_("There is no USB controller enabled but there\n" 2043 "is at least one USB storage device configured for this VM.\n" 2044 "To fix this problem either enable the USB controller or remove\n" 2045 "the storage device from the VM")); 1800 2046 break; 1801 2047 } … … 2333 2579 hrc = pMachine->COMGETTER(Name)(bstr.asOutParam()); H(); 2334 2580 InsertConfigString(pCfg, "StreamName", bstr); 2335 }2336 2337 /*2338 * The USB Controllers.2339 */2340 com::SafeIfaceArray<IUSBController> usbCtrls;2341 hrc = pMachine->COMGETTER(USBControllers)(ComSafeArrayAsOutParam(usbCtrls)); H();2342 bool fOhciPresent = false; /**< Flag whether at least one OHCI controller is presnet. */2343 2344 for (size_t i = 0; i < usbCtrls.size(); ++i)2345 {2346 USBControllerType_T enmCtrlType;2347 rc = usbCtrls[i]->COMGETTER(Type)(&enmCtrlType); H();2348 if (enmCtrlType == USBControllerType_OHCI)2349 {2350 fOhciPresent = true;2351 break;2352 }2353 }2354 2355 /*2356 * Currently EHCI is only enabled when a OHCI controller is present too.2357 * This might change when XHCI is supported.2358 */2359 if (fOhciPresent)2360 mfVMHasUsbController = true;2361 2362 if (mfVMHasUsbController)2363 {2364 for (size_t i = 0; i < usbCtrls.size(); ++i)2365 {2366 USBControllerType_T enmCtrlType;2367 rc = usbCtrls[i]->COMGETTER(Type)(&enmCtrlType); H();2368 2369 if (enmCtrlType == USBControllerType_OHCI)2370 {2371 InsertConfigNode(pDevices, "usb-ohci", &pDev);2372 InsertConfigNode(pDev, "0", &pInst);2373 InsertConfigNode(pInst, "Config", &pCfg);2374 InsertConfigInteger(pInst, "Trusted", 1); /* boolean */2375 hrc = pBusMgr->assignPCIDevice("usb-ohci", pInst); H();2376 InsertConfigNode(pInst, "LUN#0", &pLunL0);2377 InsertConfigString(pLunL0, "Driver", "VUSBRootHub");2378 InsertConfigNode(pLunL0, "Config", &pCfg);2379 2380 /*2381 * Attach the status driver.2382 */2383 attachStatusDriver(pInst, &mapUSBLed[0], 0, 0, NULL, NULL, 0);2384 }2385 #ifdef VBOX_WITH_EHCI2386 else if (enmCtrlType == USBControllerType_EHCI)2387 {2388 /*2389 * USB 2.0 is only available if the proper ExtPack is installed.2390 *2391 * Note. Configuring EHCI here and providing messages about2392 * the missing extpack isn't exactly clean, but it is a2393 * necessary evil to patch over legacy compatability issues2394 * introduced by the new distribution model.2395 */2396 static const char *s_pszUsbExtPackName = "Oracle VM VirtualBox Extension Pack";2397 # ifdef VBOX_WITH_EXTPACK2398 if (mptrExtPackManager->isExtPackUsable(s_pszUsbExtPackName))2399 # endif2400 {2401 InsertConfigNode(pDevices, "usb-ehci", &pDev);2402 InsertConfigNode(pDev, "0", &pInst);2403 InsertConfigNode(pInst, "Config", &pCfg);2404 InsertConfigInteger(pInst, "Trusted", 1); /* boolean */2405 hrc = pBusMgr->assignPCIDevice("usb-ehci", pInst); H();2406 2407 InsertConfigNode(pInst, "LUN#0", &pLunL0);2408 InsertConfigString(pLunL0, "Driver", "VUSBRootHub");2409 InsertConfigNode(pLunL0, "Config", &pCfg);2410 2411 /*2412 * Attach the status driver.2413 */2414 attachStatusDriver(pInst, &mapUSBLed[1], 0, 0, NULL, NULL, 0);2415 }2416 # ifdef VBOX_WITH_EXTPACK2417 else2418 {2419 /* Always fatal! Up to VBox 4.0.4 we allowed to start the VM anyway2420 * but this induced problems when the user saved + restored the VM! */2421 return VMR3SetError(pUVM, VERR_NOT_FOUND, RT_SRC_POS,2422 N_("Implementation of the USB 2.0 controller not found!\n"2423 "Because the USB 2.0 controller state is part of the saved "2424 "VM state, the VM cannot be started. To fix "2425 "this problem, either install the '%s' or disable USB 2.0 "2426 "support in the VM settings"),2427 s_pszUsbExtPackName);2428 }2429 # endif2430 }2431 #endif2432 } /* for every USB controller. */2433 2434 2435 /*2436 * Virtual USB Devices.2437 */2438 PCFGMNODE pUsbDevices = NULL;2439 InsertConfigNode(pRoot, "USB", &pUsbDevices);2440 2441 #ifdef VBOX_WITH_USB2442 {2443 /*2444 * Global USB options, currently unused as we'll apply the 2.0 -> 1.1 morphing2445 * on a per device level now.2446 */2447 InsertConfigNode(pUsbDevices, "USBProxy", &pCfg);2448 InsertConfigNode(pCfg, "GlobalConfig", &pCfg);2449 // This globally enables the 2.0 -> 1.1 device morphing of proxied devices to keep windows quiet.2450 //InsertConfigInteger(pCfg, "Force11Device", true);2451 // The following breaks stuff, but it makes MSDs work in vista. (I include it here so2452 // that it's documented somewhere.) Users needing it can use:2453 // VBoxManage setextradata "myvm" "VBoxInternal/USB/USBProxy/GlobalConfig/Force11PacketSize" 12454 //InsertConfigInteger(pCfg, "Force11PacketSize", true);2455 }2456 #endif2457 2458 #ifdef VBOX_WITH_USB_CARDREADER2459 BOOL aEmulatedUSBCardReaderEnabled = FALSE;2460 hrc = pMachine->COMGETTER(EmulatedUSBCardReaderEnabled)(&aEmulatedUSBCardReaderEnabled); H();2461 if (aEmulatedUSBCardReaderEnabled)2462 {2463 InsertConfigNode(pUsbDevices, "CardReader", &pDev);2464 InsertConfigNode(pDev, "0", &pInst);2465 InsertConfigNode(pInst, "Config", &pCfg);2466 2467 InsertConfigNode(pInst, "LUN#0", &pLunL0);2468 # ifdef VBOX_WITH_USB_CARDREADER_TEST2469 InsertConfigString(pLunL0, "Driver", "DrvDirectCardReader");2470 InsertConfigNode(pLunL0, "Config", &pCfg);2471 # else2472 InsertConfigString(pLunL0, "Driver", "UsbCardReader");2473 InsertConfigNode(pLunL0, "Config", &pCfg);2474 InsertConfigInteger(pCfg, "Object", (uintptr_t)mUsbCardReader);2475 # endif2476 }2477 #endif2478 2479 # if 0 /* Virtual MSD*/2480 InsertConfigNode(pUsbDevices, "Msd", &pDev);2481 InsertConfigNode(pDev, "0", &pInst);2482 InsertConfigNode(pInst, "Config", &pCfg);2483 InsertConfigNode(pInst, "LUN#0", &pLunL0);2484 2485 InsertConfigString(pLunL0, "Driver", "SCSI");2486 InsertConfigNode(pLunL0, "Config", &pCfg);2487 2488 InsertConfigNode(pLunL0, "AttachedDriver", &pLunL1);2489 InsertConfigString(pLunL1, "Driver", "Block");2490 InsertConfigNode(pLunL1, "Config", &pCfg);2491 InsertConfigString(pCfg, "Type", "HardDisk");2492 InsertConfigInteger(pCfg, "Mountable", 0);2493 2494 InsertConfigNode(pLunL1, "AttachedDriver", &pLunL2);2495 InsertConfigString(pLunL2, "Driver", "VD");2496 InsertConfigNode(pLunL2, "Config", &pCfg);2497 InsertConfigString(pCfg, "Path", "/Volumes/DataHFS/bird/VDIs/linux.vdi");2498 InsertConfigString(pCfg, "Format", "VDI");2499 # endif2500 2501 /* Virtual USB Mouse/Tablet */2502 if ( aPointingHID == PointingHIDType_USBMouse2503 || aPointingHID == PointingHIDType_ComboMouse2504 || aPointingHID == PointingHIDType_USBTablet2505 || aPointingHID == PointingHIDType_USBMultiTouch)2506 InsertConfigNode(pUsbDevices, "HidMouse", &pDev);2507 if (aPointingHID == PointingHIDType_USBMouse)2508 {2509 InsertConfigNode(pDev, "0", &pInst);2510 InsertConfigNode(pInst, "Config", &pCfg);2511 2512 InsertConfigString(pCfg, "Mode", "relative");2513 InsertConfigNode(pInst, "LUN#0", &pLunL0);2514 InsertConfigString(pLunL0, "Driver", "MouseQueue");2515 InsertConfigNode(pLunL0, "Config", &pCfg);2516 InsertConfigInteger(pCfg, "QueueSize", 128);2517 2518 InsertConfigNode(pLunL0, "AttachedDriver", &pLunL1);2519 InsertConfigString(pLunL1, "Driver", "MainMouse");2520 InsertConfigNode(pLunL1, "Config", &pCfg);2521 InsertConfigInteger(pCfg, "Object", (uintptr_t)pMouse);2522 }2523 if ( aPointingHID == PointingHIDType_USBTablet2524 || aPointingHID == PointingHIDType_USBMultiTouch)2525 {2526 InsertConfigNode(pDev, "1", &pInst);2527 InsertConfigNode(pInst, "Config", &pCfg);2528 2529 InsertConfigString(pCfg, "Mode", "absolute");2530 InsertConfigNode(pInst, "LUN#0", &pLunL0);2531 InsertConfigString(pLunL0, "Driver", "MouseQueue");2532 InsertConfigNode(pLunL0, "Config", &pCfg);2533 InsertConfigInteger(pCfg, "QueueSize", 128);2534 2535 InsertConfigNode(pLunL0, "AttachedDriver", &pLunL1);2536 InsertConfigString(pLunL1, "Driver", "MainMouse");2537 InsertConfigNode(pLunL1, "Config", &pCfg);2538 InsertConfigInteger(pCfg, "Object", (uintptr_t)pMouse);2539 }2540 if (aPointingHID == PointingHIDType_USBMultiTouch)2541 {2542 InsertConfigNode(pDev, "2", &pInst);2543 InsertConfigNode(pInst, "Config", &pCfg);2544 2545 InsertConfigString(pCfg, "Mode", "multitouch");2546 InsertConfigNode(pInst, "LUN#0", &pLunL0);2547 InsertConfigString(pLunL0, "Driver", "MouseQueue");2548 InsertConfigNode(pLunL0, "Config", &pCfg);2549 InsertConfigInteger(pCfg, "QueueSize", 128);2550 2551 InsertConfigNode(pLunL0, "AttachedDriver", &pLunL1);2552 InsertConfigString(pLunL1, "Driver", "MainMouse");2553 InsertConfigNode(pLunL1, "Config", &pCfg);2554 InsertConfigInteger(pCfg, "Object", (uintptr_t)pMouse);2555 }2556 2557 /* Virtual USB Keyboard */2558 KeyboardHIDType_T aKbdHID;2559 hrc = pMachine->COMGETTER(KeyboardHIDType)(&aKbdHID); H();2560 if (aKbdHID == KeyboardHIDType_USBKeyboard)2561 {2562 InsertConfigNode(pUsbDevices, "HidKeyboard", &pDev);2563 InsertConfigNode(pDev, "0", &pInst);2564 InsertConfigNode(pInst, "Config", &pCfg);2565 2566 InsertConfigNode(pInst, "LUN#0", &pLunL0);2567 InsertConfigString(pLunL0, "Driver", "KeyboardQueue");2568 InsertConfigNode(pLunL0, "Config", &pCfg);2569 InsertConfigInteger(pCfg, "QueueSize", 64);2570 2571 InsertConfigNode(pLunL0, "AttachedDriver", &pLunL1);2572 InsertConfigString(pLunL1, "Driver", "MainKeyboard");2573 InsertConfigNode(pLunL1, "Config", &pCfg);2574 pKeyboard = mKeyboard;2575 InsertConfigInteger(pCfg, "Object", (uintptr_t)pKeyboard);2576 }2577 2581 } 2578 2582 … … 3345 3349 hrc = Console::convertBusPortDeviceToLun(enmBus, lPort, lDev, uLUN); H(); 3346 3350 3351 if (enmBus == StorageBus_USB) 3352 { 3353 PCFGMNODE pCfg = NULL; 3354 3355 /* Create correct instance. */ 3356 if (!fHotplug && !fAttachDetach) 3357 InsertConfigNode(pCtlInst, Utf8StrFmt("%d", lPort).c_str(), &pCtlInst); 3358 else if (fAttachDetach) 3359 pCtlInst = CFGMR3GetChildF(pCtlInst, "%d/", lPort); 3360 3361 if (!fAttachDetach) 3362 InsertConfigNode(pCtlInst, "Config", &pCfg); 3363 3364 uInstance = lPort; /* Overwrite uInstance with the correct one. */ 3365 3366 if (!fHotplug && !fAttachDetach) 3367 { 3368 char aszUuid[RTUUID_STR_LENGTH + 1]; 3369 USBStorageDevice UsbMsd = USBStorageDevice(); 3370 3371 memset(aszUuid, 0, sizeof(aszUuid)); 3372 rc = RTUuidCreate(&UsbMsd.mUuid); 3373 AssertRCReturn(rc, rc); 3374 rc = RTUuidToStr(&UsbMsd.mUuid, aszUuid, sizeof(aszUuid)); 3375 AssertRCReturn(rc, rc); 3376 3377 UsbMsd.iPort = uInstance; 3378 3379 InsertConfigString(pCtlInst, "UUID", aszUuid); 3380 mUSBStorageDevices.push_back(UsbMsd); 3381 3382 /** @todo: No LED after hotplugging. */ 3383 /* Attach the status driver */ 3384 Assert(cLedUsb >= 8); 3385 attachStatusDriver(pCtlInst, &mapStorageLeds[iLedUsb], 0, 7, 3386 &mapMediumAttachments, pcszDevice, 0); 3387 paLedDevType = &maStorageDevType[iLedUsb]; 3388 } 3389 } 3390 3347 3391 /* First check if the LUN already exists. */ 3348 3392 pLunL0 = CFGMR3GetChildF(pCtlInst, "LUN#%u", uLUN); … … 3377 3421 } 3378 3422 3379 rc = PDMR3DeviceDetach(pUVM, pcszDevice, uInstance, uLUN, fHotplug ? 0 : PDM_TACH_FLAGS_NOT_HOT_PLUG); 3423 if (enmBus == StorageBus_USB) 3424 rc = PDMR3UsbDriverDetach(pUVM, pcszDevice, uInstance, uLUN, NULL, 0, fHotplug ? 0 : PDM_TACH_FLAGS_NOT_HOT_PLUG); 3425 else 3426 rc = PDMR3DeviceDetach(pUVM, pcszDevice, uInstance, uLUN, fHotplug ? 0 : PDM_TACH_FLAGS_NOT_HOT_PLUG); 3380 3427 if (rc == VERR_PDM_NO_DRIVER_ATTACHED_TO_LUN) 3381 3428 rc = VINF_SUCCESS; … … 3420 3467 3421 3468 /* SCSI has a another driver between device and block. */ 3422 if (enmBus == StorageBus_SCSI || enmBus == StorageBus_SAS )3469 if (enmBus == StorageBus_SCSI || enmBus == StorageBus_SAS || enmBus == StorageBus_USB) 3423 3470 { 3424 3471 InsertConfigString(pLunL0, "Driver", "SCSI"); … … 3670 3717 { 3671 3718 /* Attach the new driver. */ 3672 rc = PDMR3DeviceAttach(pUVM, pcszDevice, uInstance, uLUN, 3673 fHotplug ? 0 : PDM_TACH_FLAGS_NOT_HOT_PLUG, NULL /*ppBase*/); 3719 if (enmBus == StorageBus_USB) 3720 { 3721 if (fHotplug) 3722 { 3723 USBStorageDevice UsbMsd = USBStorageDevice(); 3724 RTUuidCreate(&UsbMsd.mUuid); 3725 UsbMsd.iPort = uInstance; 3726 rc = PDMR3UsbCreateEmulatedDevice(pUVM, pcszDevice, pCtlInst, &UsbMsd.mUuid); 3727 if (RT_SUCCESS(rc)) 3728 mUSBStorageDevices.push_back(UsbMsd); 3729 } 3730 else 3731 rc = PDMR3UsbDriverAttach(pUVM, pcszDevice, uInstance, uLUN, 3732 fHotplug ? 0 : PDM_TACH_FLAGS_NOT_HOT_PLUG, NULL /*ppBase*/); 3733 } 3734 else 3735 rc = PDMR3DeviceAttach(pUVM, pcszDevice, uInstance, uLUN, 3736 fHotplug ? 0 : PDM_TACH_FLAGS_NOT_HOT_PLUG, NULL /*ppBase*/); 3674 3737 AssertRCReturn(rc, rc); 3675 3738 -
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r48968 r48983 6381 6381 6382 6382 if ( (aConnectionType <= StorageBus_Null) 6383 || (aConnectionType > StorageBus_ SAS))6383 || (aConnectionType > StorageBus_USB)) 6384 6384 return setError(E_INVALIDARG, 6385 6385 tr("Invalid connection type: %d"), … … 12488 12488 { 12489 12489 case StorageControllerType_IntelAhci: 12490 case StorageControllerType_USB: 12490 12491 return true; 12491 12492 case StorageControllerType_LsiLogic: -
trunk/src/VBox/Main/src-server/StorageControllerImpl.cpp
r44528 r48983 135 135 ComAssertRet(aParent && !aName.isEmpty(), E_INVALIDARG); 136 136 if ( (aStorageBus <= StorageBus_Null) 137 || (aStorageBus > StorageBus_ SAS))137 || (aStorageBus > StorageBus_USB)) 138 138 return setError(E_INVALIDARG, 139 139 tr("Invalid storage connection type")); … … 192 192 m->bd->mPortCount = 8; 193 193 m->bd->mStorageControllerType = StorageControllerType_LsiLogicSas; 194 case StorageBus_USB: 195 m->bd->mPortCount = 8; 196 m->bd->mStorageControllerType = StorageControllerType_USB; 194 197 break; 195 198 } … … 398 401 break; 399 402 } 403 case StorageBus_USB: 404 { 405 if (aControllerType != StorageControllerType_USB) 406 rc = E_INVALIDARG; 407 break; 408 } 400 409 default: 401 410 AssertMsgFailed(("Invalid controller type %d\n", m->bd->mStorageBus)); … … 519 528 } 520 529 case StorageBus_SAS: 530 case StorageBus_USB: 521 531 { 522 532 /* -
trunk/src/VBox/Main/src-server/SystemPropertiesImpl.cpp
r48538 r48983 423 423 case StorageBus_SCSI: 424 424 case StorageBus_SAS: 425 case StorageBus_USB: 425 426 { 426 427 /* SATA and both SCSI controllers only support one device per port. */ … … 475 476 } 476 477 case StorageBus_SAS: 478 case StorageBus_USB: 477 479 { 478 480 *aMinPortCount = 8; … … 518 520 } 519 521 case StorageBus_SAS: 522 case StorageBus_USB: 520 523 { 521 524 *aMaxPortCount = 8; … … 548 551 cCtrs = aChipset == ChipsetType_ICH9 ? 8 : 1; 549 552 break; 553 case StorageBus_USB: 550 554 case StorageBus_IDE: 551 555 case StorageBus_Floppy: … … 578 582 case StorageBus_SCSI: 579 583 case StorageBus_SAS: 584 case StorageBus_USB: 580 585 { 581 586 com::SafeArray<DeviceType_T> saDeviceTypes(2); … … 613 618 case StorageControllerType_IntelAhci: 614 619 case StorageControllerType_LsiLogicSas: 620 case StorageControllerType_USB: 615 621 *aEnabled = false; 616 622 break; -
trunk/src/VBox/Main/xml/Settings.cpp
r48879 r48983 3426 3426 sctl.controllerType = StorageControllerType_LsiLogicSas; 3427 3427 } 3428 else if (strType == "USB") 3429 { 3430 sctl.storageBus = StorageBus_USB; 3431 sctl.controllerType = StorageControllerType_USB; 3432 } 3428 3433 else 3429 3434 throw ConfigFileError(this, pelmController, N_("Invalid value '%s' for StorageController/@type attribute"), strType.c_str()); … … 4854 4859 case StorageControllerType_I82078: pcszType = "I82078"; break; 4855 4860 case StorageControllerType_LsiLogicSas: pcszType = "LsiLogicSas"; break; 4861 case StorageControllerType_USB: pcszType = "USB"; break; 4856 4862 default: /*case StorageControllerType_PIIX3:*/ pcszType = "PIIX3"; break; 4857 4863 }
Note:
See TracChangeset
for help on using the changeset viewer.