Changeset 3494 in vbox
- Timestamp:
- Jul 6, 2007 9:09:32 PM (18 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp
r3387 r3494 336 336 " [-hostifdev<1-N> none|<devicename>]\n" 337 337 " [-intnet<1-N> network]\n" 338 " [-macaddress<1-N> auto|<mac>\n"); 338 " [-macaddress<1-N> auto|<mac>]\n" 339 " [-uart<1-N> off | <I/O base> <IRQ> server|client\n" 340 " <host pipename>\n" 341 ); 339 342 if (fLinux) 340 343 { … … 1037 1040 } 1038 1041 1042 /* get the maximum amount of UARTs */ 1043 ULONG maxUARTs = 0; 1044 sysProps->COMGETTER(NetworkAdapterCount)(&maxUARTs); 1045 for (ULONG currentUART = 0; currentUART < maxUARTs; currentUART++) 1046 { 1047 ComPtr<ISerialPort> uart; 1048 rc = machine->GetSerialPort(currentUART, uart.asOutParam()); 1049 if (SUCCEEDED(rc) && uart) 1050 { 1051 BOOL fEnabled; 1052 uart->COMGETTER(Enabled)(&fEnabled); 1053 if (!fEnabled) 1054 { 1055 RTPrintf("UART %d: disabled\n", currentUART + 1); 1056 } 1057 else 1058 { 1059 ULONG uIRQ, uIOBase; 1060 Bstr pipe; 1061 BOOL fServer; 1062 uart->COMGETTER(Irq)(&uIRQ); 1063 uart->COMGETTER(Iobase)(&uIOBase); 1064 uart->COMGETTER(Pipe)(pipe.asOutParam()); 1065 uart->COMGETTER(Server)(&fServer); 1066 1067 RTPrintf("UART %d: I/O base: 0x%04x, IRQ: %d, %s, pipe '%lS'\n", 1068 currentUART + 1, uIOBase, uIRQ, fServer ? "isServer" : "isClient", 1069 pipe.raw()); 1070 } 1071 } 1072 } 1073 1039 1074 ComPtr<IAudioAdapter> AudioAdapter; 1040 1075 rc = machine->COMGETTER(AudioAdapter)(AudioAdapter.asOutParam()); … … 1071 1106 switch (enmMode) 1072 1107 { 1073 case ClipboardMode_ClipDisabled: psz = " Disabled"; break;1108 case ClipboardMode_ClipDisabled: psz = "disabled"; break; 1074 1109 case ClipboardMode_ClipHostToGuest: psz = "HostToGuest"; break; 1075 1110 case ClipboardMode_ClipGuestToHost: psz = "GuestToHost"; break; … … 1334 1369 * Shared folders 1335 1370 */ 1336 RTPrintf("Shared folders: \n\n");1371 RTPrintf("Shared folders: "); 1337 1372 uint32_t numSharedFolders = 0; 1338 1373 #if 0 // not yet implemented … … 1373 1408 sf->COMGETTER(Name)(name.asOutParam()); 1374 1409 sf->COMGETTER(HostPath)(hostPath.asOutParam()); 1410 if (!numSharedFolders) 1411 RTPrintf("\n\n"); 1375 1412 RTPrintf("Name: '%lS', Host path: '%lS' (machine mapping)\n", name.raw(), hostPath.raw()); 1376 1413 ++numSharedFolders; … … 1394 1431 sf->COMGETTER(Name)(name.asOutParam()); 1395 1432 sf->COMGETTER(HostPath)(hostPath.asOutParam()); 1433 if (!numSharedFolders) 1434 RTPrintf("\n\n"); 1396 1435 RTPrintf("Name: '%lS', Host path: '%lS' (transient mapping)\n", name.raw(), hostPath.raw()); 1397 1436 ++numSharedFolders; … … 2701 2740 2702 2741 /** 2703 * Parses a NICnumber.2742 * Parses a number. 2704 2743 * 2705 * @returns Valid n ic number on success.2706 * @returns 0 if invalid n ic. All necesary bitching has been done.2744 * @returns Valid number on success. 2745 * @returns 0 if invalid number. All necesary bitching has been done. 2707 2746 * @param psz Pointer to the nic number. 2708 2747 */ 2709 static unsigned parseN icNum(const char *psz, unsigned cMaxNics)2748 static unsigned parseNum(const char *psz, unsigned cMaxNum, const char *name) 2710 2749 { 2711 2750 uint32_t u32; … … 2715 2754 && *pszNext == '\0' 2716 2755 && u32 >= 1 2717 && u32 <= cMaxN ics)2756 && u32 <= cMaxNum) 2718 2757 return (unsigned)u32; 2719 errorArgument("Invalid NIC number '%s'", psz);2758 errorArgument("Invalid %s number '%s'", name, psz); 2720 2759 return 0; 2721 2760 } … … 2770 2809 CHECK_ERROR_RET (info, COMGETTER(NetworkAdapterCount) (&NetworkAdapterCount), 1); 2771 2810 } 2811 ULONG SerialPortCount = 0; 2812 { 2813 ComPtr <ISystemProperties> info; 2814 CHECK_ERROR_RET (virtualBox, COMGETTER(SystemProperties) (info.asOutParam()), 1); 2815 CHECK_ERROR_RET (info, COMGETTER(SerialPortCount) (&SerialPortCount), 1); 2816 } 2772 2817 2773 2818 std::vector <char *> nics (NetworkAdapterCount, 0); … … 2783 2828 #endif 2784 2829 std::vector <char *> macs (NetworkAdapterCount, 0); 2830 std::vector <ULONG> uarts_base (SerialPortCount, 0); 2831 std::vector <ULONG> uarts_irq (SerialPortCount, 0); 2832 std::vector <char *> uarts_pipe (SerialPortCount, 0); 2833 std::vector <char *> uarts_server (SerialPortCount, 0); 2785 2834 2786 2835 for (int i = 1; i < argc; i++) … … 3028 3077 else if (strncmp(argv[i], "-cableconnected", 15) == 0) 3029 3078 { 3030 unsigned n = parseN icNum(&argv[i][15], NetworkAdapterCount);3079 unsigned n = parseNum(&argv[i][15], NetworkAdapterCount, "NIC"); 3031 3080 if (!n) 3032 3081 return 1; … … 3041 3090 else if (strncmp(argv[i], "-nictracefile", 13) == 0) 3042 3091 { 3043 unsigned n = parseN icNum(&argv[i][13], NetworkAdapterCount);3092 unsigned n = parseNum(&argv[i][13], NetworkAdapterCount, "NIC"); 3044 3093 if (!n) 3045 3094 return 1; … … 3053 3102 else if (strncmp(argv[i], "-nictrace", 9) == 0) 3054 3103 { 3055 unsigned n = parseN icNum(&argv[i][9], NetworkAdapterCount);3104 unsigned n = parseNum(&argv[i][9], NetworkAdapterCount, "NIC"); 3056 3105 if (!n) 3057 3106 return 1; … … 3065 3114 else if (strncmp(argv[i], "-nictype", 8) == 0) 3066 3115 { 3067 unsigned n = parseN icNum(&argv[i][8], NetworkAdapterCount);3116 unsigned n = parseNum(&argv[i][8], NetworkAdapterCount, "NIC"); 3068 3117 if (!n) 3069 3118 return 1; … … 3077 3126 else if (strncmp(argv[i], "-nic", 4) == 0) 3078 3127 { 3079 unsigned n = parseN icNum(&argv[i][4], NetworkAdapterCount);3128 unsigned n = parseNum(&argv[i][4], NetworkAdapterCount, "NIC"); 3080 3129 if (!n) 3081 3130 return 1; … … 3089 3138 else if (strncmp(argv[i], "-hostifdev", 10) == 0) 3090 3139 { 3091 unsigned n = parseN icNum(&argv[i][10], NetworkAdapterCount);3140 unsigned n = parseNum(&argv[i][10], NetworkAdapterCount, "NIC"); 3092 3141 if (!n) 3093 3142 return 1; … … 3101 3150 else if (strncmp(argv[i], "-intnet", 7) == 0) 3102 3151 { 3103 unsigned n = parseN icNum(&argv[i][7], NetworkAdapterCount);3152 unsigned n = parseNum(&argv[i][7], NetworkAdapterCount, "NIC"); 3104 3153 if (!n) 3105 3154 return 1; … … 3114 3163 else if (strncmp(argv[i], "-tapsetup", 9) == 0) 3115 3164 { 3116 unsigned n = parseN icNum(&argv[i][9], NetworkAdapterCount);3165 unsigned n = parseNum(&argv[i][9], NetworkAdapterCount, "NIC"); 3117 3166 if (!n) 3118 3167 return 1; … … 3126 3175 else if (strncmp(argv[i], "-tapterminate", 13) == 0) 3127 3176 { 3128 unsigned n = parseN icNum(&argv[i][13], NetworkAdapterCount);3177 unsigned n = parseNum(&argv[i][13], NetworkAdapterCount, "NIC"); 3129 3178 if (!n) 3130 3179 return 1; … … 3139 3188 else if (strncmp(argv[i], "-macaddress", 11) == 0) 3140 3189 { 3141 unsigned n = parseN icNum(&argv[i][11], NetworkAdapterCount);3190 unsigned n = parseNum(&argv[i][11], NetworkAdapterCount, "NIC"); 3142 3191 if (!n) 3143 3192 return 1; … … 3221 3270 i++; 3222 3271 snapshotFolder = argv[i]; 3272 } 3273 else if (strncmp(argv[i], "-uart", 5) == 0) 3274 { 3275 unsigned n = parseNum(&argv[i][5], SerialPortCount, "UART"); 3276 if (!n) 3277 return 1; 3278 if (argc <= i + 1) 3279 { 3280 return errorArgument("Missing argument to '%s'", argv[i]); 3281 } 3282 i++; 3283 if (strcmp(argv[i], "off") == 0 || strcmp(argv[i], "disable") == 0) 3284 { 3285 uarts_base[n - 1] = (ULONG)-1; 3286 } 3287 else 3288 { 3289 if (argc <= i + 2) 3290 { 3291 return errorArgument("Missing argument to '%s'", argv[i-1]); 3292 } 3293 uint32_t uVal; 3294 int vrc; 3295 vrc = RTStrToUInt32Ex(argv[i], NULL, 0, &uVal); 3296 if (vrc != VINF_SUCCESS || uVal == 0) 3297 return errorArgument("Error parsing UART I/O base '%s'", argv[i]); 3298 uarts_base[n - 1] = uVal; 3299 i++; 3300 vrc = RTStrToUInt32Ex(argv[i], NULL, 0, &uVal); 3301 if (vrc != VINF_SUCCESS) 3302 return errorArgument("Error parsing UART IRQ '%s'", argv[i]); 3303 uarts_irq[n - 1] = uVal; 3304 i++; 3305 if (strcmp(argv[i], "server") && strcmp(argv[i], "client")) 3306 return errorArgument("Third UART argument must be 'client' or 'server'"); 3307 uarts_server[n - 1] = argv[i]; 3308 i++; 3309 #ifdef __WIN__ 3310 if (strncmp(argv[i], "\\\\.\\pipe\\", 9)) 3311 return errorArgument("Uart pipe must start with \\\\.\\pipe\\"); 3312 #endif 3313 uarts_pipe[n - 1] = argv[i]; 3314 } 3223 3315 } 3224 3316 else … … 3945 4037 if (FAILED(rc)) 3946 4038 break; 4039 4040 /* iterate through all possible serial ports */ 4041 for (ULONG n = 0; n < SerialPortCount; n ++) 4042 { 4043 ComPtr<ISerialPort> uart; 4044 CHECK_ERROR_RET (machine, GetSerialPort (n, uart.asOutParam()), 1); 4045 4046 ASSERT(uart); 4047 4048 /* something about the NIC? */ 4049 if (uarts_base[n]) 4050 { 4051 if (uarts_base[n] == (ULONG)-1) 4052 { 4053 CHECK_ERROR_RET(uart, COMSETTER(Enabled) (FALSE), 1); 4054 } 4055 else 4056 { 4057 CHECK_ERROR_RET(uart, COMSETTER(Iobase) (uarts_base[n]), 1); 4058 CHECK_ERROR_RET(uart, COMSETTER(Irq) (uarts_irq[n]), 1); 4059 CHECK_ERROR_RET(uart, COMSETTER(Pipe) (Bstr(uarts_pipe[n])), 1); 4060 CHECK_ERROR_RET(uart, COMSETTER(Server) 4061 (0 == strcmp(uarts_server[n], "server")), 1); 4062 CHECK_ERROR_RET(uart, COMSETTER(Enabled) (TRUE), 1); 4063 } 4064 } 4065 } 4066 if (FAILED(rc)) 4067 break; 4068 3947 4069 #ifdef VBOX_VRDP 3948 4070 if (vrdp || (vrdpport != UINT16_MAX) || vrdpaddress || vrdpauthtype || vrdpmulticon) … … 4219 4341 CHECK_ERROR_BREAK (info, COMGETTER(NetworkAdapterCount) (&NetworkAdapterCount)); 4220 4342 4221 unsigned n = parseN icNum(&argv[1][12], NetworkAdapterCount);4343 unsigned n = parseNum(&argv[1][12], NetworkAdapterCount, "NIC"); 4222 4344 if (!n) 4223 4345 { -
trunk/src/VBox/Main/ConsoleImpl.cpp
r3481 r3494 3021 3021 LogFlowThisFunc (("Leaving rc=%#x\n", rc)); 3022 3022 return rc; 3023 } 3024 3025 /** 3026 * Called by IInternalSessionControl::OnSerialPortChange(). 3027 * 3028 * @note Locks this object for writing. 3029 */ 3030 HRESULT Console::onSerialPortChange(ISerialPort *serialPort) 3031 { 3032 LogFlowThisFunc (("\n")); 3033 3034 AutoCaller autoCaller (this); 3035 AssertComRCReturnRC (autoCaller.rc()); 3036 3037 AutoLock alock (this); 3038 3039 /* Don't do anything if the VM isn't running */ 3040 if (!mpVM) 3041 return S_OK; 3042 3043 /* protect mpVM */ 3044 AutoVMCaller autoVMCaller (this); 3045 CheckComRCReturnRC (autoVMCaller.rc()); 3046 3047 LogFlowThisFunc (("Leaving rc=%#x\n", S_OK)); 3048 return S_OK; 3023 3049 } 3024 3050 … … 4516 4542 PCFGMNODE pLunL0 = NULL; /* /Devices/Dev/0/LUN#0/ */ 4517 4543 PCFGMNODE pLunL1 = NULL; /* /Devices/Dev/0/LUN#0/AttachedDriver/ */ 4544 PCFGMNODE pLunL2 = NULL; /* /Devices/Dev/0/LUN#0/AttachedDriver/Config/ */ 4545 4518 4546 rc = CFGMR3InsertNode(pRoot, "Devices", &pDevices); RC_CHECK(); 4519 4547 … … 4805 4833 rc = CFGMR3InsertNode(pInst, "Config", &pCfg); RC_CHECK(); 4806 4834 4807 #if 04808 /*4809 * Serial ports4810 */4811 rc = CFGMR3InsertNode(pDevices, "serial", &pDev); RC_CHECK();4812 rc = CFGMR3InsertNode(pDev, "0", &pInst); RC_CHECK();4813 rc = CFGMR3InsertNode(pInst, "Config", &pCfg); RC_CHECK();4814 rc = CFGMR3InsertInteger(pCfg, "IRQ", 4); RC_CHECK();4815 rc = CFGMR3InsertInteger(pCfg, "IOBase", 0x3f8); RC_CHECK();4816 4817 rc = CFGMR3InsertNode(pDev, "1", &pInst); RC_CHECK();4818 rc = CFGMR3InsertNode(pInst, "Config", &pCfg); RC_CHECK();4819 rc = CFGMR3InsertInteger(pCfg, "IRQ", 3); RC_CHECK();4820 rc = CFGMR3InsertInteger(pCfg, "IOBase", 0x2f8); RC_CHECK();4821 #endif4822 4823 4835 /* 4824 4836 * VGA. … … 5040 5052 5041 5053 /* The iSCSI initiator needs an attached iSCSI transport driver. */ 5042 PCFGMNODE pLunL2 = NULL; /* /Devices/Dev/0/LUN#0/AttachedDriver/AttachedDriver */5043 5054 rc = CFGMR3InsertNode(pLunL1, "AttachedDriver", &pLunL2); RC_CHECK(); 5044 5055 rc = CFGMR3InsertString(pLunL2, "Driver", "iSCSITCP"); RC_CHECK(); … … 5349 5360 5350 5361 /* 5362 * Serial (UART) Ports 5363 */ 5364 rc = CFGMR3InsertNode(pDevices, "serial", &pDev); RC_CHECK(); 5365 for (ULONG ulInstance = 0; ulInstance < SchemaDefs::SerialPortCount; ulInstance++) 5366 { 5367 ComPtr<ISerialPort> serialPort; 5368 hrc = pMachine->GetSerialPort (ulInstance, serialPort.asOutParam()); H(); 5369 BOOL fEnabled = FALSE; 5370 if (serialPort) 5371 hrc = serialPort->COMGETTER(Enabled)(&fEnabled); H(); 5372 if (!fEnabled) 5373 continue; 5374 5375 char szInstance[4]; Assert(ulInstance <= 999); 5376 RTStrPrintf(szInstance, sizeof(szInstance), "%lu", ulInstance); 5377 5378 rc = CFGMR3InsertNode(pDev, szInstance, &pInst); RC_CHECK(); 5379 rc = CFGMR3InsertNode(pInst, "Config", &pCfg); RC_CHECK(); 5380 5381 ULONG uIRQ, uIOBase; 5382 Bstr pipe; 5383 BOOL fServer; 5384 hrc = serialPort->COMGETTER(Irq)(&uIRQ); H(); 5385 hrc = serialPort->COMGETTER(Iobase)(&uIOBase); H(); 5386 hrc = serialPort->COMGETTER(Pipe)(pipe.asOutParam()); H(); 5387 hrc = serialPort->COMGETTER(Server)(&fServer); H(); 5388 rc = CFGMR3InsertInteger(pCfg, "IRQ", uIRQ); RC_CHECK(); 5389 rc = CFGMR3InsertInteger(pCfg, "IOBase", uIOBase); RC_CHECK(); 5390 rc = CFGMR3InsertNode(pInst, "LUN#0", &pLunL0); RC_CHECK(); 5391 rc = CFGMR3InsertString(pLunL0, "Driver", "Char"); RC_CHECK(); 5392 rc = CFGMR3InsertNode(pLunL0, "AttachedDriver", &pLunL1); RC_CHECK(); 5393 rc = CFGMR3InsertString(pLunL1, "Driver", "NamedPipe"); RC_CHECK(); 5394 rc = CFGMR3InsertNode(pLunL1, "Config", &pLunL2); RC_CHECK(); 5395 rc = CFGMR3InsertString(pLunL2, "Location", Utf8Str(pipe)); RC_CHECK(); 5396 rc = CFGMR3InsertInteger(pLunL2, "IsServer", fServer); RC_CHECK(); 5397 } 5398 5399 /* 5351 5400 * VMM Device 5352 5401 */ -
trunk/src/VBox/Main/MachineImpl.cpp
r3480 r3494 452 452 unconst (mFloppyDrive).createObject(); 453 453 mFloppyDrive->init (this); 454 455 /* create associated serial port objects */ 456 for (ULONG slot = 0; slot < ELEMENTS (mSerialPorts); slot ++) 457 { 458 unconst (mSerialPorts [slot]).createObject(); 459 mSerialPorts [slot]->init (this, slot); 460 } 454 461 455 462 /* create the audio adapter object (always present, default is disabled) */ … … 1814 1821 } 1815 1822 1823 STDMETHODIMP Machine::GetSerialPort (ULONG slot, ISerialPort **port) 1824 { 1825 if (!port) 1826 return E_POINTER; 1827 if (slot >= ELEMENTS (mSerialPorts)) 1828 return setError (E_INVALIDARG, tr ("Invalid slot number: %d"), slot); 1829 1830 AutoCaller autoCaller (this); 1831 CheckComRCReturnRC (autoCaller.rc()); 1832 1833 AutoReaderLock alock (this); 1834 1835 mSerialPorts [slot].queryInterfaceTo (port); 1836 1837 return S_OK; 1838 } 1839 1816 1840 STDMETHODIMP Machine::GetNetworkAdapter (ULONG slot, INetworkAdapter **adapter) 1817 1841 { … … 3226 3250 } 3227 3251 3252 for (ULONG slot = 0; slot < ELEMENTS (mSerialPorts); slot ++) 3253 { 3254 if (mSerialPorts [slot]) 3255 { 3256 mSerialPorts [slot]->uninit(); 3257 unconst (mSerialPorts [slot]).setNull(); 3258 } 3259 } 3260 3228 3261 if (mFloppyDrive) 3229 3262 { … … 4236 4269 if (FAILED (rc)) 4237 4270 return rc; 4271 } 4272 4273 /* Serial node (optional) */ 4274 CFGNODE serialNode = 0; 4275 CFGLDRGetChildNode (aNode, "Uart", 0, &serialNode); 4276 if (serialNode) 4277 { 4278 HRESULT rc = S_OK; 4279 unsigned cPorts = 0; 4280 CFGLDRCountChildren (serialNode, "Port", &cPorts); 4281 for (unsigned slot = 0; slot < cPorts; slot++) 4282 { 4283 rc = mSerialPorts [slot]->loadSettings (serialNode, slot); 4284 CheckComRCReturnRC (rc); 4285 } 4286 CFGLDRReleaseNode (serialNode); 4238 4287 } 4239 4288 … … 6036 6085 return rc; 6037 6086 6087 /* Serial ports */ 6088 CFGNODE serialNode = 0; 6089 CFGLDRCreateChildNode (aNode, "Uart", &serialNode); 6090 6091 for (ULONG slot = 0; slot < ELEMENTS (mSerialPorts); slot++) 6092 { 6093 rc = mSerialPorts [slot]->saveSettings (serialNode); 6094 CheckComRCReturnRC (rc); 6095 } 6096 CFGLDRReleaseNode (serialNode); 6097 6038 6098 /* Audio adapter */ 6039 6099 do … … 7080 7140 return true; 7081 7141 7142 for (ULONG slot = 0; slot < ELEMENTS (mSerialPorts); slot ++) 7143 if (mSerialPorts [slot] && mSerialPorts [slot]->isModified()) 7144 return true; 7145 7082 7146 return 7083 7147 mUserData.isBackedUp() || … … 7111 7175 for (ULONG slot = 0; slot < ELEMENTS (mNetworkAdapters); slot ++) 7112 7176 if (mNetworkAdapters [slot] && mNetworkAdapters [slot]->isReallyModified()) 7177 return true; 7178 7179 for (ULONG slot = 0; slot < ELEMENTS (mSerialPorts); slot ++) 7180 if (mSerialPorts [slot] && mSerialPorts [slot]->isReallyModified()) 7113 7181 return true; 7114 7182 … … 7152 7220 usbChanged = false; 7153 7221 ComPtr <INetworkAdapter> networkAdapters [ELEMENTS (mNetworkAdapters)]; 7222 ComPtr <ISerialPort> serialPorts [ELEMENTS (mSerialPorts)]; 7154 7223 7155 7224 if (mBIOSSettings) … … 7177 7246 if (mNetworkAdapters [slot]->rollback()) 7178 7247 networkAdapters [slot] = mNetworkAdapters [slot]; 7248 7249 for (ULONG slot = 0; slot < ELEMENTS (mSerialPorts); slot ++) 7250 if (mSerialPorts [slot]) 7251 if (mSerialPorts [slot]->rollback()) 7252 serialPorts [slot] = mSerialPorts [slot]; 7179 7253 7180 7254 if (aNotify) … … 7196 7270 if (networkAdapters [slot]) 7197 7271 that->onNetworkAdapterChange (networkAdapters [slot]); 7272 for (ULONG slot = 0; slot < ELEMENTS (serialPorts); slot ++) 7273 if (serialPorts [slot]) 7274 that->onSerialPortChange (serialPorts [slot]); 7198 7275 } 7199 7276 } … … 7242 7319 for (ULONG slot = 0; slot < ELEMENTS (mNetworkAdapters); slot ++) 7243 7320 mNetworkAdapters [slot]->commit(); 7321 for (ULONG slot = 0; slot < ELEMENTS (mSerialPorts); slot ++) 7322 mSerialPorts [slot]->commit(); 7244 7323 7245 7324 if (mType == IsSessionMachine) … … 7303 7382 for (ULONG slot = 0; slot < ELEMENTS (mNetworkAdapters); slot ++) 7304 7383 mNetworkAdapters [slot]->copyFrom (aThat->mNetworkAdapters [slot]); 7384 for (ULONG slot = 0; slot < ELEMENTS (mSerialPorts); slot ++) 7385 mSerialPorts [slot]->copyFrom (aThat->mSerialPorts [slot]); 7305 7386 } 7306 7387 … … 7483 7564 unconst (mAudioAdapter).createObject(); 7484 7565 mAudioAdapter->init (this, aMachine->mAudioAdapter); 7566 /* create a list of serial ports that will be mutable */ 7567 for (ULONG slot = 0; slot < ELEMENTS (mSerialPorts); slot ++) 7568 { 7569 unconst (mSerialPorts [slot]).createObject(); 7570 mSerialPorts [slot]->init (this, aMachine->mSerialPorts [slot]); 7571 } 7485 7572 /* create another USB controller object that will be mutable */ 7486 7573 unconst (mUSBController).createObject(); … … 8626 8713 * @note Locks this object for reading. 8627 8714 */ 8715 HRESULT SessionMachine::onSerialPortChange(ISerialPort *serialPort) 8716 { 8717 LogFlowThisFunc (("\n")); 8718 8719 AutoCaller autoCaller (this); 8720 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 8721 8722 ComPtr <IInternalSessionControl> directControl; 8723 { 8724 AutoReaderLock alock (this); 8725 directControl = mData->mSession.mDirectControl; 8726 } 8727 8728 /* ignore notifications sent after #OnSessionEnd() is called */ 8729 if (!directControl) 8730 return S_OK; 8731 8732 return directControl->OnSerialPortChange(serialPort); 8733 } 8734 8735 /** 8736 * @note Locks this object for reading. 8737 */ 8628 8738 HRESULT SessionMachine::onVRDPServerChange() 8629 8739 { … … 9939 10049 } 9940 10050 10051 for (ULONG slot = 0; slot < ELEMENTS (mSerialPorts); slot ++) 10052 { 10053 unconst (mSerialPorts [slot]).createObject(); 10054 mSerialPorts [slot]->initCopy (this, mPeer->mSerialPorts [slot]); 10055 } 10056 9941 10057 /* Confirm a successful initialization when it's the case */ 9942 10058 autoInitSpan.setSucceeded(); … … 10023 10139 } 10024 10140 10141 for (ULONG slot = 0; slot < ELEMENTS (mSerialPorts); slot ++) 10142 { 10143 unconst (mSerialPorts [slot]).createObject(); 10144 mSerialPorts [slot]->init (this, slot); 10145 } 10146 10025 10147 /* load hardware and harddisk settings */ 10026 10148 -
trunk/src/VBox/Main/Makefile.kmk
r3480 r3494 181 181 GuestOSTypeImpl.cpp \ 182 182 NetworkAdapterImpl.cpp \ 183 SerialPortImpl.cpp \ 183 184 USBControllerImpl.cpp \ 184 185 AudioAdapterImpl.cpp \ -
trunk/src/VBox/Main/SessionImpl.cpp
r3480 r3494 537 537 538 538 return mConsole->onNetworkAdapterChange(networkAdapter); 539 } 540 541 STDMETHODIMP Session::OnSerialPortChange(ISerialPort *serialPort) 542 { 543 LogFlowThisFunc (("\n")); 544 545 AutoCaller autoCaller (this); 546 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 547 548 AutoReaderLock alock (this); 549 AssertReturn (mState == SessionState_SessionOpen && 550 mType == SessionType_DirectSession, E_FAIL); 551 552 return mConsole->onSerialPortChange(serialPort); 539 553 } 540 554 -
trunk/src/VBox/Main/SystemPropertiesImpl.cpp
r2981 r3494 190 190 } 191 191 192 STDMETHODIMP SystemProperties::COMGETTER(SerialPortCount)(ULONG *count) 193 { 194 if (!count) 195 return E_POINTER; 196 AutoLock lock (this); 197 CHECK_READY(); 198 199 *count = SchemaDefs::SerialPortCount; 200 201 return S_OK; 202 } 192 203 193 204 STDMETHODIMP SystemProperties::COMGETTER(MaxBootPosition)(ULONG *aMaxBootPosition) -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r3297 r3494 2438 2438 </method> 2439 2439 2440 <method name="getSerialPort" const="yes"> 2441 <desc> 2442 Returns the serial port associated with the given slot. 2443 Slots are numbered sequentially, starting with zero. The total 2444 number of serial ports per every machine is defined by the 2445 <link to="ISystemProperties::serialPortCount"/> property, 2446 so the maximum slot number is one less than that property's value. 2447 </desc> 2448 <param name="slot" type="unsigned long" dir="in"/> 2449 <param name="port" type="ISerialPort" dir="return"/> 2450 </method> 2451 2440 2452 <method name="getNextExtraDataKey"> 2441 2453 <desc> … … 3951 3963 </attribute> 3952 3964 3965 <attribute name="serialPortCount" type="unsigned long" readonly="yes"> 3966 <desc> 3967 Number of serial ports associated with every 3968 <link to="IMachine"/> instance. 3969 </desc> 3970 </attribute> 3971 3953 3972 <attribute name="maxBootPosition" type="unsigned long" readonly="yes"> 3954 3973 <desc> … … 6639 6658 6640 6659 <!-- 6660 // ISerialPort 6661 ///////////////////////////////////////////////////////////////////////// 6662 --> 6663 6664 <interface 6665 name="ISerialPort" extends="$unknown" 6666 uuid="924107d2-1cac-4fc8-93be-e2d54f78dc67" 6667 wsmap="managed" 6668 > 6669 6670 <attribute name="slot" type="unsigned long" readonly="yes"> 6671 <desc> 6672 Slot number this serial port is plugged into. Corresponds to 6673 the value you pass to <link to="IMachine::getSerialPort"/> 6674 to obtain this instance. 6675 </desc> 6676 </attribute> 6677 6678 <attribute name="enabled" type="boolean"> 6679 <desc> 6680 Flag whether the serial port is enabled. If it is disabled, 6681 the serial port will not be reported to the guest. 6682 </desc> 6683 </attribute> 6684 6685 <attribute name="iobase" type="unsigned long"> 6686 <desc>Gets the I/O base of the serial port.</desc> 6687 </attribute> 6688 6689 <attribute name="irq" type="unsigned long"> 6690 <desc>Gets the IRQ of the serial port.</desc> 6691 </attribute> 6692 6693 <attribute name="pipe" type="wstring"> 6694 <desc>Gets the name of the host pipe connected to the serial port.</desc> 6695 </attribute> 6696 6697 <attribute name="server" type="boolean"> 6698 <desc>Flag whether this serial port acts as a server or a client.</desc> 6699 </attribute> 6700 6701 </interface> 6702 6703 6704 <!-- 6641 6705 // IMachineDebugger 6642 6706 ///////////////////////////////////////////////////////////////////////// … … 7595 7659 </method> 7596 7660 7661 <method name="onSerialPortChange"> 7662 <desc> 7663 Triggered when settions of a serial port of the 7664 associated virtual machine have changed. 7665 </desc> 7666 <param name="serialPort" type="ISerialPort" dir="in"/> 7667 </method> 7668 7597 7669 <method name="onVRDPServerChange"> 7598 7670 <desc> -
trunk/src/VBox/Main/include/ConsoleImpl.h
r3288 r3494 172 172 HRESULT onFloppyDriveChange(); 173 173 HRESULT onNetworkAdapterChange(INetworkAdapter *networkAdapter); 174 HRESULT onSerialPortChange(ISerialPort *serialPort); 174 175 HRESULT onVRDPServerChange(); 175 176 HRESULT onUSBControllerChange(); -
trunk/src/VBox/Main/include/MachineImpl.h
r3480 r3494 34 34 #include "NetworkAdapterImpl.h" 35 35 #include "AudioAdapterImpl.h" 36 #include "SerialPortImpl.h" 36 37 #include "BIOSSettingsImpl.h" 37 38 … … 480 481 STDMETHOD(GetHardDisk)(DiskControllerType_T aCtl, LONG aDev, IHardDisk **aHardDisk); 481 482 STDMETHOD(DetachHardDisk) (DiskControllerType_T aCtl, LONG aDev); 483 STDMETHOD(GetSerialPort) (ULONG slot, ISerialPort **port); 482 484 STDMETHOD(GetNetworkAdapter) (ULONG slot, INetworkAdapter **adapter); 483 485 STDMETHOD(GetNextExtraDataKey)(INPTR BSTR aKey, BSTR *aNextKey, BSTR *aNextValue); … … 526 528 virtual HRESULT onFloppyDriveChange() { return S_OK; } 527 529 virtual HRESULT onNetworkAdapterChange(INetworkAdapter *networkAdapter) { return S_OK; } 530 virtual HRESULT onSerialPortChange(ISerialPort *serialPort) { return S_OK; } 528 531 virtual HRESULT onVRDPServerChange() { return S_OK; } 529 532 virtual HRESULT onUSBControllerChange() { return S_OK; } … … 675 678 const ComObjPtr <DVDDrive> mDVDDrive; 676 679 const ComObjPtr <FloppyDrive> mFloppyDrive; 680 const ComObjPtr <SerialPort> 681 mSerialPorts [SchemaDefs::SerialPortCount]; 677 682 const ComObjPtr <AudioAdapter> mAudioAdapter; 678 683 const ComObjPtr <USBController> mUSBController; 679 684 const ComObjPtr <BIOSSettings> mBIOSSettings; 680 681 685 const ComObjPtr <NetworkAdapter> 682 686 mNetworkAdapters [SchemaDefs::NetworkAdapterCount]; … … 766 770 HRESULT onFloppyDriveChange(); 767 771 HRESULT onNetworkAdapterChange(INetworkAdapter *networkAdapter); 772 HRESULT onSerialPortChange(ISerialPort *serialPort); 768 773 HRESULT onVRDPServerChange(); 769 774 HRESULT onUSBControllerChange(); -
trunk/src/VBox/Main/include/SessionImpl.h
r3480 r3494 98 98 STDMETHOD(OnFloppyDriveChange)(); 99 99 STDMETHOD(OnNetworkAdapterChange)(INetworkAdapter *networkAdapter); 100 STDMETHOD(OnSerialPortChange)(ISerialPort *serialPort); 100 101 STDMETHOD(OnVRDPServerChange)(); 101 102 STDMETHOD(OnUSBControllerChange)(); -
trunk/src/VBox/Main/include/SystemPropertiesImpl.h
r2981 r3494 63 63 STDMETHOD(COMGETTER(MaxVDISize)(ULONG64 *maxVDISize)); 64 64 STDMETHOD(COMGETTER(NetworkAdapterCount)(ULONG *count)); 65 STDMETHOD(COMGETTER(SerialPortCount)(ULONG *count)); 65 66 STDMETHOD(COMGETTER(MaxBootPosition)(ULONG *aMaxBootPosition)); 66 67 STDMETHOD(COMGETTER(DefaultVDIFolder)) (BSTR *aDefaultVDIFolder); -
trunk/src/VBox/Main/linux/server.cpp
r3388 r3494 97 97 #include <GuestOSTypeImpl.h> 98 98 #include <NetworkAdapterImpl.h> 99 #include <SerialPortImpl.h> 99 100 #include <USBControllerImpl.h> 100 101 #include <USBDeviceImpl.h> … … 152 153 NS_DECL_CLASSINFO(NetworkAdapter) 153 154 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(NetworkAdapter, INetworkAdapter) 155 NS_DECL_CLASSINFO(SerialPort) 156 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(SerialPort, ISerialPort) 154 157 NS_DECL_CLASSINFO(USBController) 155 158 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(USBController, IUSBController) -
trunk/src/VBox/Main/xml/SchemaDefs.xsl
r2988 r3494 137 137 </xsl:call-template> 138 138 <xsl:call-template name="defineEnumMember"> 139 <xsl:with-param name="member" select="' SerialPortCount'"/> 140 <xsl:with-param name="select" select=" 141 xsd:complexType[@name='TUartPort']/xsd:attribute[@name='slot']//xsd:maxExclusive/@value 142 "/> 143 </xsl:call-template> 144 <xsl:call-template name="defineEnumMember"> 139 145 <xsl:with-param name="member" select="' MaxBootPosition'"/> 140 146 <xsl:with-param name="select" select=" -
trunk/src/VBox/Main/xml/VirtualBox-settings-common.xsd
r2988 r3494 515 515 </xsd:complexType> 516 516 517 <xsd:complexType name="TUartPort"> 518 <xsd:attribute name="slot" use="required"> 519 <xsd:simpleType> 520 <xsd:restriction base="xsd:unsignedInt"> 521 <xsd:minInclusive value="0"/> 522 <xsd:maxExclusive value="2"/> 523 </xsd:restriction> 524 </xsd:simpleType> 525 </xsd:attribute> 526 <xsd:attribute name="enabled" type="xsd:boolean" use="required"/> 527 <xsd:attribute name="IRQ" type="xsd:unsignedInt" default="4"/> 528 <xsd:attribute name="IOBase" type="xsd:unsignedInt" default="1016"/> 529 <xsd:attribute name="pipe" type="xsd:string"/> 530 <xsd:attribute name="server" type="xsd:boolean"/> 531 </xsd:complexType> 532 533 <xsd:complexType name="TUart"> 534 <xsd:sequence> 535 <xsd:element name="Port" minOccurs="0" maxOccurs="unbounded"> 536 <xsd:complexType> 537 <xsd:complexContent> 538 <xsd:extension base="TUartPort"> 539 </xsd:extension> 540 </xsd:complexContent> 541 </xsd:complexType> 542 </xsd:element> 543 </xsd:sequence> 544 </xsd:complexType> 545 517 546 <xsd:complexType name="TSharedFolder"> 518 547 <xsd:attribute name="name" type="TNonEmptyString" use="required"/> … … 549 578 <xsd:unique name="THardware-Network-Adapter"> 550 579 <xsd:selector xpath="vb:Adapter"/> 580 <xsd:field xpath="@slot"/> 581 </xsd:unique> 582 </xsd:element> 583 <xsd:element name="Uart" type="TUart" minOccurs="0"> 584 <xsd:unique name="THardware-Uart-Port"> 585 <xsd:selector xpath="vb:Port"/> 551 586 <xsd:field xpath="@slot"/> 552 587 </xsd:unique>
Note:
See TracChangeset
for help on using the changeset viewer.