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

« back to all changes in this revision

Viewing changes to base/maint.py

  • 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:
33
33
    ok = loadpaper_ui()
34
34
    if ok:
35
35
        dev.writeEmbeddedPML(pml.OID_AUTO_ALIGNMENT,
36
 
                             pml.AUTO_ALIGNMENT, style=0, 
 
36
                             pml.AUTO_ALIGNMENT, style=0,
37
37
                             direct=True)
38
38
        dev.closePrint()
39
39
 
40
40
    return ok
41
 
    
 
41
 
42
42
def AlignType1PML(dev, loadpaper_ui): # Auto VIP (using PML)
43
43
    ok = loadpaper_ui()
44
44
    if ok:
404
404
 
405
405
    log.debug("Pattern=%d" % pattern)
406
406
    return pattern
407
 
    
 
407
 
408
408
 
409
409
def alignType10Phase1(dev):
410
410
    dev.writeEmbeddedPML(pml.OID_PRINT_INTERNAL_PAGE,
422
422
            break
423
423
        p = ''.join([p, pcl.ESC, '*o5W\x1a', chr(i), '\x00', chr(pattern), chr(x), '\n'])
424
424
 
425
 
    p = ''.join([p, pcl.UEL]) 
 
425
    p = ''.join([p, pcl.UEL])
426
426
 
427
427
    dev.printData(p)
428
428
    dev.closePrint()
490
490
                         'F' : (True, 9),
491
491
                         'G' : (True, 9),
492
492
                         'H' : (True, 9),
493
 
                         'I' : (True, 9),}    
 
493
                         'I' : (True, 9),}
494
494
 
495
495
    else:
496
496
        if pattern == 1:
530
530
    if pattern is None:
531
531
        invalidpen_ui()
532
532
        return
533
 
        
 
533
 
534
534
    state = 0
535
535
    while state != -1:
536
536
        if state == 0:
570
570
    elif dev.pen_config == AGENT_CONFIG_PHOTO_ONLY:
571
571
        return None
572
572
 
573
 
    log.debug("Pattern=%d" % pattern) 
 
573
    log.debug("Pattern=%d" % pattern)
574
574
    return pattern
575
 
    
 
575
 
576
576
 
577
577
def alignType11Phase1(dev):
578
578
    dev.printData(ldl.buildResetPacket())
622
622
 
623
623
calibrationSession = 1
624
624
 
625
 
def dataModelHelper(dev, ui2):
626
 
    data = status.StatusType10FetchUrl(dev, "/Calibration/State")
 
625
def dataModelHelper(dev, func, ui2):
 
626
    data = status.StatusType10FetchUrl(func, "/Calibration/State")
627
627
    if not data:
628
 
        data = status.StatusType10FetchUrl(dev, "/Calibration/State")
 
628
        data = status.StatusType10FetchUrl(func, "/Calibration/State")
629
629
 
630
630
    if not data:
631
631
        log.debug("Unable to retrieve calibration state")
 
632
        dev.close()
632
633
        return 0
633
634
 
634
635
    if "ParmsRequested" in data:
635
636
        log.error("Restart device and start alignment")
636
 
        return 1 
 
637
        dev.close()
 
638
        return 1
637
639
 
638
640
    if "404 Not Found" in data:
639
641
        log.error("Device may not support Alignment")
 
642
        dev.close()
640
643
        return 1
641
644
 
642
645
    if "Printing<" in data:
643
646
        log.warn("Previous alignment job not completed")
 
647
        dev.close()
644
648
        return 1
645
649
 
646
 
    data = status.StatusType10FetchUrl(dev, "/DevMgmt/ConsumableConfigDyn.xml")
 
650
    data = status.StatusType10FetchUrl(func, "/DevMgmt/ConsumableConfigDyn.xml")
647
651
    if "AlignmentMode" not in data:
648
652
        log.error("Device may not support Alignment")
649
 
        return 1 
 
653
        dev.close()
 
654
        return 1
650
655
 
651
656
    if "automatic" in data:
652
657
        log.debug("Device supports automatic calibration")
653
 
        status.StatusType10FetchUrl(dev, "/Calibration/Session", "<cal:CalibrationState xmlns:cal=\\\"http://www.hp.com/schemas/imaging/con/cnx/markingagentcalibration/2009/04/08\\\" xmlns:dd=\\\"http://www.hp.com/schemas/imaging/con/dictionaries/1.0/\\\">Printing</cal:CalibrationState>")
 
