Changeset 43458 in vbox
- Timestamp:
- Sep 28, 2012 6:52:23 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Parallel/DrvHostParallel.cpp
r43454 r43458 351 351 return 0; 352 352 } 353 353 /* This loop is based on the fact that only one resourece is assigned to 354 * the LPT port. If multiple resources (address range) are assigned to 355 * to LPT port, it will pick and return the last one 356 */ 354 357 for (;;) 355 358 { … … 383 386 if (pBuf) 384 387 u32ParportAddr = ((IO_DES *)pBuf)->IOD_Alloc_Base; 385 else386 LogFlowFunc(("pBuf Not Available \n"));387 388 LogFlowFunc(("called GetIOResource, ret=%#x\n", u32ParportAddr)); 388 389 rdPrevResDes = 0; … … 421 422 hDevInfo = SetupDiGetClassDevs(NULL, 0, 0, DIGCF_PRESENT | DIGCF_ALLCLASSES); 422 423 if (hDevInfo == INVALID_HANDLE_VALUE) 423 {424 LogFlowFunc(("Invalid Handle \n"));425 424 return VERR_INVALID_HANDLE; 426 }427 425 428 426 /* Enumerate through all devices in Set. */ … … 443 441 if (pBuf) 444 442 RTMemFree(pBuf); 445 /* Max size will never be more than 2048 bytes */446 if (dwBufSize > 1024 || dwBufSize < 0)447 dwBufSize = 1024;448 443 pBuf = (uint8_t *)RTMemAlloc(dwBufSize * 2); 449 444 } 450 445 else 451 446 { 447 /* No need to bother about this error (in most cases its errno=13, 448 * INVALID_DATA . Just break from here and proceed to next device 449 * enumerated item 450 */ 452 451 LogFlow(("GetDevProp Error = %d & dwBufSz = %d\n", GetLastError(), dwBufSize)); 453 452 break; 454 453 } 455 454 } 456 if(pBuf) 457 LogFlowFunc(("Got Device Entity %s\n", pBuf)); 455 458 456 if (RTStrStr((char*)pBuf, "LPT")) 459 457 { … … 505 503 LogFlowFunc(("u32Parport Addr No Available \n")); 506 504 if (pThis->fParportAvail) 507 {508 LogFlow(("Parport found . Break from inner loop \n"));509 505 break; 510 }511 }512 else513 {514 LogFlow(("LPT: Parallel Port not available \n"));515 506 } 516 507 if (pBuf) … … 518 509 if (pThis->fParportAvail) 519 510 { 520 LogFlow(("Parport Available. Break from outer loop \n"));521 511 /* Parallel port address has been found. No need to iterate further. */ 522 512 break; … … 626 616 rc = RTErrConvertFromErrno(errno); 627 617 # else /* VBOX_WITH_WIN_PARPORT_SUP */ 628 if (!pThis->fParportAvail) 629 LogFlowFunc(("Parport Not Available\n")); 630 //if (pThis->fParportAvail) 618 if (pThis->fParportAvail) 631 619 { 632 620 for (size_t i = 0; i < cbWrite; i++) … … 671 659 rc = RTErrConvertFromErrno(errno); 672 660 # else /* VBOX_WITH_WIN_PARPORT_SUP */ 673 if (!pThis->fParportAvail) 674 LogFlowFunc(("Parport Not Available\n")); 675 //if (pThis->fParportAvail) 661 if (pThis->fParportAvail) 676 662 { 677 663 *((uint8_t*)(pvBuf)) = 0; /* Initialize the buffer. */ … … 703 689 uint64_t u64Data; 704 690 u64Data = (uint8_t)iMode; 705 if (!pThis->fParportAvail) 706 LogFlowFunc(("Parport Not available\n")); 707 //if (pThis->fParportAvail) 708 { 709 LogFlowFunc(("calling R0 to SetPortDirection, data=%#x\n", u64Data)); 691 if (pThis->fParportAvail) 692 { 693 LogFlowFunc(("calling R0 to write CTRL, data=%#x\n", u64Data)); 710 694 rc = PDMDrvHlpCallR0(pThis->CTX_SUFF(pDrvIns), DRVHOSTPARALLELR0OP_SETPORTDIRECTION, u64Data); 711 695 AssertRC(rc); … … 732 716 uint64_t u64Data; 733 717 u64Data = (uint8_t)fReg; 734 if (!pThis->fParportAvail) 735 LogFlowFunc(("Parport Not Available\n")); 736 //if (pThis->fParportAvail) 718 if (pThis->fParportAvail) 737 719 { 738 720 LogFlowFunc(("calling R0 to write CTRL, data=%#x\n", u64Data)); … … 766 748 # else /* VBOX_WITH_WIN_PARPORT_SUP */ 767 749 *pfReg = 0; /* Initialize the buffer*/ 768 if (!pThis->fParportAvail) 769 LogFlowFunc(("Parport Not Available\n")); 770 //if (pThis->fParportAvail) 750 if (pThis->fParportAvail) 771 751 { 772 752 LogFlowFunc(("calling R0 to read control from parallel port\n")); … … 788 768 int rcLnx = 0; 789 769 uint8_t fReg = 0; 790 LogFlowFunc(("%d Status Reg\n", *pfReg));791 770 # ifndef VBOX_WITH_WIN_PARPORT_SUP 792 771 rcLnx = ioctl(RTFileToNative(pThis->hFileDevice), PPRSTATUS, &fReg); … … 800 779 # else /* VBOX_WITH_WIN_PARPORT_SUP */ 801 780 *pfReg = 0; /* Intialize the buffer. */ 802 if (!pThis->fParportAvail) 803 LogFlowFunc(("fParport Not Available.. Error!!!!!!!!!! \n")); 804 //if (pThis->fParportAvail) 805 { 806 LogFlowFunc(("calling R0 to read status from parallel port. fParport should be available\n")); 781 if (pThis->fParportAvail) 782 { 783 LogFlowFunc(("calling R0 to read status from parallel port\n")); 807 784 rc = PDMDrvHlpCallR0(pThis->CTX_SUFF(pDrvIns), DRVHOSTPARALLELR0OP_READSTATUS, 0); 808 785 AssertRC(rc); 809 LogFlow(("value read from status = %d\n", *pfReg));810 786 *pfReg = pThis->u8ReadInStatus; 811 787 } 812 813 788 # endif /* VBOX_WITH_WIN_PARPORT_SUP */ 814 789 return rc; … … 1050 1025 rc = RTFileOpen(&pThis->hWinFileDevice, (char *)pThis->szParportName, 1051 1026 RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE); 1052 LogFlowFunc(("RTFileOpen Return = %d\n", rc));1053 1027 } 1054 1028 #endif
Note:
See TracChangeset
for help on using the changeset viewer.