Index: /trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp	(revision 4268)
+++ /trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp	(revision 4269)
@@ -332,8 +332,9 @@
                  "                            [-nictracefile<1-N> <filename>]\n"
                  "                            [-hostifdev<1-N> none|<devicename>]\n"
-                 "                            [-intnet<1-N> network]\n"
+                 "                            [-intnet<1-N> <network>]\n"
                  "                            [-macaddress<1-N> auto|<mac>]\n"
-                 "                            [-uart<1-N> off | <I/O base> <IRQ> server|client\n"
-                 "                                              <host pipename>]\n"
+                 "                            [-uart<1-N> off|<I/O base> <IRQ>]\n"
+                 "                            [-uartmode<1-N> server|client <pipe name>|\n"
+                 "                                            <device name>]\n"
                  );
         if (fLinux)
@@ -1054,15 +1055,29 @@
             else
             {
-                ULONG uIRQ, uIOBase;
-                Bstr pipe;
+                ULONG uIRQ, uIOBase, uHostMode;
+                Bstr path;
                 BOOL fServer;
                 uart->COMGETTER(IRQ)(&uIRQ);
                 uart->COMGETTER(IOBase)(&uIOBase);
-                uart->COMGETTER(Pipe)(pipe.asOutParam());
+                uart->COMGETTER(Path)(path.asOutParam());
                 uart->COMGETTER(Server)(&fServer);
-
-                RTPrintf("UART %d:          I/O base: 0x%04x, IRQ: %d, %s, pipe '%lS'\n",
-                         currentUART + 1, uIOBase, uIRQ, fServer ? "isServer" : "isClient",
-                         pipe.raw());
+                uart->COMGETTER(HostMode)(&uHostMode);
+
+                RTPrintf("UART %d:          I/O base: 0x%04x, IRQ: %d",
+                         currentUART + 1, uIOBase, uIRQ);
+                switch (uHostMode)
+                {
+                    default:
+                    case SerialHostMode_Disconnected:
+                        RTPrintf(", disconnected\n");
+                        break;
+                    case SerialHostMode_HostPipe:
+                        RTPrintf(", attached to pipe (%s) '%lS'\n",
+                                fServer ? "server" : "client", path.raw());
+                        break;
+                    case SerialHostMode_HostDevice:
+                        RTPrintf(", attached to device '%lS'\n", path.raw());
+                        break;
+                }
             }
         }
@@ -2825,8 +2840,8 @@
 #endif
     std::vector <char *> macs (NetworkAdapterCount, 0);
+    std::vector <char *> uarts_mode (SerialPortCount, 0);
     std::vector <ULONG>  uarts_base (SerialPortCount, 0);
     std::vector <ULONG>  uarts_irq (SerialPortCount, 0);
-    std::vector <char *> uarts_pipe (SerialPortCount, 0);
-    std::vector <char *> uarts_server (SerialPortCount, 0);
+    std::vector <char *> uarts_path (SerialPortCount, 0);
 
     for (int i = 1; i < argc; i++)
@@ -3268,4 +3283,29 @@
             snapshotFolder = argv[i];
         }
