Changeset 4269 in vbox for trunk/src/VBox/Main
- Timestamp:
- Aug 21, 2007 9:39:48 PM (17 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
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.