Changeset 901

Show
Ignore:
Timestamp:
04/11/03 10:50:39 (21 years ago)
Author:
jalet
Message:

Workaround for the HP "feature" of saving the page counter to NVRAM
only every time 10 new pages are printed...
Workaround for printers with volatile page counters.

Location:
pykota/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/pykota

    r900 r901  
    2323# 
    2424# $Log$ 
     25# Revision 1.18  2003/04/11 08:50:39  jalet 
     26# Workaround for the HP "feature" of saving the page counter to NVRAM 
     27# only every time 10 new pages are printed... 
     28# Workaround for printers with volatile page counters. 
     29# 
    2530# Revision 1.17  2003/04/10 21:47:20  jalet 
    2631# Job history added. Upgrade script neutralized for now ! 
     
    188193                counterbeforejob = lastpagecounter 
    189194                 
    190             # Update the quota for the previous user on this printer according  
    191             # to the job size (difference between actual counter and latest one from storage) 
     195            # if the internal lifetime page counter for this printer is 0     
     196            # then this may be a printer with a volatile counter (never 
     197            # saved to NVRAM) which has just been switched off and then on 
     198            # so we use the last page counter from the Quota Storage instead 
     199            # explanation at : http://web.mit.edu/source/third/lprng/doc/LPRng-HOWTO-15.html 
     200            if counterbeforejob == 0 : 
     201                counterbeforejob = lastpagecounter 
     202                 
     203            # Computes the last job size as the difference between internal page 
     204            # counter in the printer and last page counter taken from the Quota 
     205            # Storage database for this particular printer 
    192206            jobsize = (counterbeforejob - lastpagecounter)     
    193             if jobsize >= 0 : 
    194                 kotafilter.storage.updateUserPQuota(lastuserid, printerid, jobsize) 
    195                 kotafilter.storage.updateJobSizeInHistory(lasthistoryid, jobsize) 
    196                 kotafilter.warnUserPQuota(lastusername) 
    197             else :     
     207            if jobsize < 0 : 
     208                # Probably an HP printer which was switched off and back on,  
     209                # its primary counter is only saved in a 10 increment, so 
     210                # it may be lower than the last page counter saved in the 
     211                # Quota Storage, we take the absolute value of the difference 
     212                # this should take care of the "missing" pages. 
     213                # explanation at : http://web.mit.edu/source/third/lprng/doc/LPRng-HOWTO-15.html 
    198214                kotafilter.logger.log_message(_("Error in page count value %i for user %s on printer %s") % (jobsize, lastusername, kotafilter.printername), "error") 
     215                jobsize = abs(jobsize) 
     216                 
     217            # update the quota for the previous user on this printer  
     218            kotafilter.storage.updateUserPQuota(lastuserid, printerid, jobsize) 
     219             
     220            # update the last job size in the history 
     221            kotafilter.storage.updateJobSizeInHistory(lasthistoryid, jobsize) 
     222             
     223            # warns the last user if he is over quota 
     224            kotafilter.warnUserPQuota(lastusername) 
    199225                 
    200226            # Is the current user allowed to print at all ? 
  • pykota/trunk/NEWS

    r900 r901  
    4242          a quota check is done to eventually warn the user/admin about 
    4343          a quota which is too low to print. 
     44           
     45        - A workaround is provided for HP Printers : their internal 
     46          page counter is only saved to NVRAM in a 10 increment, so 
     47          if you switch them off and then on, the reported page counter 
     48          may be lower than the real number of pages printed. 
     49          See http://web.mit.edu/source/third/lprng/doc/LPRng-HOWTO-15.html 
     50           
     51        - A fix is provided for printers which only have a volatile   
     52          page counter (reset to 0 every time you switch the printer on) 
     53          This should allow PyKota to work fine with HP Laserjet 
     54          4L/5L/6L. 
     55          See http://web.mit.edu/source/third/lprng/doc/LPRng-HOWTO-15.html 
    4456           
    4557    - 1.02 :