+        else if (strncmp(argv[i], "-uartmode", 9) == 0)
+        {
+            unsigned n = parseNum(&argv[i][9], SerialPortCount, "UART");
+            if (!n)
+                return 1;
+            i++;
+            if (strcmp(argv[i], "server") == 0 || strcmp(argv[i], "client") == 0)
+            {
+                uarts_mode[n - 1] = argv[i];
+                i++;
+#ifdef RT_OS_WINDOWS
+                if (strncmp(argv[i], "\\\\.\\pipe\\", 9))
+                    return errorArgument("Uart pipe must start with \\\\.\\pipe\\");
+#endif
+            }
+            else
+            {
+                uarts_mode[n - 1] = (char*)"device";
+            }
+            if (argc <= i)
+            {
+                return errorArgument("Missing argument to -uartmode");
+            }
+            uarts_path[n - 1] = argv[i];
+        }
         else if (strncmp(argv[i], "-uart", 5) == 0)
         {
@@ -3284,5 +3324,5 @@
             else
             {
-                if (argc <= i + 2)
+                if (argc <= i + 1)
                 {
                     return errorArgument("Missing argument to '%s'", argv[i-1]);
@@ -3299,14 +3339,4 @@
                     return errorArgument("Error parsing UART IRQ '%s'", argv[i]);
                 uarts_irq[n - 1]  = uVal;
-                i++;
-                if (strcmp(argv[i], "server") && strcmp(argv[i], "client"))
-                    return errorArgument("Third UART argument must be 'client' or 'server'");
-                uarts_server[n - 1] = argv[i];
-                i++;
-#ifdef RT_OS_WINDOWS
-                if (strncmp(argv[i], "\\\\.\\pipe\\", 9))
-                    return errorArgument("Uart pipe must start with \\\\.\\pipe\\");
-#endif
-                uarts_pipe[n - 1] = argv[i];
             }
         }
@@ -4055,5 +4085,4 @@
             ASSERT(uart);
 
-            /* something about the NIC? */
             if (uarts_base[n])
             {
@@ -4066,9 +4095,24 @@
                     CHECK_ERROR_RET(uart, COMSETTER(IOBase) (uarts_base[n]), 1);
                     CHECK_ERROR_RET(uart, COMSETTER(IRQ) (uarts_irq[n]), 1);
-                    CHECK_ERROR_RET(uart, COMSETTER(Pipe) (Bstr(uarts_pipe[n])), 1);
-                    CHECK_ERROR_RET(uart, COMSETTER(Server)
-                                          (0 == strcmp(uarts_server[n], "server")), 1);
                     CHECK_ERROR_RET(uart, COMSETTER(Enabled) (TRUE), 1);
                 }
+            }
+            if (uarts_mode[n])
+            {
+                if (strcmp(uarts_mode[n], "server") == 0)
+                {
+                    CHECK_ERROR_RET(uart, COMSETTER(HostMode) (SerialHostMode_HostPipe), 1);
+                    CHECK_ERROR_RET(uart, COMSETTER(Server) (TRUE), 1);
+                }
+                else if (strcmp(uarts_mode[n], "client") == 0)
+                {
+                    CHECK_ERROR_RET(uart, COMSETTER(HostMode) (SerialHostMode_HostPipe), 1);
+                    CHECK_ERROR_RET(uart, COMSETTER(Server) (FALSE), 1);
+                }
+                else
+                {
+                    CHECK_ERROR_RET(uart, COMSETTER(HostMode) (SerialHostMode_HostDevice), 1);
+                }
+                CHECK_ERROR_RET(uart, COMSETTER(Path) (Bstr(uarts_path[n])), 1);
             }
         }
Index: /trunk/src/VBox/Main/ConsoleImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/ConsoleImpl.cpp	(revision 4268)
+++ /trunk/src/VBox/Main/ConsoleImpl.cpp	(revision 4269)
@@ -5867,20 +5867,33 @@
         rc = CFGMR3InsertNode(pInst, "Config", &pCfg);                              RC_CHECK();
 
-        ULONG uIRQ, uIOBase;
-        Bstr  pipe;
+        ULONG uIRQ, uIOBase, uHostMode;
+        Bstr  path;
         BOOL  fServer;
+        hrc = serialPort->COMGETTER(HostMode)(&uHostMode);                          H();
         hrc = serialPort->COMGETTER(IRQ)(&uIRQ);                                    H();
         hrc = serialPort->COMGETTER(IOBase)(&uIOBase);                              H();
-        hrc = serialPort->COMGETTER(Pipe)(pipe.asOutParam());                       H();
+        hrc = serialPort->COMGETTER(Path)(path.asOutParam());                       H();
         hrc = serialPort->COMGETTER(Server)(&fServer);                              H();
         rc = CFGMR3InsertInteger(pCfg,   "IRQ", uIRQ);                              RC_CHECK();
         rc = CFGMR3InsertInteger(pCfg,   "IOBase", uIOBase);                        RC_CHECK();
