~ubuntu-branches/ubuntu/raring/hplip/raring

« back to all changes in this revision

Viewing changes to scan/sane/hpaio.c

  • Committer: Bazaar Package Importer
  • Author(s): Mark Purcell
  • Date: 2009-12-14 20:08:44 UTC
  • mfrom: (2.1.118 lucid)
  • Revision ID: james.westby@ubuntu.com-20091214200844-z8qhqwgppbu3t7ze
Tags: 3.9.10-4
KBSD patch from KiBi (Closes: #560796)

Show diffs side-by-side

added added

removed removed

Lines of Context:
856
856
                hpaio->currentAdfMode = ADF_MODE_AUTO;
857
857
            }
858
858
            break;
859
 
#if 0
 
859
#if 1
860
860
        case OPTION_DUPLEX:
861
861
            hpaio->currentDuplex = SANE_FALSE;
862
862
            break;
1070
1070
        reload |= SANE_INFO_RELOAD_OPTIONS;
1071
1071
    }
1072
1072
 
1073
 
#if 0
 
1073
#if 1
1074
1074
    /* OPTION_DUPLEX: */
1075
1075
    if( initValues ||
1076
1076
        ( ( hpaio->supportsDuplex &&
1302
1302
                                         SANE_CAP_ADVANCED;
1303
1303
    hpaio->option[OPTION_ADF_MODE].constraint_type = SANE_CONSTRAINT_STRING_LIST;
1304
1304
    hpaio->option[OPTION_ADF_MODE].constraint.string_list = hpaio->adfModeList;
1305
 
#if 0
1306
 
    hpaio->option[OPTION_DUPLEX].name = STR_NAME_DUPLEX;
1307
 
    hpaio->option[OPTION_DUPLEX].title = STR_TITLE_DUPLEX;
1308
 
    hpaio->option[OPTION_DUPLEX].desc = STR_DESC_DUPLEX;
1309
 
    hpaio->option[OPTION_DUPLEX].type = SANE_TYPE_BOOL;
1310
 
    hpaio->option[OPTION_DUPLEX].unit = SANE_UNIT_NONE;
1311
 
    hpaio->option[OPTION_DUPLEX].size = sizeof( SANE_Bool );
1312
 
    hpaio->option[OPTION_DUPLEX].cap = SANE_CAP_SOFT_SELECT |
 
1305
 
 
1306
    // Duplex scanning is supported
 
1307
    if (hpaio->supportsDuplex  == 1)
 
1308
    {
 
1309
       hpaio->option[OPTION_DUPLEX].name = STR_NAME_DUPLEX;
 
1310
       hpaio->option[OPTION_DUPLEX].title = STR_TITLE_DUPLEX;
 
1311
       hpaio->option[OPTION_DUPLEX].desc = STR_DESC_DUPLEX;
 
1312
       hpaio->option[OPTION_DUPLEX].type = SANE_TYPE_BOOL;
 
1313
       hpaio->option[OPTION_DUPLEX].unit = SANE_UNIT_NONE;
 
1314
       hpaio->option[OPTION_DUPLEX].size = sizeof( SANE_Bool );
 
1315
       hpaio->option[OPTION_DUPLEX].cap = SANE_CAP_SOFT_SELECT |
1313
1316
                                       SANE_CAP_SOFT_DETECT |
1314
1317
                                       SANE_CAP_ADVANCED;
1315
 
    hpaio->option[OPTION_DUPLEX].constraint_type = SANE_CONSTRAINT_NONE;
1316
 
#endif
 
1318
       hpaio->option[OPTION_DUPLEX].constraint_type = SANE_CONSTRAINT_NONE;
 
1319
    }
1317
1320
    hpaio->option[GROUP_GEOMETRY].title = STR_TITLE_GEOMETRY;
1318
1321
    hpaio->option[GROUP_GEOMETRY].type = SANE_TYPE_GROUP;
1319
1322
    hpaio->option[GROUP_GEOMETRY].cap = SANE_CAP_ADVANCED;
1532
1535
        retcode = SclInquire(hpaio->deviceid, hpaio->scan_channelid, SCL_CMD_INQUIRE_DEVICE_PARAMETER,
1533
1536
                              SCL_INQ_ADF_DOCUMENT_LOADED, &documentLoaded, 0, 0);
1534
1537
                              
1535
 
        if (retcode != SANE_STATUS_GOOD)
 
1538
        if (retcode != SANE_STATUS_GOOD)
1536
1539
            goto bugout;
1537
1540
    }
1538
1541
 
1548
1551
       goto bugout;    /* no paper loaded, use flatbed */
1549
1552
    
1550
1553
    /* Assume ADF mode. */
1551
 
    if (documentLoaded)
1552
 
       retcode = hpaioSclSendCommandCheckError(hpaio, SCL_CMD_CHANGE_DOCUMENT, SCL_CHANGE_DOC_SIMPLEX);
 
1554
    if (documentLoaded || (hpaio->currentSideNumber == 2) ) 
 
1555
    {
 
1556
        if (hpaio->currentDuplex)
 
1557
        {
 
1558
            /* Duplex change document. */
 
1559
            if(hpaio->currentSideNumber == 2)
 
1560
               hpaio->currentSideNumber = 1;
 
1561
            else
 
1562
               hpaio->currentSideNumber = 2;
 
1563
 
 
1564
            retcode=hpaioSclSendCommandCheckError(hpaio, SCL_CMD_CHANGE_DOCUMENT, SCL_CHANGE_DOC_DUPLEX); 
 
1565
        }
 
1566
        else 
 
1567
        {
 
1568
             /* Simplex change document. */
 
1569
             retcode = hpaioSclSendCommandCheckError(hpaio, SCL_CMD_CHANGE_DOCUMENT, SCL_CHANGE_DOC_SIMPLEX);
 
1570
        }
 
1571
        hpaio->currentPageNumber++;
 
1572
    }
1553
1573
    else
1554
1574
       retcode = SANE_STATUS_NO_DOCS;
1555
1575
 
1560
1580
    return retcode;
1561
1581
}
1562
1582
 
1563
 
 
1564
1583
/******************************************************* SANE API *******************************************************/
1565
1584
 
1566
1585
extern SANE_Status sane_hpaio_init(SANE_Int * pVersionCode, SANE_Auth_Callback authorize)
1662
1681
    hpaio->scan_channelid = -1;
1663
1682
    hpaio->cmd_channelid = -1;
1664
1683
 
 
1684
    // Set the duplex type supported
 
1685
    if (ma.scantype == HPMUD_SCANTYPE_SCL_DUPLEX) 
 
1686
      hpaio->supportsDuplex = 1;
 
1687
    else
 
1688
      hpaio->supportsDuplex = 0;
 
1689
 
1665
1690
    /* Get the device ID string and initialize the SANE_Device structure. */
1666
1691
    memset(deviceIDString, 0, sizeof(deviceIDString));
1667
1692
    
1686
1711
 
1687
1712
    /* Initialize option descriptors. */
1688
1713
    hpaioSetupOptions( hpaio ); 
 
1714
    hpaio->currentSideNumber = 1;
 
1715
 
1689
1716
 
1690
1717
//BREAKPOINT;
1691
1718
    
2453
2480
                            break;
2454
2481
                    }
