Hi,

I've just joined this list, hope I've come to the right place.
I'm interested in getting the scanner button on my LaserJet 3390 to 
initiate a scan.

I've searched the archives and the net for information about this, and 
only found that it is unsupported and would require the PC to poll the 
LaserJet.

Therefore I tried to write a simple proof of concept app to accomplish 
this, which is appended last in this message. (it's probably obvious 
that it is my first SNMP application).

Unfortunately I couldn't find any info on how to poll the button status, 
only how to poll the display text. Thus the logic in the app below is to 
check the Laserjet's display for "Waiting for PC", which is what is says 
when the scanner button is pressed.

Does anyone know where to find information on how to poll the button 
directly. It would also be very cool to be able to choose different 
scanner options via the LaserJet control panel (ie poll the other 
buttons and control the display).

/Jesper Ribbe


---------------------------------
#!/usr/bin/env python

IDLE_STRS = ["Ready       Auto"]
WAIT_STRS = ["Waiting for PC"]

SCAN_CMD = "scanimage --resolution 200 --format tiff > scan%04d.tiff"

scanNr = 1

import os
import time
from pysnmp.entity.rfc3413.oneliner import cmdgen

while 1:
   errorIndication, errorStatus, errorIndex, varBinds = 
cmdgen.CommandGenerator().getCmd(
     cmdgen.CommunityData('my-agent', 'public', 0),
     cmdgen.UdpTransportTarget(('10.0.1.4', 161)),
     (1,3,6,1,4,1,11,2,3,9,1,1,3,0)
     )
#  print errorIndication
  # print errorStatus
   displayStr = varBinds[0][1]
   #print varBinds,displayStr
   if displayStr in IDLE_STRS:
       print "idle"
   elif displayStr in WAIT_STRS:
       print "should scan"
       cmd = SCAN_CMD % scanNr
       scanNr += 1
       os.system(cmd)
   else:
       print repr(displayStr)

   time.sleep(0.5)

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
HPLIP-Devel mailing list
HPLIP-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hplip-devel

Reply via email to