VirtualBox

Changeset 43428 in vbox for trunk/src/VBox/Devices/Parallel


Ignore:
Timestamp:
Sep 25, 2012 12:35:17 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
80927
Message:

Devices/Parallel: Extra Debug statements to debug issue with user. Will revert the changes soon.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Parallel/DrvHostParallel.cpp

    r43393 r43428  
    403403    hDevInfo = SetupDiGetClassDevs(NULL, 0, 0, DIGCF_PRESENT | DIGCF_ALLCLASSES);
    404404    if (hDevInfo == INVALID_HANDLE_VALUE)
     405    {
     406        LogFlowFunc(("Invalid Handle \n"));
    405407        return VERR_INVALID_HANDLE;
     408    }
    406409
    407410    /* Enumerate through all devices in Set. */
     
    415418        while (!SetupDiGetDeviceRegistryProperty(hDevInfo, &DeviceInfoData, SPDRP_FRIENDLYNAME,
    416419                                                 (PDWORD)&dwDataType, (uint8_t *)pBuf,
    417                                                  dwBufSize, (PDWORD)&dwBufSize)
    418                && GetLastError() == ERROR_INSUFFICIENT_BUFFER)
     420                                                 dwBufSize, (PDWORD)&dwBufSize))
    419421        {
    420             if (pBuf)
    421                  RTMemFree(pBuf);
    422             /* Max size will never be more than 2048 bytes */
    423             pBuf = (uint8_t *)RTMemAlloc(dwBufSize * 2);
     422            if (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
     423            {
     424                LogFlow(("ERROR_INSUFF_BUFF = %d. dwBufSz = %d\n", GetLastError(), dwBufSize));
     425                if (pBuf)
     426                    RTMemFree(pBuf);
     427                 /* Max size will never be more than 2048 bytes */
     428                if (dwBufSize > 1024 || dwBufSize < 0)
     429                    dwBufSize = 1024;
     430                pBuf = (uint8_t *)RTMemAlloc(dwBufSize * 2);
     431            }
     432            else
     433            {
     434                LogFlow(("GetDevProp Error = %d & dwBufSz = %d\n", GetLastError(), dwBufSize));
     435                break;
     436            }
    424437        }
    425438        if(!pBuf)
    426             return VERR_NO_MEMORY;
    427 
     439        {
     440            LogFlowFunc(("No Memory to save ParportString\n"));
     441            /* Trying once more  with fixed length, assuming friendly name
     442             * will not be bigger than 2048
     443             */
     444            pBuf = (uint8_t *)RTMemAlloc(2048);
     445            if (!pBuf)
     446            {
     447                LogFlowFunc(("Fixed allocation failed\n"));
     448                return VERR_NO_MEMORY;
     449            }
     450            if (!SetupDiGetDeviceRegistryProperty(hDevInfo, &DeviceInfoData, SPDRP_FRIENDLYNAME,
     451                                                 (PDWORD)&dwDataType, (uint8_t *)pBuf,
     452                                                 2048, NULL))
     453            {
     454                LogFlowFunc(("GetDevProp failed with ERR = %d\n", GetLastError()));
     455                return VERR_GENERAL_FAILURE;
     456
     457            }
     458        }
    428459        if (RTStrStr((char*)pBuf, "LPT"))
    429460        {
     
    472503                pThis->u32LptAddrStatus  = pThis->u32LptAddr + STATUS_REG_OFFSET;
    473504            }
     505            else
     506                LogFlowFunc(("u32Parport Addr No Available \n"));
    474507            if (pThis->fParportAvail)
     508            {
     509                LogFlow(("Parport found . Break from inner loop \n"));
    475510                break;
     511            }
     512        }
     513        else
     514        {
     515            LogFlow(("LPT: Parallel Port not available \n"));
    476516        }
    477517        if (pBuf)
     
    479519        if (pThis->fParportAvail)
    480520        {
     521            LogFlow(("Parport Available. Break from outer loop \n"));
    481522            /* Parallel port address has been found. No need to iterate further. */
    482523            break;
     
    586627        rc = RTErrConvertFromErrno(errno);
    587628# else /* VBOX_WITH_WIN_PARPORT_SUP */
    588     if (pThis->fParportAvail)
     629    if (!pThis->fParportAvail)
     630        LogFlowFunc(("Parport Not Available\n"));
     631    //if (pThis->fParportAvail)
    589632    {
    590633        for (size_t i = 0; i < cbWrite; i++)
     
    629672        rc = RTErrConvertFromErrno(errno);
    630673# else  /* VBOX_WITH_WIN_PARPORT_SUP */
    631     if (pThis->fParportAvail)
     674    if (!pThis->fParportAvail)
     675        LogFlowFunc(("Parport Not Available\n"));
     676    //if (pThis->fParportAvail)
    632677    {
    633678        *((uint8_t*)(pvBuf)) = 0; /* Initialize the buffer. */
     
    659704    uint64_t u64Data;
    660705    u64Data = (uint8_t)iMode;
    661     LogFlowFunc(("calling R0 to write CTRL, data=%#x\n", u64Data));
    662     if (pThis->fParportAvail)
    663     {
     706    if (!pThis->fParportAvail)
     707        LogFlowFunc(("Parport Not available\n"));
     708    //if (pThis->fParportAvail)
     709    {
     710        LogFlowFunc(("calling R0 to SetPortDirection, data=%#x\n", u64Data));
    664711        rc = PDMDrvHlpCallR0(pThis->CTX_SUFF(pDrvIns), DRVHOSTPARALLELR0OP_SETPORTDIRECTION, u64Data);
    665712        AssertRC(rc);
     
    686733    uint64_t u64Data;
    687734    u64Data = (uint8_t)fReg;
    688     LogFlowFunc(("calling R0 to write CTRL, data=%#x\n", u64Data));
    689     if (pThis->fParportAvail)
    690     {
     735    if (!pThis->fParportAvail)
     736        LogFlowFunc(("Parport Not Available\n"));
     737    //if (pThis->fParportAvail)
     738    {
     739        LogFlowFunc(("calling R0 to write CTRL, data=%#x\n", u64Data));
    691740        rc = PDMDrvHlpCallR0(pThis->CTX_SUFF(pDrvIns), DRVHOSTPARALLELR0OP_WRITECONTROL, u64Data);
    692741        AssertRC(rc);
     
    718767# else /* VBOX_WITH_WIN_PARPORT_SUP */
    719768    *pfReg = 0; /* Initialize the buffer*/
    720     if (pThis->fParportAvail)
     769    if (!pThis->fParportAvail)
     770        LogFlowFunc(("Parport Not Available\n"));
     771    //if (pThis->fParportAvail)
    721772    {
    722773        LogFlowFunc(("calling R0 to read control from parallel port\n"));
     
    738789    int rcLnx = 0;
    739790    uint8_t fReg = 0;
     791    LogFlowFunc(("%d Status  Reg\n", *pfReg));
    740792# ifndef  VBOX_WITH_WIN_PARPORT_SUP
    741793    rcLnx = ioctl(RTFileToNative(pThis->hFileDevice), PPRSTATUS, &fReg);
     
    749801# else /* VBOX_WITH_WIN_PARPORT_SUP */
    750802    *pfReg = 0; /* Intialize the buffer. */
    751     if (pThis->fParportAvail)
    752     {
    753         LogFlowFunc(("calling R0 to read status from parallel port\n"));
     803    if (!pThis->fParportAvail)
     804        LogFlowFunc(("fParport Not Available.. Error!!!!!!!!!! \n"));
     805    //if (pThis->fParportAvail)
     806    {
     807        LogFlowFunc(("calling R0 to read status from parallel port. fParport should be available\n"));
    754808        rc = PDMDrvHlpCallR0(pThis->CTX_SUFF(pDrvIns), DRVHOSTPARALLELR0OP_READSTATUS, 0);
    755809        AssertRC(rc);
     810        LogFlow(("value read from status = %d\n", *pfReg));
    756811        *pfReg = pThis->u8ReadInStatus;
    757812    }
     813
    758814# endif /* VBOX_WITH_WIN_PARPORT_SUP */
    759815    return rc;
     
    9951051        rc = RTFileOpen(&pThis->hWinFileDevice, (char *)pThis->szParportName,
    9961052                        RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);
     1053        LogFlowFunc(("RTFileOpen Return = %d\n", rc));
    9971054    }
    9981055#endif
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