-        rc = CFGMR3InsertNode(pInst,     "LUN#0", &pLunL0);                         RC_CHECK();
-        rc = CFGMR3InsertString(pLunL0,  "Driver", "Char");                         RC_CHECK();
-        rc = CFGMR3InsertNode(pLunL0,    "AttachedDriver", &pLunL1);                RC_CHECK();
-        rc = CFGMR3InsertString(pLunL1,  "Driver", "NamedPipe");                    RC_CHECK();
-        rc = CFGMR3InsertNode(pLunL1,    "Config", &pLunL2);                        RC_CHECK();
-        rc = CFGMR3InsertString(pLunL2,  "Location", Utf8Str(pipe));                RC_CHECK();
-        rc = CFGMR3InsertInteger(pLunL2, "IsServer", fServer);                      RC_CHECK();
+        if (uHostMode != SerialHostMode_Disconnected)
+        {
+            rc = CFGMR3InsertNode(pInst,     "LUN#0", &pLunL0);                     RC_CHECK();
+            if (uHostMode == SerialHostMode_HostPipe)
+            {
+                rc = CFGMR3InsertString(pLunL0,  "Driver", "Char");                 RC_CHECK();
+                rc = CFGMR3InsertNode(pLunL0,    "AttachedDriver", &pLunL1);        RC_CHECK();
+                rc = CFGMR3InsertString(pLunL1,  "Driver", "NamedPipe");            RC_CHECK();
+                rc = CFGMR3InsertNode(pLunL1,    "Config", &pLunL2);                RC_CHECK();
+                rc = CFGMR3InsertString(pLunL2,  "Location", Utf8Str(path));        RC_CHECK();
+                rc = CFGMR3InsertInteger(pLunL2, "IsServer", fServer);              RC_CHECK();
+            }
+            else if (uHostMode == SerialHostMode_HostDevice)
+            {
+                rc = CFGMR3InsertString(pLunL0,  "Driver", "Host Serial");          RC_CHECK();
+                rc = CFGMR3InsertNode(pLunL0,    "Config", &pLunL1);                RC_CHECK();
+                rc = CFGMR3InsertString(pLunL1,  "DevicePath", Utf8Str(path));      RC_CHECK();
+            }
+        }
     }
 
Index: /trunk/src/VBox/Main/SerialPortImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/SerialPortImpl.cpp	(revision 4268)
+++ /trunk/src/VBox/Main/SerialPortImpl.cpp	(revision 4269)
@@ -256,22 +256,34 @@
     bool fEnabled = false;
     CFGLDRQueryBool (portNode, "enabled", &fEnabled);
+    Bstr mode;
+    uint32_t uIOBase;
     /* I/O base (required) */
-    uint32_t uIOBase;
     CFGLDRQueryUInt32 (portNode, "IOBase", &uIOBase);
     /* IRQ (required) */
     uint32_t uIRQ;
     CFGLDRQueryUInt32 (portNode, "IRQ", &uIRQ);
+    /* host mode (required) */
+    CFGLDRQueryBSTR (portNode, "HostMode", mode.asOutParam());
+    if (mode == L"HostPipe")
+        mData->mHostMode = SerialHostMode_HostPipe;
+    else if (mode == L"HostDevice")
+        mData->mHostMode = SerialHostMode_HostDevice;
+    else
+        mData->mHostMode = SerialHostMode_Disconnected;
     /* name of the pipe (required) */
-    Bstr pipe;
-    CFGLDRQueryBSTR   (portNode, "pipe", pipe.asOutParam());
+    Bstr path;
+    int rc = CFGLDRQueryBSTR(portNode, "path", path.asOutParam());
+    /* backward compatibility */
+    if (rc == VERR_CFG_NO_VALUE)
+        CFGLDRQueryBSTR(portNode, "pipe", path.asOutParam());
     bool fServer = true;
     CFGLDRQueryBool   (portNode, "server", &fServer);
 
-    mData->mEnabled = fEnabled;
-    mData->mSlot    = uSlot;
-    mData->mIOBase  = uIOBase;
-    mData->mIRQ     = uIRQ;
-    mData->mPipe    = pipe;
-    mData->mServer  = fServer;
+    mData->mEnabled  = fEnabled;
+    mData->mSlot     = uSlot;
+    mData->mIOBase   = uIOBase;
+    mData->mIRQ      = uIRQ;
+    mData->mPath     = path;
+    mData->mServer   = fServer;
 
     return S_OK;
