~ubuntu-branches/ubuntu/saucy/hplip/saucy-proposed

« back to all changes in this revision

Viewing changes to scan/sane/hpaio.c

  • Committer: Package Import Robot
  • Author(s): Mark Purcell
  • Date: 2012-05-26 11:20:39 UTC
  • mfrom: (1.5.6) (31.1.3 precise)
  • Revision ID: package-import@ubuntu.com-20120526112039-bevxczegxnbyr5m7
Tags: 3.12.4-1
* New upstream release
* Switch to source/format 3.0 (quilt) - drop dpatch
* Refreshed debian/patches
* dh_autoreconf debian/autogen.sh & set local-options single-debian-patch
* Update to debian/compat -> 9
* Fix "hardened build flags" patch from Moritz - thanks (Closes: #667828)
* Fix "duplex descriptor uninitialized" patch from Matej (Closes: #583273)
* Fix "please migrate to kde-runtime" patch from Pino (Closes: #666544)

Show diffs side-by-side

added added

removed removed

Lines of Context:
761
761
{
762
762
     int supported_res[] = {50, 75, 100, 150, 200, 300, 600, 1200, 2400, 4800, 9600};
763
763
     int i, len = sizeof(supported_res)/sizeof(int);
764
 
     SANE_Status retcode;
765
764
     
766
765
     if (hpaio->currentAdfMode == ADF_MODE_ADF || hpaio->currentAdfMode == ADF_MODE_AUTO)
767
766
     {
1342
1341
    hpaio->option[OPTION_ADF_MODE].constraint_type = SANE_CONSTRAINT_STRING_LIST;
1343
1342
    hpaio->option[OPTION_ADF_MODE].constraint.string_list = hpaio->adfModeList;
1344
1343
 
1345
 
    // Duplex scanning is supported
1346
 
    if (hpaio->supportsDuplex  == 1)
1347
 
    {
 
1344
    // hpaioUpdateDescriptors will leave this active or inactive depending
 
1345
    // on whether duplex is supported
1348
1346
       hpaio->option[OPTION_DUPLEX].name = STR_NAME_DUPLEX;
1349
1347
       hpaio->option[OPTION_DUPLEX].title = STR_TITLE_DUPLEX;
1350
1348
       hpaio->option[OPTION_DUPLEX].desc = STR_DESC_DUPLEX;
1355
1353
                                       SANE_CAP_SOFT_DETECT |
1356
1354
                                       SANE_CAP_ADVANCED;
1357
1355
       hpaio->option[OPTION_DUPLEX].constraint_type = SANE_CONSTRAINT_NONE;
1358
 
    }
 
1356
 
1359
1357
    hpaio->option[GROUP_GEOMETRY].title = STR_TITLE_GEOMETRY;
1360
1358
    hpaio->option[GROUP_GEOMETRY].type = SANE_TYPE_GROUP;
1361
1359
    hpaio->option[GROUP_GEOMETRY].cap = SANE_CAP_ADVANCED;
1673
1671
    /* Get device attributes and determine what backend to call. */
1674
1672
    snprintf(devname, sizeof(devname)-1, "hp:%s", devicename);   /* prepend "hp:" */
1675
1673
    hpmud_query_model(devname, &ma);
 
1674
   DBG(8, "sane_hpaio_open(%s): %s %d scan_type=%d scansrc=%d\n", devicename, __FILE__, __LINE__, ma.scantype, ma.scansrc);
 
1675
 
1676
1676
    if ((ma.scantype == HPMUD_SCANTYPE_MARVELL) || (ma.scantype == HPMUD_SCANTYPE_MARVELL2))
1677
1677
       return marvell_open(devicename, pHandle);
1678
1678
    if (ma.scantype == HPMUD_SCANTYPE_SOAP)
1682
1682
    if (ma.scantype == HPMUD_SCANTYPE_LEDM)
1683
1683
       return ledm_open(devicename, pHandle);
1684
1684
 
1685
 
    DBG(8, "sane_hpaio_open(%s): %s %d\n", devicename, __FILE__, __LINE__);
1686
 
 
1687
1685
    hpaio = hpaioFindScanner(devicename);
1688
1686
    
1689
1687
    if( hpaio )
2108
2106
                                }
2109
2107
 
2110
2108
            }
2111
 
            if( !hpaio->scl.adfCapability )
 
2109
            if(ma.scansrc & HPMUD_SCANSRC_FLATBED)
2112
2110
            {
 
2111
                 hpaio->scl.flatbedCapability = 1;
2113
2112
                hpaio->supportedAdfModes = ADF_MODE_FLATBED;
2114
2113
            }
2115
 
            else if( hpaio->scl.compat & SCL_COMPAT_K_SERIES &&
2116
 
                     hpaio->scl.adfCapability )
2117
 
            {
2118
 
                hpaio->supportedAdfModes = ADF_MODE_FLATBED | ADF_MODE_ADF;
2119
 
            }
2120
 
            else
2121
 
            {
2122
 
                int supportedFunctions;
2123
 
 
2124
 
                hpaio->supportedAdfModes = ADF_MODE_AUTO |
2125
 
                                           ADF_MODE_FLATBED |
2126
 
                                           ADF_MODE_ADF;
2127
 
                if( hpaio->scl.compat & ( SCL_COMPAT_1170 |
2128
 
                                          SCL_COMPAT_R_SERIES |
2129
 
                                          SCL_COMPAT_G_SERIES ) )
2130
 
                {
2131
 
                    hpaio->scl.unloadAfterScan = 1;
2132
 
                }
2133
 
                if( PmlRequestGet( hpaio->deviceid, hpaio->cmd_channelid, hpaio->scl.objSupportedFunctions ) != ERROR &&
2134
 
                    PmlGetIntegerValue( hpaio->scl.objSupportedFunctions,
 
2114
            if (hpaio->scl.adfCapability)
 
2115
            {
 
2116
               if( hpaio->scl.compat & SCL_COMPAT_K_SERIES)
 
2117
               {
 
2118
                    hpaio->supportedAdfModes  |= ADF_MODE_ADF;
 
2119
               }
 
2120
               else
 
2121
               {
 
2122
                  int supportedFunctions;
 
2123
 
 
2124
                  hpaio->supportedAdfModes |=  ADF_MODE_ADF;
 
2125
                  if (hpaio->scl.flatbedCapability)
 
2126
                        hpaio->supportedAdfModes |= ADF_MODE_AUTO;
 
2127
 
 
2128
                  if( hpaio->scl.compat & ( SCL_COMPAT_1170 | SCL_COMPAT_R_SERIES |SCL_COMPAT_G_SERIES ) )
 
2129
                  {
 
2130
                      hpaio->scl.unloadAfterScan = 1;
 
2131
                  }
 
2132
                  if( PmlRequestGet( hpaio->deviceid, hpaio->cmd_channelid, hpaio->scl.objSupportedFunctions ) != ERROR &&
 
2133
                      PmlGetIntegerValue( hpaio->scl.objSupportedFunctions,
2135
2134
                                        0,
2136
2135
                                        &supportedFunctions ) != ERROR &&
2137
2136
                    supportedFunctions & PML_SUPPFUNC_DUPLEX )
2138
 
                {
2139
 
                    hpaio->supportsDuplex = 1;
 
2137
                  {
 
2138
                      hpaio->supportsDuplex = 1;
 
2139
                  }
2140
2140
                }
2141
2141
            }
2142
2142
        }
2426
2426
       return soapht_close(handle);
2427
2427
    if (strcmp(*((char **)handle), "LEDM") == 0)
2428
2428
       return ledm_close(handle);
2429
 
 
 
2429
       
2430
2430
    DBG(8, "sane_hpaio_close(): %s %d\n", __FILE__, __LINE__); 
2431
2431
 
2432
2432
    hpaioPmlDeallocateObjects(hpaio);
2890
2890
    IP_IMAGE_TRAITS traits;
2891
2891
    IP_XFORM_SPEC xforms[IP_MAX_XFORMS], * pXform = xforms;
2892
2892
    WORD wResult;
2893
 
        
 
2893
    
 
2894
    DBG(8, "sane_hpaio_start(): %s %d deviceuri=%s\n", __FILE__, __LINE__, hpaio->deviceuri);
 
2895
 
2894
2896
    if (strcmp(*((char **)handle), "MARVELL") == 0)
2895
2897
       return marvell_start(handle);
2896
2898
    if (strcmp(*((char **)handle), "SOAP") == 0)
2902
2904
 
2903
2905
    hpaio->user_cancel = FALSE;
2904
2906
 
2905
 
    DBG(8, "sane_hpaio_start(): %s %d\n", __FILE__, __LINE__);
2906
 
 
2907
2907
    hpaio->endOfData = 0;
2908
2908
 
2909
2909
    if (hpaio->scannerType==SCANNER_TYPE_PML)
3215
3215
 
3216
3216
    if( retcode != SANE_STATUS_GOOD )
3217
3217
    {
 
3218
       if (retcode == SANE_STATUS_NO_DOCS) SendScanEvent (hpaio->deviceuri, EVENT_SCAN_ADF_NO_DOCS);
3218
3219
        sane_hpaio_cancel( handle );
3219
3220
    }
3220
3221
    return retcode;
3402
3403
extern void sane_hpaio_cancel( SANE_Handle handle )
3403
3404
{
3404
3405
    hpaioScanner_t hpaio = ( hpaioScanner_t ) handle;
3405
 
 
 
3406
    DBG(8, "sane_hpaio_cancel(): %s %d\n", __FILE__, __LINE__); 
3406
3407
    if (strcmp(*((char **)handle), "MARVELL") == 0)
3407
3408
       return marvell_cancel(handle);
3408
3409
    if (strcmp(*((char **)handle), "SOAP") == 0)
3416
3417
        bug("sane_hpaio_cancel: already cancelled!\n");
3417
3418
    }
3418
3419
    hpaio->user_cancel = TRUE;
3419
 
    DBG(8, "sane_hpaio_cancel(): %s %d\n", __FILE__, __LINE__); 
3420
3420
 
3421
3421
    if (hpaio->scannerType==SCANNER_TYPE_PML)
3422
3422
    {