658
        status.StatusType10FetchUrl(func, "/Calibration/Session", "<cal:CalibrationState xmlns:cal=\\\"http://www.hp.com/schemas/imaging/con/cnx/markingagentcalibration/2009/04/08\\\" xmlns:dd=\\\"http://www.hp.com/schemas/imaging/con/dictionaries/1.0/\\\">Printing</cal:CalibrationState>")
 
659
        dev.close()
654
660
        return 0
655
661
 
656
662
    if "semiAutomatic" in data:
657
663
        log.debug("Device supports semiAutomatic calibration")
658
 
        status.StatusType10FetchUrl(dev, "/Calibration/Session", "<cal:CalibrationState xmlns:cal=\\\"http://www.hp.com/schemas/imaging/con/cnx/markingagentcalibration/2009/04/08\\\" xmlns:dd=\\\"http://www.hp.com/schemas/imaging/con/dictionaries/1.0/\\\">Printing</cal:CalibrationState>")
 
664
        status.StatusType10FetchUrl(func, "/Calibration/Session", "<cal:CalibrationState xmlns:cal=\\\"http://www.hp.com/schemas/imaging/con/cnx/markingagentcalibration/2009/04/08\\\" xmlns:dd=\\\"http://www.hp.com/schemas/imaging/con/dictionaries/1.0/\\\">Printing</cal:CalibrationState>")
 
665
        dev.close()
659
666
        return ui2()
660
667
 
661
668
    if "manual" in data:
662
669
        log.debug("Device supports manual calibration")
663
 
        data = status.StatusType10FetchUrl(dev, "/Calibration/Session", "<cal:CalibrationState xmlns:cal=\\\"http://www.hp.com/schemas/imaging/con/cnx/markingagentcalibration/2009/04/08\\\" xmlns:dd=\\\"http://www.hp.com/schemas/imaging/con/dictionaries/1.0/\\\">Printing</cal:CalibrationState>")
 
670
        data = status.StatusType10FetchUrl(func, "/Calibration/Session", "<cal:CalibrationState xmlns:cal=\\\"http://www.hp.com/schemas/imaging/con/cnx/markingagentcalibration/2009/04/08\\\" xmlns:dd=\\\"http://www.hp.com/schemas/imaging/con/dictionaries/1.0/\\\">Printing</cal:CalibrationState>")
664
671
        import string
665
672
        data = string.split(data, "/Jobs")[1]
666
673
        data = string.split(data, "\r\n")[0]
667
674
        data = "/Jobs" + data
668
 
        data = status.StatusType10FetchUrl(dev, data)
 
675
        data = status.StatusType10FetchUrl(func, data)
669
676
        data = string.split(data, "Session/")[1]
670
677
        data = string.split(data, "<")[0]
671
678
        data = "/Calibration/Session/" + data + "/ManualSelectedPatterns.xml"
672
679
        global calibrationSession
673
 
        calibrationSession = data 
674
 
 
 
680
        calibrationSession = data
 
681
        dev.close()
675
682
    return 0
676
683
 
677
684
def AlignType16Manual(dev, a, b, c, d, e, f, g, h, i):
678
685
    log.debug("a=%s b=%s c=%s d=%s e=%s f=%s g=%s h=%s i=%s" % (a, b, c, d, e, f, g, h, i ))
679
 
    data = status.StatusType10FetchUrl(dev, "/Calibration/State")
680
 
   
 
686
    data = status.StatusType10FetchUrl(func, "/Calibration/State")
 
687
 
681
688
    if not data:
682
689
        return 0
683
690
 
684
691
    while "ParmsRequested" not in data:
685
692
        if "CalibrationValid" in data:
686
693
            return
687
 
        data = status.StatusType10FetchUrl(dev, "/Calibration/State")
 
694
        data = status.StatusType10FetchUrl(func, "/Calibration/State")