@@ -291,10 +303,29 @@
     ComAssertRCRet (vrc, E_FAIL);
 
+    const char *mode;
+    switch (mData->mHostMode)
+    {
+        default:
+        case SerialHostMode_Disconnected:
+            mode = "Disconnected";
+            break;
+        case SerialHostMode_HostPipe:
+            mode = "HostPipe";
+            break;
+        case SerialHostMode_HostDevice:
+            mode = "HostDevice";
+            break;
+    }
     CFGLDRSetUInt32 (portNode, "slot",    mData->mSlot);
     CFGLDRSetBool   (portNode, "enabled", !!mData->mEnabled);
-    CFGLDRSetUInt32 (portNode, "IOBase",  mData->mIOBase);
-    CFGLDRSetUInt32 (portNode, "IRQ",     mData->mIRQ);
-    CFGLDRSetBSTR   (portNode, "pipe",    mData->mPipe);
-    CFGLDRSetBool   (portNode, "server",  !!mData->mServer);
+    if (mData->mEnabled)
+    {
+        CFGLDRSetUInt32 (portNode, "IOBase",  mData->mIOBase);
+        CFGLDRSetUInt32 (portNode, "IRQ",     mData->mIRQ);
+        CFGLDRSetString (portNode, "HostMode", mode);
+        CFGLDRSetBSTR   (portNode, "path",    mData->mPath);
+        if (mData->mHostMode == SerialHostMode_HostPipe)
+            CFGLDRSetBool   (portNode, "server",  !!mData->mServer);
+    }
 
     return S_OK;
@@ -346,7 +377,7 @@
 }
 
