VirtualBox

Changeset 73768 in vbox for trunk/src/VBox/Main/xml


Ignore:
Timestamp:
Aug 19, 2018 7:07:19 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
124451
Message:

Main,FE/VBoxManage: Allow changing the UART type of the serial ports through the API

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/xml/Settings.cpp

    r72973 r73768  
    24952495    ulIRQ(4),
    24962496    portMode(PortMode_Disconnected),
    2497     fServer(false)
     2497    fServer(false),
     2498    uartType(UartType_U16550A)
    24982499{
    24992500}
     
    25132514            && portMode          == s.portMode
    25142515            && strPath           == s.strPath
    2515             && fServer           == s.fServer);
     2516            && fServer           == s.fServer
     2517            && uartType          == s.uartType);
    25162518}
    25172519
     
    36373639        pelmPort->getAttributeValue("server", port.fServer);
    36383640
     3641        Utf8Str strUartType;
     3642        if (pelmPort->getAttributeValue("uartType", strUartType))
     3643        {
     3644            if (strUartType == "16450")
     3645                port.uartType = UartType_U16450;
     3646            else if (strUartType == "16550A")
     3647                port.uartType = UartType_U16550A;
     3648            else if (strUartType == "16750")
     3649                port.uartType = UartType_U16750;
     3650            else
     3651                throw ConfigFileError(this, pelmPort, N_("Invalid value '%s' in UART/Port/@uartType attribute"), strUartType.c_str());
     3652        }
     3653
    36393654        ll.push_back(port);
    36403655    }
     
    60116026            }
    60126027            pelmPort->setAttribute("hostMode", pcszHostMode);
     6028
     6029            if (   m->sv >= SettingsVersion_v1_17
     6030                && port.uartType != UartType_U16550A)
     6031            {
     6032                const char *pcszUartType;
     6033
     6034                switch (port.uartType)
     6035                {
     6036                    case UartType_U16450: pcszUartType = "16450"; break;
     6037                    case UartType_U16550A: pcszUartType = "16550A"; break;
     6038                    case UartType_U16750: pcszUartType = "16750"; break;
     6039                    default: pcszUartType = "16550A"; break;
     6040                }
     6041                pelmPort->setAttribute("uartType", pcszUartType);
     6042            }
    60136043        }
    60146044    }
     
    69827012            return;
    69837013        }
     7014
     7015        /*
     7016         * Check if any serial port uses a non 16550A serial port.
     7017         */
     7018        for (SerialPortsList::const_iterator it = hardwareMachine.llSerialPorts.begin();
     7019             it != hardwareMachine.llSerialPorts.end();
     7020             ++it)
     7021        {
     7022            const SerialPort &port = *it;
     7023            if (port.uartType != UartType_U16550A)
     7024            {
     7025                m->sv = SettingsVersion_v1_17;
     7026                return;
     7027            }
     7028        }
    69847029    }
    69857030
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette