VirtualBox

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

Location:
trunk/src/VBox/Frontends/VBoxManage
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp

    r73740 r73768  
    608608                     "                                             file <file>|\n"
    609609                     "                                             <devicename>]\n"
     610                     "                            [--uarttype<1-N> 16450|16550A|16750\n"
    610611#if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
    611612                     "                            [--lpt<1-N> off|<I/O base> <IRQ>]\n"
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp

    r72976 r73768  
    14931493                Bstr path;
    14941494                BOOL fServer;
     1495                UartType_T UartType;
    14951496                uart->COMGETTER(IRQ)(&ulIRQ);
    14961497                uart->COMGETTER(IOBase)(&ulIOBase);
     
    14981499                uart->COMGETTER(Server)(&fServer);
    14991500                uart->COMGETTER(HostMode)(&HostMode);
     1501                uart->COMGETTER(UartType)(&UartType);
    15001502
    15011503                if (details == VMINFO_MACHINEREADABLE)
     
    15101512                            RTPrintf("uartmode%d=\"disconnected\"\n", currentUART + 1);
    15111513                        else
    1512                             RTPrintf(", disconnected\n");
     1514                            RTPrintf(", disconnected");
    15131515                        break;
    15141516                    case PortMode_RawFile:
     
    15251527                                     fServer ? "tcpserver" : "tcpclient", path.raw());
    15261528                        else
    1527                             RTPrintf(", attached to tcp (%s) '%ls'\n",
     1529                            RTPrintf(", attached to tcp (%s) '%ls'",
    15281530                                     fServer ? "server" : "client", path.raw());
    15291531                        break;
     
    15331535                                     fServer ? "server" : "client", path.raw());
    15341536                        else
    1535                             RTPrintf(", attached to pipe (%s) '%ls'\n",
     1537                            RTPrintf(", attached to pipe (%s) '%ls'",
    15361538                                     fServer ? "server" : "client", path.raw());
    15371539                        break;
     
    15411543                                     path.raw());
    15421544                        else
    1543                             RTPrintf(", attached to device '%ls'\n", path.raw());
     1545                            RTPrintf(", attached to device '%ls'", path.raw());
     1546                        break;
     1547                }
     1548                switch (UartType)
     1549                {
     1550                    default:
     1551                    case UartType_U16450:
     1552                        if (details == VMINFO_MACHINEREADABLE)
     1553                            RTPrintf("uarttype%d=\"16450\"\n", currentUART + 1);
     1554                        else
     1555                            RTPrintf(", 16450\n");
     1556                        break;
     1557                    case UartType_U16550A:
     1558                        if (details == VMINFO_MACHINEREADABLE)
     1559                            RTPrintf("uarttype%d=\"16550A\"\n", currentUART + 1);
     1560                        else
     1561                            RTPrintf(", 16550A\n");
     1562                        break;
     1563                    case UartType_U16750:
     1564                        if (details == VMINFO_MACHINEREADABLE)
     1565                            RTPrintf("uarttype%d=\"16750\"\n", currentUART + 1);
     1566                        else
     1567                            RTPrintf(", 16750\n");
    15441568                        break;
    15451569                }
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp

    r72919 r73768  
    147147    MODIFYVM_HIDKBD,
    148148    MODIFYVM_UARTMODE,
     149    MODIFYVM_UARTTYPE,
    149150    MODIFYVM_UART,
    150151#if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
     
    334335    { "--keyboard",                 MODIFYVM_HIDKBD,                    RTGETOPT_REQ_STRING },
    335336    { "--uartmode",                 MODIFYVM_UARTMODE,                  RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
     337    { "--uarttype",                 MODIFYVM_UARTTYPE,                  RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
    336338    { "--uart",                     MODIFYVM_UART,                      RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
    337339#if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
     
    21572159            }
    21582160
     2161            case MODIFYVM_UARTTYPE:
     2162            {
     2163                ComPtr<ISerialPort> uart;
     2164
     2165                CHECK_ERROR_BREAK(sessionMachine, GetSerialPort(GetOptState.uIndex - 1, uart.asOutParam()));
     2166                ASSERT(uart);
     2167
     2168                if (!RTStrICmp(ValueUnion.psz, "16450"))
     2169                {
     2170                    CHECK_ERROR(uart, COMSETTER(UartType)(UartType_U16450));
     2171                }
     2172                else if (!RTStrICmp(ValueUnion.psz, "16550A"))
     2173                {
     2174                    CHECK_ERROR(uart, COMSETTER(UartType)(UartType_U16550A));
     2175                }
     2176                else if (!RTStrICmp(ValueUnion.psz, "16750"))
     2177                {
     2178                    CHECK_ERROR(uart, COMSETTER(UartType)(UartType_U16750));
     2179                }
     2180                else
     2181                    return errorSyntax(USAGE_MODIFYVM,
     2182                                       "Invalid argument to '%s'",
     2183                                       GetOptState.pDef->pszLong);
     2184                break;
     2185            }
     2186
    21592187            case MODIFYVM_UART:
    21602188            {
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