688
695
    data = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!-- THIS DATA SUBJECT TO DISCLAIMER(S) INCLUDED WITH THE PRODUCT OF ORIGIN. -->\n<ManualSelectedPatterns xmlns=\"http://www.hp.com/schemas/imaging/con/cnx/markingagentcalibration/2009/04/08\" xmlns:locid=\"http://www.hp.com/schemas/imaging/con/ledm/localizationids/2007/10/31/\" xmlns:psdyn=\"http://www.hp.com/schemas/imaging/con/ledm/productstatdyn/2007/10/31\"><SelectedPattern><Identifier><Id>1</Id></Identifier><Choice><Identifier><Id>%s</Id></Identifier></Choice></SelectedPattern><SelectedPattern><Identifier><Id>2</Id></Identifier><Choice><Identifier><Id>%s</Id></Identifier></Choice></SelectedPattern><SelectedPattern><Identifier><Id>3</Id></Identifier><Choice><Identifier><Id>%s</Id></Identifier></Choice></SelectedPattern><SelectedPattern><Identifier><Id>4</Id></Identifier><Choice><Identifier><Id>%s</Id></Identifier></Choice></SelectedPattern><SelectedPattern><Identifier><Id>5</Id></Identifier><Choice><Identifier><Id>%s</Id></Identifier></Choice></SelectedPattern><SelectedPattern><Identifier><Id>6</Id></Identifier><Choice><Identifier><Id>%s</Id></Identifier></Choice></SelectedPattern><SelectedPattern><Identifier><Id>7</Id></Identifier><Choice><Identifier><Id>%s</Id></Identifier></Choice></SelectedPattern><SelectedPattern><Identifier><Id>8</Id></Identifier><Choice><Identifier><Id>%s</Id></Identifier></Choice></SelectedPattern><SelectedPattern><Identifier><Id>9</Id></Identifier><Choice><Identifier><Id>%s</Id></Identifier></Choice></SelectedPattern></ManualSelectedPattern>" % ( a, b, c, d, e, f, g, h, i )
689
696
    data = "PUT %s HTTP/1.1\r\nHost: localhost\r\nUser-Agent: hp\r\nAccept: text/plain\r\nAccept-Language: en-us,en\r\nAccept-Charset:utf-8\r\nContent-Type: text/xml\r\nContent-Length: %s\r\n\r\n" % ( calibrationSession, len(data)) + data
690
 
    data = status.StatusType10FetchUrl(dev, calibrationSession, data)
 
697
    data = status.StatusType10FetchUrl(func, calibrationSession, data)
691
698
 
692
699
def AlignType15(dev, loadpaper_ui, ui2):
693
700
    if not loadpaper_ui():
694
701
        return
695
 
    return dataModelHelper(dev, ui2)
 
702
    return dataModelHelper(dev, dev.getEWSUrl_LEDM, ui2)
696
703
 
697
704
def AlignType15Phase1(dev, ui2):
698
 
    return dataModelHelper(dev, ui2)
 
705
    return dataModelHelper(dev, dev.getEWSUrl_LEDM, ui2)
 
706
 
 
707
#AlignType 17 is LEDM via FF/CC/0 USB channel
 
708
def AlignType17(dev, loadpaper_ui, ui2):
 
709
    if not loadpaper_ui():
 
710
        return
 
711
    return dataModelHelper(dev, dev.getUrl_LEDM, ui2)
 
712
 
 
713
def AlignType17Phase1(dev, ui2):
 
714
    return dataModelHelper(dev, dev.getUrl_LEDM, ui2)
699
715
 
700
716
def AlignType16(dev, loadpaper_ui, align_ui):
701
717
    if not loadpaper_ui():
702
718
        return
703
 
    dataModelHelper(dev, align_ui)
 
719
    dataModelHelper(dev, dev.getEWSUrl_LEDM, align_ui)
704
720
    state, a, b, c, d, e, f, g, h, i = 0, 6, 6, 3, 3, 6, 6, 6, 6, 6
705
721
    ok = False
706
722
    while state != -1:
773
789
    if pattern is None:
774
790
        invalidpen_ui()
775
791
        return
776
 
        
 
792
 
777
793
    state = 0
778
794
    while state != -1:
779
795
        if state == 0:
813
829
    elif dev.pen_config == AGENT_CONFIG_PHOTO_ONLY:
814
830
        return None
815
831
 
816
 
    log.debug("Pattern=%d" % pattern) 
 
832
    log.debug("Pattern=%d" % pattern)
817
833
    return pattern
818
 
    
 
834
 
819
835
 
820
836
def alignType14Phase1(dev):
821
837
    dev.printData(ldl.buildResetPacket())
1227
1243
 
1228
1244
    dev.printData(s)
1229
1245
    dev.closePrint()
1230
 
    
1231
 
    
 
1246
 
 
1247
 
1232
1248
def AlignType12(dev, loadpaper_ui):
1233
1249
    if loadpaper_ui():
1234
1250
        dev.setPML(pml.OID_PRINT_INTERNAL_PAGE, pml.PRINT_INTERNAL_PAGE_ALIGNMENT_PAGE)
