Changeset 4269 in vbox
- Timestamp:
- Aug 21, 2007 9:39:48 PM (18 years ago)
- svn:sync-xref-src-repo-rev:
- 23779
- Location:
- trunk/src/VBox
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp
r4127 r4269 332 332 " [-nictracefile<1-N> <filename>]\n" 333 333 " [-hostifdev<1-N> none|<devicename>]\n" 334 " [-intnet<1-N> network]\n"334 " [-intnet<1-N> <network>]\n" 335 335 " [-macaddress<1-N> auto|<mac>]\n" 336 " [-uart<1-N> off | <I/O base> <IRQ> server|client\n" 337 " <host pipename>]\n" 336 " [-uart<1-N> off|<I/O base> <IRQ>]\n" 337 " [-uartmode<1-N> server|client <pipe name>|\n" 338 " <device name>]\n" 338 339 ); 339 340 if (fLinux) … … 1054 1055 else 1055 1056 { 1056 ULONG uIRQ, uIOBase ;1057 Bstr p ipe;1057 ULONG uIRQ, uIOBase, uHostMode; 1058 Bstr path; 1058 1059 BOOL fServer; 1059 1060 uart->COMGETTER(IRQ)(&uIRQ); 1060 1061 uart->COMGETTER(IOBase)(&uIOBase); 1061 uart->COMGETTER(P ipe)(pipe.asOutParam());1062 uart->COMGETTER(Path)(path.asOutParam()); 1062 1063 uart->COMGETTER(Server)(&fServer); 1063 1064 RTPrintf("UART %d: I/O base: 0x%04x, IRQ: %d, %s, pipe '%lS'\n", 1065 currentUART + 1, uIOBase, uIRQ, fServer ? "isServer" : "isClient", 1066 pipe.raw()); 1064 uart->COMGETTER(HostMode)(&uHostMode); 1065 1066 RTPrintf("UART %d: I/O base: 0x%04x, IRQ: %d", 1067 currentUART + 1, uIOBase, uIRQ); 1068 switch (uHostMode) 1069 { 1070 default: 1071 case SerialHostMode_Disconnected: 1072 RTPrintf(", disconnected\n"); 1073 break; 1074 case SerialHostMode_HostPipe: 1075 RTPrintf(", attached to pipe (%s) '%lS'\n", 1076 fServer ? "server" : "client", path.raw()); 1077 break; 1078 case SerialHostMode_HostDevice: 1079 RTPrintf(", attached to device '%lS'\n", path.raw()); 1080 break; 1081 } 1067 1082 } 1068 1083 } … … 2825 2840 #endif 2826 2841 std::vector <char *> macs (NetworkAdapterCount, 0); 2842 std::vector <char *> uarts_mode (SerialPortCount, 0); 2827 2843 std::vector <ULONG> uarts_base (SerialPortCount, 0); 2828 2844 std::vector <ULONG> uarts_irq (SerialPortCount, 0); 2829 std::vector <char *> uarts_pipe (SerialPortCount, 0); 2830 std::vector <char *> uarts_server (SerialPortCount, 0); 2845 std::vector <char *> uarts_path (SerialPortCount, 0); 2831 2846 2832 2847 for (int i = 1; i < argc; i++) … … 3268 3283 snapshotFolder = argv[i]; 3269 3284 } 3285 else if (strncmp(argv[i], "-uartmode", 9) == 0) 3286 { 3287 unsigned n = parseNum(&argv[i][9], SerialPortCount, "UART"); 3288 if (!n) 3289 return 1; 3290 i++; 3291 if (strcmp(argv[i], "server") == 0 || strcmp(argv[i], "client") == 0) 3292 { 3293 uarts_mode[n - 1] = argv[i]; 3294 i++; 3295 #ifdef RT_OS_WINDOWS 3296 if (strncmp(argv[i], "\\\\.\\pipe\\", 9)) 3297 return errorArgument("Uart pipe must start with \\\\.\\pipe\\"); 3298 #endif 3299 } 3300 else 3301 { 3302 uarts_mode[n - 1] = (char*)"device"; 3303 } 3304 if (argc <= i) 3305 { 3306 return errorArgument("Missing argument to -uartmode"); 3307 } 3308 uarts_path[n - 1] = argv[i]; 3309 } 3270 3310 else if (strncmp(argv[i], "-uart", 5) == 0) 3271 3311 { … … 3284 3324 else 3285 3325 { 3286 if (argc <= i + 2)3326 if (argc <= i + 1) 3287 3327 { 3288 3328 return errorArgument("Missing argument to '%s'", argv[i-1]); … … 3299 3339 return errorArgument("Error parsing UART IRQ '%s'", argv[i]); 3300 3340 uarts_irq[n - 1] = uVal; 3301 i++;3302 if (strcmp(argv[i], "server") && strcmp(argv[i], "client"))3303 return errorArgument("Third UART argument must be 'client' or 'server'");3304 uarts_server[n - 1] = argv[i];3305 i++;3306 #ifdef RT_OS_WINDOWS3307 if (strncmp(argv[i], "\\\\.\\pipe\\", 9))3308 return errorArgument("Uart pipe must start with \\\\.\\pipe\\");3309 #endif3310 uarts_pipe[n - 1] = argv[i];3311 3341 } 3312 3342 } … … 4055 4085 ASSERT(uart); 4056 4086 4057 /* something about the NIC? */4058 4087 if (uarts_base[n]) 4059 4088 { … … 4066 4095 CHECK_ERROR_RET(uart, COMSETTER(IOBase) (uarts_base[n]), 1); 4067 4096 CHECK_ERROR_RET(uart, COMSETTER(IRQ) (uarts_irq[n]), 1); 4068 CHECK_ERROR_RET(uart, COMSETTER(Pipe) (Bstr(uarts_pipe[n])), 1);4069 CHECK_ERROR_RET(uart, COMSETTER(Server)4070 (0 == strcmp(uarts_server[n], "server")), 1);4071 4097 CHECK_ERROR_RET(uart, COMSETTER(Enabled) (TRUE), 1); 4072 4098 } 4099 } 4100 if (uarts_mode[n]) 4101 { 4102 if (strcmp(uarts_mode[n], "server") == 0) 4103 { 4104 CHECK_ERROR_RET(uart, COMSETTER(HostMode) (SerialHostMode_HostPipe), 1); 4105 CHECK_ERROR_RET(uart, COMSETTER(Server) (TRUE), 1); 4106 } 4107 else if (strcmp(uarts_mode[n], "client") == 0) 4108 { 4109 CHECK_ERROR_RET(uart, COMSETTER(HostMode) (SerialHostMode_HostPipe), 1); 4110 CHECK_ERROR_RET(uart, COMSETTER(Server) (FALSE), 1); 4111 } 4112 else 4113 { 4114 CHECK_ERROR_RET(uart, COMSETTER(HostMode) (SerialHostMode_HostDevice), 1); 4115 } 4116 CHECK_ERROR_RET(uart, COMSETTER(Path) (Bstr(uarts_path[n])), 1); 4073 4117 } 4074 4118 } -
trunk/src/VBox/Main/ConsoleImpl.cpp
r4234 r4269 5867 5867 rc = CFGMR3InsertNode(pInst, "Config", &pCfg); RC_CHECK(); 5868 5868 5869 ULONG uIRQ, uIOBase ;5870 Bstr p ipe;5869 ULONG uIRQ, uIOBase, uHostMode; 5870 Bstr path; 5871 5871 BOOL fServer; 5872 hrc = serialPort->COMGETTER(HostMode)(&uHostMode); H(); 5872 5873 hrc = serialPort->COMGETTER(IRQ)(&uIRQ); H(); 5873 5874 hrc = serialPort->COMGETTER(IOBase)(&uIOBase); H(); 5874 hrc = serialPort->COMGETTER(P ipe)(pipe.asOutParam()); H();5875 hrc = serialPort->COMGETTER(Path)(path.asOutParam()); H(); 5875 5876 hrc = serialPort->COMGETTER(Server)(&fServer); H(); 5876 5877 rc = CFGMR3InsertInteger(pCfg, "IRQ", uIRQ); RC_CHECK(); 5877 5878 rc = CFGMR3InsertInteger(pCfg, "IOBase", uIOBase); RC_CHECK(); 5878 rc = CFGMR3InsertNode(pInst, "LUN#0", &pLunL0); RC_CHECK(); 5879 rc = CFGMR3InsertString(pLunL0, "Driver", "Char"); RC_CHECK(); 5880 rc = CFGMR3InsertNode(pLunL0, "AttachedDriver", &pLunL1); RC_CHECK(); 5881 rc = CFGMR3InsertString(pLunL1, "Driver", "NamedPipe"); RC_CHECK(); 5882 rc = CFGMR3InsertNode(pLunL1, "Config", &pLunL2); RC_CHECK(); 5883 rc = CFGMR3InsertString(pLunL2, "Location", Utf8Str(pipe)); RC_CHECK(); 5884 rc = CFGMR3InsertInteger(pLunL2, "IsServer", fServer); RC_CHECK(); 5879 if (uHostMode != SerialHostMode_Disconnected) 5880 { 5881 rc = CFGMR3InsertNode(pInst, "LUN#0", &pLunL0); RC_CHECK(); 5882 if (uHostMode == SerialHostMode_HostPipe) 5883 { 5884 rc = CFGMR3InsertString(pLunL0, "Driver", "Char"); RC_CHECK(); 5885 rc = CFGMR3InsertNode(pLunL0, "AttachedDriver", &pLunL1); RC_CHECK(); 5886 rc = CFGMR3InsertString(pLunL1, "Driver", "NamedPipe"); RC_CHECK(); 5887 rc = CFGMR3InsertNode(pLunL1, "Config", &pLunL2); RC_CHECK(); 5888 rc = CFGMR3InsertString(pLunL2, "Location", Utf8Str(path)); RC_CHECK(); 5889 rc = CFGMR3InsertInteger(pLunL2, "IsServer", fServer); RC_CHECK(); 5890 } 5891 else if (uHostMode == SerialHostMode_HostDevice) 5892 { 5893 rc = CFGMR3InsertString(pLunL0, "Driver", "Host Serial"); RC_CHECK(); 5894 rc = CFGMR3InsertNode(pLunL0, "Config", &pLunL1); RC_CHECK(); 5895 rc = CFGMR3InsertString(pLunL1, "DevicePath", Utf8Str(path)); RC_CHECK(); 5896 } 5897 } 5885 5898 } 5886 5899 -
trunk/src/VBox/Main/SerialPortImpl.cpp
r4071 r4269 256 256 bool fEnabled = false; 257 257 CFGLDRQueryBool (portNode, "enabled", &fEnabled); 258 Bstr mode; 259 uint32_t uIOBase; 258 260 /* I/O base (required) */ 259 uint32_t uIOBase;260 261 CFGLDRQueryUInt32 (portNode, "IOBase", &uIOBase); 261 262 /* IRQ (required) */ 262 263 uint32_t uIRQ; 263 264 CFGLDRQueryUInt32 (portNode, "IRQ", &uIRQ); 265 /* host mode (required) */ 266 CFGLDRQueryBSTR (portNode, "HostMode", mode.asOutParam()); 267 if (mode == L"HostPipe") 268 mData->mHostMode = SerialHostMode_HostPipe; 269 else if (mode == L"HostDevice") 270 mData->mHostMode = SerialHostMode_HostDevice; 271 else 272 mData->mHostMode = SerialHostMode_Disconnected; 264 273 /* name of the pipe (required) */ 265 Bstr pipe; 266 CFGLDRQueryBSTR (portNode, "pipe", pipe.asOutParam()); 274 Bstr path; 275 int rc = CFGLDRQueryBSTR(portNode, "path", path.asOutParam()); 276 /* backward compatibility */ 277 if (rc == VERR_CFG_NO_VALUE) 278 CFGLDRQueryBSTR(portNode, "pipe", path.asOutParam()); 267 279 bool fServer = true; 268 280 CFGLDRQueryBool (portNode, "server", &fServer); 269 281 270 mData->mEnabled = fEnabled;271 mData->mSlot = uSlot;272 mData->mIOBase = uIOBase;273 mData->mIRQ = uIRQ;274 mData->mP ipe = pipe;275 mData->mServer = fServer;282 mData->mEnabled = fEnabled; 283 mData->mSlot = uSlot; 284 mData->mIOBase = uIOBase; 285 mData->mIRQ = uIRQ; 286 mData->mPath = path; 287 mData->mServer = fServer; 276 288 277 289 return S_OK; … … 291 303 ComAssertRCRet (vrc, E_FAIL); 292 304 305 const char *mode; 306 switch (mData->mHostMode) 307 { 308 default: 309 case SerialHostMode_Disconnected: 310 mode = "Disconnected"; 311 break; 312 case SerialHostMode_HostPipe: 313 mode = "HostPipe"; 314 break; 315 case SerialHostMode_HostDevice: 316 mode = "HostDevice"; 317 break; 318 } 293 319 CFGLDRSetUInt32 (portNode, "slot", mData->mSlot); 294 320 CFGLDRSetBool (portNode, "enabled", !!mData->mEnabled); 295 CFGLDRSetUInt32 (portNode, "IOBase", mData->mIOBase); 296 CFGLDRSetUInt32 (portNode, "IRQ", mData->mIRQ); 297 CFGLDRSetBSTR (portNode, "pipe", mData->mPipe); 298 CFGLDRSetBool (portNode, "server", !!mData->mServer); 321 if (mData->mEnabled) 322 { 323 CFGLDRSetUInt32 (portNode, "IOBase", mData->mIOBase); 324 CFGLDRSetUInt32 (portNode, "IRQ", mData->mIRQ); 325 CFGLDRSetString (portNode, "HostMode", mode); 326 CFGLDRSetBSTR (portNode, "path", mData->mPath); 327 if (mData->mHostMode == SerialHostMode_HostPipe) 328 CFGLDRSetBool (portNode, "server", !!mData->mServer); 329 } 299 330 300 331 return S_OK; … … 346 377 } 347 378 348 STDMETHODIMP SerialPort::COMGETTER( Slot) (ULONG *aSlot)349 { 350 if (!a Slot)379 STDMETHODIMP SerialPort::COMGETTER(HostMode) (ULONG *aHostMode) 380 { 381 if (!aHostMode) 351 382 return E_POINTER; 352 383 … … 356 387 AutoReaderLock alock (this); 357 388 358 *aSlot = mData->mSlot; 359 360 return S_OK; 361 } 362 363 STDMETHODIMP SerialPort::COMGETTER(IRQ) (ULONG *aIRQ) 364 { 365 if (!aIRQ) 366 return E_POINTER; 367 368 AutoCaller autoCaller (this); 369 CheckComRCReturnRC (autoCaller.rc()); 370 371 AutoReaderLock alock (this); 372 373 *aIRQ = mData->mIRQ; 374 375 return S_OK; 376 } 377 378 STDMETHODIMP SerialPort::COMSETTER(IRQ)(ULONG aIRQ) 389 *aHostMode = mData->mHostMode; 390 391 return S_OK; 392 } 393 394 STDMETHODIMP SerialPort::COMSETTER(HostMode) (ULONG aHostMode) 379 395 { 380 396 AutoCaller autoCaller (this); … … 390 406 bool emitChangeEvent = false; 391 407 408 if (mData->mHostMode != aHostMode) 409 { 410 mData.backup(); 411 mData->mHostMode = aHostMode; 412 emitChangeEvent = true; 413 } 414 415 if (emitChangeEvent) 416 { 417 /* leave the lock before informing callbacks */ 418 alock.unlock(); 419 420 mParent->onSerialPortChange (this); 421 } 422 423 return rc; 424 } 425 426 STDMETHODIMP SerialPort::COMGETTER(Slot) (ULONG *aSlot) 427 { 428 if (!aSlot) 429 return E_POINTER; 430 431 AutoCaller autoCaller (this); 432 CheckComRCReturnRC (autoCaller.rc()); 433 434 AutoReaderLock alock (this); 435 436 *aSlot = mData->mSlot; 437 438 return S_OK; 439 } 440 441 STDMETHODIMP SerialPort::COMGETTER(IRQ) (ULONG *aIRQ) 442 { 443 if (!aIRQ) 444 return E_POINTER; 445 446 AutoCaller autoCaller (this); 447 CheckComRCReturnRC (autoCaller.rc()); 448 449 AutoReaderLock alock (this); 450 451 *aIRQ = mData->mIRQ; 452 453 return S_OK; 454 } 455 456 STDMETHODIMP SerialPort::COMSETTER(IRQ)(ULONG aIRQ) 457 { 458 AutoCaller autoCaller (this); 459 CheckComRCReturnRC (autoCaller.rc()); 460 461 /* the machine needs to be mutable */ 462 Machine::AutoMutableStateDependency adep (mParent); 463 CheckComRCReturnRC (adep.rc()); 464 465 AutoLock alock (this); 466 467 HRESULT rc = S_OK; 468 bool emitChangeEvent = false; 469 392 470 if (mData->mIRQ != aIRQ) 393 471 { … … 455 533 } 456 534 457 STDMETHODIMP SerialPort::COMGETTER(P ipe) (BSTR *aPipe)458 { 459 if (!aP ipe)535 STDMETHODIMP SerialPort::COMGETTER(Path) (BSTR *aPath) 536 { 537 if (!aPath) 460 538 return E_POINTER; 461 539 … … 465 543 AutoReaderLock alock (this); 466 544 467 mData->mP ipe.cloneTo (aPipe);468 469 return S_OK; 470 } 471 472 STDMETHODIMP SerialPort::COMSETTER(P ipe) (INPTR BSTR aPipe)473 { 474 if (!aP ipe || *aPipe== 0)545 mData->mPath.cloneTo (aPath); 546 547 return S_OK; 548 } 549 550 STDMETHODIMP SerialPort::COMSETTER(Path) (INPTR BSTR aPath) 551 { 552 if (!aPath || *aPath == 0) 475 553 return E_INVALIDARG; 476 554 … … 484 562 AutoLock alock (this); 485 563 486 if (mData->mP ipe != aPipe)564 if (mData->mPath != aPath) 487 565 { 488 566 mData.backup(); 489 mData->mP ipe = aPipe;567 mData->mPath = aPath; 490 568 491 569 /* leave the lock before informing callbacks */ -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r4131 r4269 7006 7006 --> 7007 7007 7008 <enum 7009 name="SerialHostMode" 7010 uuid="5ac6ae50-30d4-4c89-8f9c-35b4500a5b9f" 7011 > 7012 <const name="Disconnected" value="0"/> 7013 <const name="HostPipe" value="1"/> 7014 <const name="HostDevice" value="2"/> 7015 </enum> 7016 7008 7017 <interface 7009 7018 name="ISerialPort" extends="$unknown" … … 7035 7044 </attribute> 7036 7045 7037 <attribute name=" pipe" type="wstring">7038 <desc> Gets the name of the host pipe connected to the serial port.</desc>7046 <attribute name="HostMode" type="SerialHostMode"> 7047 <desc>How is this port connected to the host.</desc> 7039 7048 </attribute> 7040 7049 7041 7050 <attribute name="server" type="boolean"> 7051 <desc>Flag whether this serial port acts as a server or a client.</desc> 7052 </attribute> 7053 7054 <attribute name="path" type="wstring"> 7042 7055 <desc>Flag whether this serial port acts as a server or a client.</desc> 7043 7056 </attribute> -
trunk/src/VBox/Main/include/SerialPortImpl.h
r4071 r4269 37 37 Data() 38 38 : mSlot (0) 39 , mEnabled(FALSE) 39 , mEnabled (FALSE) 40 , mHostMode (SerialHostMode_Disconnected) 40 41 , mIRQ (4) 41 42 , mIOBase (0x3f8) 43 , mServer (FALSE) 42 44 {} 43 45 … … 45 47 { 46 48 return this == &that || 47 (mSlot == that.mSlot && 48 mEnabled == that.mEnabled && 49 mIRQ == that.mIRQ && 50 mIOBase == that.mIOBase); 49 (mSlot == that.mSlot && 50 mEnabled == that.mEnabled && 51 mHostMode == that.mHostMode && 52 mIRQ == that.mIRQ && 53 mIOBase == that.mIOBase); 51 54 } 52 55 53 56 ULONG mSlot; 54 57 BOOL mEnabled; 58 ULONG mHostMode; 55 59 ULONG mIRQ; 56 60 ULONG mIOBase; 57 Bstr mP ipe;61 Bstr mPath; 58 62 BOOL mServer; 59 63 }; … … 84 88 85 89 // ISerialPort properties 86 STDMETHOD(COMGETTER(Slot)) (ULONG *aSlot); 87 STDMETHOD(COMGETTER(Enabled)) (BOOL *aEnabled); 88 STDMETHOD(COMSETTER(Enabled)) (BOOL aEnabled); 89 STDMETHOD(COMGETTER(IRQ)) (ULONG *aIRQ); 90 STDMETHOD(COMSETTER(IRQ)) (ULONG aIRQ); 91 STDMETHOD(COMGETTER(IOBase)) (ULONG *aIOBase); 92 STDMETHOD(COMSETTER(IOBase)) (ULONG aIOBase); 93 STDMETHOD(COMGETTER(Pipe)) (BSTR *aPipe); 94 STDMETHOD(COMSETTER(Pipe)) (INPTR BSTR aPipe); 95 STDMETHOD(COMGETTER(Server)) (BOOL *aServer); 96 STDMETHOD(COMSETTER(Server)) (BOOL aServer); 90 STDMETHOD(COMGETTER(Slot)) (ULONG *aSlot); 91 STDMETHOD(COMGETTER(Enabled)) (BOOL *aEnabled); 92 STDMETHOD(COMSETTER(Enabled)) (BOOL aEnabled); 93 STDMETHOD(COMGETTER(HostMode)) (ULONG *aHostMode); 94 STDMETHOD(COMSETTER(HostMode)) (ULONG aHostMode); 95 STDMETHOD(COMGETTER(IRQ)) (ULONG *aIRQ); 96 STDMETHOD(COMSETTER(IRQ)) (ULONG aIRQ); 97 STDMETHOD(COMGETTER(IOBase) ) (ULONG *aIOBase); 98 STDMETHOD(COMSETTER(IOBase)) (ULONG aIOBase); 99 STDMETHOD(COMGETTER(Path)) (BSTR *aPath); 100 STDMETHOD(COMSETTER(Path)) (INPTR BSTR aPath); 101 STDMETHOD(COMGETTER(Server)) (BOOL *aServer); 102 STDMETHOD(COMSETTER(Server)) (BOOL aServer); 97 103 98 104 // public methods only for internal purposes -
trunk/src/VBox/Main/xml/VirtualBox-settings-common.xsd
r4071 r4269 172 172 </xsd:simpleType> 173 173 174 <xsd:simpleType name="TUartHostModeType"> 175 <xsd:restriction base="xsd:string"> 176 <xsd:enumeration value="Disconnected"/> 177 <xsd:enumeration value="HostPipe"/> 178 <xsd:enumeration value="HostDevice"/> 179 </xsd:restriction> 180 </xsd:simpleType> 181 174 182 <!-- 175 183 // Complex types … … 523 531 <xsd:attribute name="IRQ" type="xsd:unsignedInt" default="4"/> 524 532 <xsd:attribute name="IOBase" type="xsd:unsignedInt" default="1016"/> 533 <xsd:attribute name="HostMode" type="TUartHostModeType" default="Disconnected"/> 525 534 <xsd:attribute name="pipe" type="xsd:string"/> 535 <xsd:attribute name="path" type="xsd:string"/> 526 536 <xsd:attribute name="server" type="xsd:boolean"/> 527 537 </xsd:complexType>
Note:
See TracChangeset
for help on using the changeset viewer.