VirtualBox

Changeset 57979 in vbox for trunk/src/VBox/Main/src-server


Ignore:
Timestamp:
Oct 1, 2015 8:25:21 AM (9 years ago)
Author:
vboxsync
Message:

Parallel ports: Several fixes for multiple parallel ports. Make the second parallel port visible to the guest through ACPI if enabled (and don't expose the first port if it is not enabled), increase the maximum instanbce count to 2 and make it possible to enable a parallel port without having it connected to a host device to make it behave like it is not connected to anything.

Location:
trunk/src/VBox/Main/src-server
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/MachineImpl.cpp

    r57832 r57979  
    353353            for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); ++slot)
    354354                mSerialPorts[slot]->i_applyDefaults(aOsType);
     355
     356            /* Apply parallel port defaults */
     357            for (ULONG slot = 0; slot < RT_ELEMENTS(mParallelPorts); ++slot)
     358                mParallelPorts[slot]->i_applyDefaults();
    355359
    356360            /* Let the OS type select 64-bit ness. */
  • trunk/src/VBox/Main/src-server/ParallelPortImpl.cpp

    r54971 r57979  
    215215    if (m->bd->fEnabled != !!aEnabled)
    216216    {
    217         if (aEnabled &&
    218             m->bd->strPath.isEmpty())
    219             return setError(E_INVALIDARG,
    220                             tr("Cannot enable the parallel port %d because the port path is empty or null"),
    221                             m->bd->ulSlot);
    222 
    223217        m->bd.backup();
    224218        m->bd->fEnabled = !!aEnabled;
     
    352346    if (aPath != m->bd->strPath)
    353347    {
    354         HRESULT rc = i_checkSetPath(aPath);
    355         if (FAILED(rc)) return rc;
    356 
    357348        m->bd.backup();
    358349        m->bd->strPath = aPath;
     
    498489
    499490/**
    500  *  Validates COMSETTER(Path) arguments.
    501  */
    502 HRESULT ParallelPort::i_checkSetPath(const Utf8Str &str)
    503 {
    504     AssertReturn(isWriteLockOnCurrentThread(), E_FAIL);
    505 
    506     if (    m->bd->fEnabled
    507          && str.isEmpty()
    508        )
    509         return setError(E_INVALIDARG,
    510                         tr("Path of the parallel port %d may not be empty or null "
    511                            "when the port is enabled"),
    512                         m->bd->ulSlot);
    513 
    514     return S_OK;
    515 }
    516 
     491 * Applies the defaults for the given parallel port.
     492 */
     493void ParallelPort::i_applyDefaults()
     494{
     495    /* sanity */
     496    AutoCaller autoCaller(this);
     497    AssertComRCReturnVoid (autoCaller.rc());
     498
     499    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     500
     501    /* Set some more defaults based on the slot. */
     502    switch (m->bd->ulSlot)
     503    {
     504        case 0:
     505        {
     506            m->bd->ulIOBase = 0x378;
     507            m->bd->ulIRQ = 7;
     508            break;
     509        }
     510        case 1:
     511        {
     512            m->bd->ulIOBase = 0x278;
     513            m->bd->ulIRQ = 5;
     514            break;
     515        }
     516        default: break;
     517    }
     518}
    517519
    518520/* vi: set tabstop=4 shiftwidth=4 expandtab: */
Note: See TracChangeset for help on using the changeset viewer.

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