1603
1619
def colorCalType4Phase1(dev):
1604
1620
    dev.setPML(pml.OID_PRINT_INTERNAL_PAGE,
1605
1621
              pml.PRINT_INTERNAL_PAGE_COLOR_CAL)
1606
 
              
 
1622
 
1607
1623
    dev.closePML()
1608
1624
 
1609
1625
 
1637
1653
 
1638
1654
    dev.setPML(pml.OID_COLOR_CALIBRATION_ARRAY_1,
1639
1655
                            kadj)
1640
 
                            
 
1656
 
1641
1657
    dev.setPML(pml.OID_COLOR_CALIBRATION_ARRAY_2,
1642
1658
                            Cadj)
1643
 
                            
 
1659
 
1644
1660
    dev.setPML(pml.OID_COLOR_CALIBRATION_ARRAY_3,
1645
1661
                            Madj)
1646
 
    
 
1662
 
1647
1663
    dev.setPML(pml.OID_COLOR_CALIBRATION_ARRAY_4,
1648
1664
                            Yadj)
1649
 
                            
 
1665
 
1650
1666
    dev.setPML(pml.OID_COLOR_CALIBRATION_ARRAY_5,
1651
1667
                            cadj)
1652
 
    
 
1668
 
1653
1669
    dev.setPML(pml.OID_COLOR_CALIBRATION_ARRAY_6,
1654
1670
                            madj)
1655
 
                            
 
1671
 
1656
1672
    dev.closePML()
1657
1673
 
1658
1674
 
1659
1675
def colorCalType4Phase3(dev):
1660
1676
    dev.setPML(pml.OID_PRINT_INTERNAL_PAGE,
1661
1677
                         pml.PRINT_INTERNAL_PAGE_COLOR_PALETTE_CMYK_PAGE)
1662
 
                         
 
1678
 
1663
1679
    dev.closePML()
1664
1680
 
1665
1681
 
1668
1684
        dev.printData("""\x1b%-12345X@PJL ENTER LANGUAGE=PCL3GUI\n\x1bE\x1b%Puifp.multi_button_push 20;\nudw.quit;\x1b*rC\x1bE\x1b%-12345X""")
1669
1685
        dev.closePrint()
1670
1686
 
1671
 
        
 
1687
 
1672
1688
def colorCalType6(dev, loadpaper_ui):
1673
1689
    if loadpaper_ui():
1674
1690
        dev.setPML(pml.OID_PRINT_INTERNAL_PAGE, pml.PRINT_INTERNAL_PAGE_COLOR_CAL)
1675
1691
        dev.closePML()
1676
 
        
 
1692
 
1677
1693
def colorCalType7(dev, loadpaper_ui):
1678
1694
    if loadpaper_ui():
1679
1695
        dev.setPML(pml.OID_PRINT_INTERNAL_PAGE, pml.PRINT_INTERNAL_PAGE_AUTOMATIC_COLOR_CALIBRATION)
1680
1696
        dev.closePML()
1681
1697
 
1682
 
# ********************** LF Cal **********************        
1683
 
        
 
1698
# ********************** LF Cal **********************
 
1699
 
1684
1700
def linefeedCalType1(dev, loadpaper_ui):
1685
1701
    if loadpaper_ui():
1686
1702
        dev.printData("""\x1b%-12345X@PJL ENTER LANGUAGE=PCL3GUI\n\x1bE\x1b%Puifp.multi_button_push 3;\nudw.quit;\x1b*rC\x1bE\x1b%-12345X""")
1687
1703
        dev.closePrint()
1688
 
        
 
1704
 
1689
1705
def linefeedCalType2(dev, loadpaper_ui):
1690
1706
    if loadpaper_ui():
1691
1707
        dev.setPML(pml.OID_PRINT_INTERNAL_PAGE, pml.PRINT_INTERNAL_PAGE_LINEFEED_CALIBRATION)
1692
1708
        dev.closePML()
1693
1709
 
1694
1710
 
1695
 
# ********************** PQ Diag **********************        
1696
 
        
 
1711
# ********************** PQ Diag **********************
 
1712
 
1697
1713
def printQualityDiagType1(dev, loadpaper_ui):
1698
1714
    if loadpaper_ui():
1699
1715
        dev.printData("""\x1b%-12345X@PJL ENTER LANGUAGE=PCL3GUI\n\x1bE\x1b%Puifp.multi_button_push 14;\nudw.quit;\x1b*rC\x1bE\x1b%-12345X""")