2455
2482
                    break;
2456
 
#if 0
 
2483
#if 1
2457
2484
                case OPTION_DUPLEX:
2458
2485
                    *pIntValue = hpaio->currentDuplex;
2459
2486
                    break;
2628
2655
                        break;
2629
2656
                    }
2630
2657
                    return SANE_STATUS_INVAL;
2631
 
#if 0
 
2658
#if 1
2632
2659
                case OPTION_DUPLEX:
2633
2660
                    if( *pIntValue != SANE_FALSE && *pIntValue != SANE_TRUE )
2634
2661
                    {
2784
2811
    if (hpaio->scannerType==SCANNER_TYPE_PML)
2785
2812
        return pml_start(hpaio);
2786
2813
 
2787
 
    /* TODO: convert to scl_start. des */
 
2814
      /* TODO: convert to scl_start. des */
2788
2815
 
2789
2816
    /* If we just scanned the last page of a batch scan, then return the obligatory SANE_STATUS_NO_DOCS condition. */
2790
2817
    if( hpaio->noDocsConditionPending )
2793
2820
        retcode = SANE_STATUS_NO_DOCS;
2794
2821
        goto abort;
2795
2822
    }
2796
 
 
2797
2823
    /* Open scanner command channel. */
2798
2824
    retcode = hpaioConnPrepareScan( hpaio );
2799
2825
    
2801
2827
    {
2802
2828
        goto abort;
2803
2829
    }
2804
 
 
2805
2830
    /* Change document if needed. */
2806
2831
    hpaio->beforeScan = 1;
2807
2832
    retcode = hpaioAdvanceDocument( hpaio );