-STDMETHODIMP SerialPort::COMGETTER(Slot) (ULONG *aSlot)
-{
-    if (!aSlot)
+STDMETHODIMP SerialPort::COMGETTER(HostMode) (ULONG *aHostMode)
+{
+    if (!aHostMode)
         return E_POINTER;
 
@@ -356,25 +387,10 @@
     AutoReaderLock alock (this);
 
-    *aSlot = mData->mSlot;
-
-    return S_OK;
-}
-
-STDMETHODIMP SerialPort::COMGETTER(IRQ) (ULONG *aIRQ)
-{
-    if (!aIRQ)
-        return E_POINTER;
-
-    AutoCaller autoCaller (this);
-    CheckComRCReturnRC (autoCaller.rc());
-
-    AutoReaderLock alock (this);
-
-    *aIRQ = mData->mIRQ;
-
-    return S_OK;
-}
-
-STDMETHODIMP SerialPort::COMSETTER(IRQ)(ULONG aIRQ)
+    *aHostMode = mData->mHostMode;
+
+    return S_OK;
+}
+
+STDMETHODIMP SerialPort::COMSETTER(HostMode) (ULONG aHostMode)
 {
     AutoCaller autoCaller (this);
@@ -390,4 +406,66 @@
     bool emitChangeEvent = false;
 
+    if (mData->mHostMode != aHostMode)
+    {
+        mData.backup();
+        mData->mHostMode = aHostMode;
+        emitChangeEvent = true;
+    }
+
+    if (emitChangeEvent)
+    {
+        /* leave the lock before informing callbacks */
+        alock.unlock();
+
+        mParent->onSerialPortChange (this);
+    }
+
+    return rc;
+}
+
+STDMETHODIMP SerialPort::COMGETTER(Slot) (ULONG *aSlot)
+{
+    if (!aSlot)
+        return E_POINTER;
+
+    AutoCaller autoCaller (this);
+    CheckComRCReturnRC (autoCaller.rc());
+
+    AutoReaderLock alock (this);
+
+    *aSlot = mData->mSlot;
+
+    return S_OK;
+}
+
+STDMETHODIMP SerialPort::COMGETTER(IRQ) (ULONG *aIRQ)
+{
+    if (!aIRQ)
+        return E_POINTER;
+
+    AutoCaller autoCaller (this);
+    CheckComRCReturnRC (autoCaller.rc());
+
+    AutoReaderLock alock (this);
+
+    *aIRQ = mData->mIRQ;
+
+    return S_OK;
+}
+
+STDMETHODIMP SerialPort::COMSETTER(IRQ)(ULONG aIRQ)
+{
+    AutoCaller autoCaller (this);
+    CheckComRCReturnRC (autoCaller.rc());
+
+    /* the machine needs to be mutable */
+    Machine::AutoMutableStateDependency adep (mParent);
+    CheckComRCReturnRC (adep.rc());
+
+    AutoLock alock (this);
+
+    HRESULT rc = S_OK;
+    bool emitChangeEvent = false;
+
     if (mData->mIRQ != aIRQ)
     {
@@ -455,7 +533,7 @@
 }
 
-STDMETHODIMP SerialPort::COMGETTER(Pipe) (BSTR *aPipe)
-{
-    if (!aPipe)
+STDMETHODIMP SerialPort::COMGETTER(Path) (BSTR *aPath)
+{
+    if (!aPath)
         return E_POINTER;
 
@@ -465,12 +543,12 @@
     AutoReaderLock alock (this);
 
-    mData->mPipe.cloneTo (aPipe);
-
-    return S_OK;
-}
-
-STDMETHODIMP SerialPort::COMSETTER(Pipe) (INPTR BSTR aPipe)
-{
-    if (!aPipe || *aPipe == 0)
+    mData->mPath.cloneTo (aPath);
+
+    return S_OK;
+}
+
+STDMETHODIMP SerialPort::COMSETTER(Path) (INPTR BSTR aPath)
+{
+    if (!aPath || *aPath == 0)
         return E_INVALIDARG;
 
@@ -484,8 +562,8 @@
     AutoLock alock (this);
 
-    if (mData->mPipe != aPipe)
+    if (mData->mPath != aPath)
     {
         mData.backup();
-        mData->mPipe = aPipe;
+        mData->mPath = aPath;
 
         /* leave the lock before informing callbacks */
Index: /trunk/src/VBox/Main/idl/VirtualBox.xidl
===================================================================
--- /trunk/src/VBox/Main/idl/VirtualBox.xidl	(revision 4268)
+++ /trunk/src/VBox/Main/idl/VirtualBox.xidl	(revision 4269)
@@ -7006,4 +7006,13 @@
   -->
 
+  <enum
+     name="SerialHostMode"
+     uuid="5ac6ae50-30d4-4c89-8f9c-35b4500a5b9f"
+     >
+    <const name="Disconnected"        value="0"/>
+    <const name="HostPipe"            value="1"/>
+    <const name="HostDevice"          value="2"/>
+  </enum>
+
   <interface
      name="ISerialPort" extends="$unknown"
@@ -7035,9 +7044,13 @@
     </attribute>
 
-    <attribute name="pipe" type="wstring">
-      <desc>Gets the name of the host pipe connected to the serial port.</desc>
+    <attribute name="HostMode" type="SerialHostMode">
+      <desc>How is this port connected to the host.</desc>
     </attribute>
 
     <attribute name="server" type="boolean">
+      <desc>Flag whether this serial port acts as a server or a client.</desc>
+    </attribute>
+
+    <attribute name="path" type="wstring">
       <desc>Flag whether this serial port acts as a server or a client.</desc>
     </attribute>
Index: /trunk/src/VBox/Main/include/SerialPortImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/SerialPortImpl.h	(revision 4268)
+++ /trunk/src/VBox/Main/include/SerialPortImpl.h	(revision 4269)
@@ -37,7 +37,9 @@
         Data()
             : mSlot (0)
-            , mEnabled(FALSE)
+            , mEnabled (FALSE)
+            , mHostMode (SerialHostMode_Disconnected)
             , mIRQ (4)
             , mIOBase (0x3f8)
+            , mServer (FALSE)
         {}
 
@@ -45,15 +47,17 @@
         {
             return this == &that ||
-                   (mSlot == that.mSlot &&
-                    mEnabled == that.mEnabled &&
-                    mIRQ == that.mIRQ &&
-                    mIOBase == that.mIOBase);
+                   (mSlot     == that.mSlot     &&
+                    mEnabled  == that.mEnabled  &&
+                    mHostMode == that.mHostMode &&
+                    mIRQ      == that.mIRQ      &&
+                    mIOBase   == that.mIOBase);
         }
 
         ULONG mSlot;
         BOOL  mEnabled;
+        ULONG mHostMode;
         ULONG mIRQ;
         ULONG mIOBase;
-        Bstr  mPipe;
+        Bstr  mPath;
         BOOL  mServer;
     };
@@ -84,15 +88,17 @@
 
     // ISerialPort properties
-    STDMETHOD(COMGETTER(Slot))    (ULONG     *aSlot);
-    STDMETHOD(COMGETTER(Enabled)) (BOOL      *aEnabled);
-    STDMETHOD(COMSETTER(Enabled)) (BOOL       aEnabled);
-    STDMETHOD(COMGETTER(IRQ))     (ULONG     *aIRQ);
-    STDMETHOD(COMSETTER(IRQ))     (ULONG      aIRQ);
-    STDMETHOD(COMGETTER(IOBase))  (ULONG     *aIOBase);
-    STDMETHOD(COMSETTER(IOBase))  (ULONG      aIOBase);
-    STDMETHOD(COMGETTER(Pipe))    (BSTR      *aPipe);
-    STDMETHOD(COMSETTER(Pipe))    (INPTR BSTR aPipe);
-    STDMETHOD(COMGETTER(Server))  (BOOL      *aServer);
-    STDMETHOD(COMSETTER(Server))  (BOOL       aServer);
+    STDMETHOD(COMGETTER(Slot))     (ULONG     *aSlot);
+    STDMETHOD(COMGETTER(Enabled))  (BOOL      *aEnabled);
+    STDMETHOD(COMSETTER(Enabled))  (BOOL       aEnabled);
+    STDMETHOD(COMGETTER(HostMode)) (ULONG    *aHostMode);
+    STDMETHOD(COMSETTER(HostMode)) (ULONG     aHostMode);
+    STDMETHOD(COMGETTER(IRQ))      (ULONG     *aIRQ);
+    STDMETHOD(COMSETTER(IRQ))      (ULONG      aIRQ);
+    STDMETHOD(COMGETTER(IOBase) )  (ULONG     *aIOBase);
+    STDMETHOD(COMSETTER(IOBase))   (ULONG      aIOBase);
+    STDMETHOD(COMGETTER(Path))     (BSTR      *aPath);
+    STDMETHOD(COMSETTER(Path))     (INPTR BSTR aPath);
+    STDMETHOD(COMGETTER(Server))   (BOOL      *aServer);
+    STDMETHOD(COMSETTER(Server))   (BOOL       aServer);
 
     // public methods only for internal purposes
Index: /trunk/src/VBox/Main/xml/VirtualBox-settings-common.xsd
===================================================================
--- /trunk/src/VBox/Main/xml/VirtualBox-settings-common.xsd	(revision 4268)
+++ /trunk/src/VBox/Main/xml/VirtualBox-settings-common.xsd	(revision 4269)
@@ -172,4 +172,12 @@
 </xsd:simpleType>
 
+<xsd:simpleType name="TUartHostModeType">
+    <xsd:restriction base="xsd:string">
+      <xsd:enumeration value="Disconnected"/>
+      <xsd:enumeration value="HostPipe"/>
+      <xsd:enumeration value="HostDevice"/>
+    </xsd:restriction>
+</xsd:simpleType>
+
 <!--
 // Complex types
@@ -523,5 +531,7 @@
   <xsd:attribute name="IRQ" type="xsd:unsignedInt" default="4"/>
   <xsd:attribute name="IOBase" type="xsd:unsignedInt" default="1016"/>
+  <xsd:attribute name="HostMode" type="TUartHostModeType" default="Disconnected"/>
   <xsd:attribute name="pipe" type="xsd:string"/>
+  <xsd:attribute name="path" type="xsd:string"/>
   <xsd:attribute name="server" type="xsd:boolean"/>
 </xsd:complexType>
