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

« back to all changes in this revision

Viewing changes to scan/sane/ledm.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:
374
374
 
375
375
  if (hpmud_open_device(session->uri, ma.mfp_mode, &session->dd) != HPMUD_R_OK)
376
376
  {
377
 
    free(session);
378
 
    session = NULL;
379
 
    return SANE_STATUS_IO_ERROR;
 
377
    stat = SANE_STATUS_IO_ERROR;
 
378
    goto bugout;
380
379
  }
381
380
 
382
381
  init_options(session);
384
383
  if (bb_open(session))
385
384
  {
386
385
    stat = SANE_STATUS_IO_ERROR;
 
386
    goto bugout;
387
387
  }
388
388
 
389
389
  /* Set supported Scan Modes as determined by bb_open. */
414
414
 
415
415
  stat = SANE_STATUS_GOOD;
416
416
 
417
 
return stat;
 
417
bugout:
 
418
 
 
419
   if (stat != SANE_STATUS_GOOD)
 
420
   {
 
421
      if (session)
 
422
      {
 
423
         if (session->cd > 0)
 
424
            hpmud_close_channel(session->dd, session->cd);
 
425
         if (session->dd > 0)
 
426
            hpmud_close_device(session->dd);
 
427
         free(session);
 
428
         session = NULL;
 
429
      }
 
430
   }
 
431
 
 
432
   return stat;
418
433
}
419
434
 
420
435
const SANE_Option_Descriptor *ledm_get_option_descriptor(SANE_Handle handle, SANE_Int option)
509
524
                 i = session->adf_resolutionList[0] + 1;
510
525
                 while(i--) session->resolutionList[i] = session->adf_resolutionList[i];
511
526
               }
 
527
               ps->currentResolution = session->resolutionList[1];
512
528
               mset_result |= SANE_INFO_RELOAD_PARAMS | SANE_INFO_RELOAD_OPTIONS;
513
529
               stat = SANE_STATUS_GOOD;
514
530
               break;
762
778
  }   
763
779
 
764
780
  /* If input is ADF and ADF is empty, return SANE_STATUS_NO_DOCS. */
765
 
  if (ps->currentInputSource==IS_ADF)
 
781
  if (ps->currentInputSource==IS_ADF || ps->currentInputSource ==IS_ADF_DUPLEX)
766
782
  {
767
783
    ret = bb_is_paper_in_adf(ps);   /* 0 = no paper in adf, 1 = paper in adf, -1 = error */
768
784
    if (ret == 0)
769
785
    {
770
786
      stat = SANE_STATUS_NO_DOCS;   /* done scanning */
 
787
      SendScanEvent (ps->uri, EVENT_SCAN_ADF_NO_DOCS);
771
788
      goto bugout;
772
789
    }
773
790
    else if (ret < 0)
778
795
  }
779
796
 
780
797
   /* Start scan and get actual image traits. */
781
 
  if (bb_start_scan(ps))
782
 
  {
783
 
    stat = SANE_STATUS_IO_ERROR;
 
798
  stat = bb_start_scan(ps);
 
799
  if (stat != SANE_STATUS_GOOD)
784
800
    goto bugout;
785
 
  }
786
801
 
787
802
  if(ps->user_cancel)
788
803
  {