Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Mon 01 Sep 2014, 22:56
All times are UTC - 4
 Forum index » Advanced Topics » Hardware » Printers
xsaneshell hack for network scanners
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [12 Posts]  
Author Message
plinej

Joined: 13 Aug 2006
Posts: 1522

PostPosted: Mon 11 Jul 2011, 18:57    Post subject:  xsaneshell hack for network scanners
Subject description: my xsaneshell hack...
 

I have an all in one HP printer/scanner on my wireless network. I was messing around with trying to get my scanner to work with lucid puppy 525 with no luck via xsane or peasyscan. I decided to hack xsaneshell to add a network button and some extra code and got it to work. For now this will only work for the first printer it finds but it should be easy enough to add a dialog box incase multiple printers are found on the network. This should find any network printer already set up in cups. I'll attach the modified script which goes in /usr/bin as well as post the code.

Code:
#!/bin/sh

COMMOUT="`cat /etc/sane.d/dll.conf | grep '^#[a-zA-Z0-9]' | tr '#' ' ' | tr '\n' ' '`"


xmessage -bg "orange" -center -title "Frontend for Xsane" -buttons "USB:10,Parallel:11,SCSI:12,NETWORK:13,QUIT:20" "NOTE:
The list of supported drivers is in text file /etc/sane.d/dll.conf
When Xsane starts, your scanner (if it is connected and turned on)
should be autodetected. However, some entries in 'dll.conf' are
commented-out. Here is the list of SANE drivers that are commented
-out in file 'dll.conf':

$COMMOUT

If your scanner is one of these, then Xsane will not auto-detect it.
-- in that case, click 'QUIT' button and open 'dll.conf' in a text
   editor and uncomment the appropriate entry.
   
Xsane may be a bit 'insane' when detecting a SCSI scanner. There are
various things that you may have to do:
1. Run 'sane-find-scanner' in a terminal window.
2. Make sure 'sg' module is loaded.
3. Specify the device on the commandline, ex: # xsane microtek2:/dev/sg3
4. or maybe a symbolic link, ex: # ln -s /dev/sg3 /dev/scanner

To continue and run Xsane, answer this question:
Do you have a parallel-port, USB, Network, or SCSI scanner?"

RETVAL=$?
case $RETVAL in
 10)
  #modprobe scanner
  #2.6 kernel does not have module 'scanner'. instead relies on libusb.
  echo
  ;;
 11)
  modprobe parport_pc
  ;;
 12)
  modprobe sg
  ;;
  13)
  mkdir -p ~/.config/xsaneshell/
  lpstat -t | grep 'device for ' | grep ' socket://' | sed 's/device\ for\ //' | cut -f 1 -d ':' > ~/.config/xsaneshell/device
  lpstat -t | grep 'device for ' | grep ' socket://' | sed 's/device\ for\ //' | cut -f 3 -d ':' | cut -f 3 -d '/' > ~/.config/xsaneshell/ip
  exec xsane :/net/`cat ~/.config/xsaneshell/device`?ip=`cat ~/.config/xsaneshell/ip` &
  exit
  ;;
 *)
  exit
  ;;
esac

sleep 1
exec xsane
xsaneshell.tar.gz
Description 
gz

 Download 
Filename  xsaneshell.tar.gz 
Filesize  1.03 KB 
Downloaded  311 Time(s) 
Back to top
View user's profile Send private message 
rcrsn51


Joined: 05 Sep 2006
Posts: 9066
Location: Stratford, Ontario

PostPosted: Mon 11 Jul 2011, 19:52    Post subject:  

What driver package did you use to install your printer? What URI is it using? Just socket://...?

I tried this but got "Error during device IO". The console had a bunch of error messages about missing modules.

How does xsane know which backend driver to use with a particular model scanner?

Also, is ":/net" correct? Or should it be "net:/"? Or "hpaio:/net/"?

Did you compile your own HPLIP package with network support?
Back to top
View user's profile Send private message 
plinej

Joined: 13 Aug 2006
Posts: 1522

PostPosted: Mon 11 Jul 2011, 20:43    Post subject:  

My network printer: Officejet_6500_E709n

I installed from the Puppy package mananger:
foomatic-db-20100216-lupu & hpijs-3.10.6-dynppd & hplip-3.9.12-scan

Here is my output:

Code:
lpstat -t | grep 'device for ' | grep ' socket://' | sed 's/device\ for\ //' | cut -f 1 -d ':'


gives me the result <Officejet_6500_E709n>

To get the ip address of my network printer:

Code:
lpstat -t | grep 'device for ' | grep ' socket://' | sed 's/device\ for\ //' | cut -f 3 -d ':' | cut -f 3 -d '/'


gives me the result <192.168.1.149>

now running the actual xsane command:

Code:
xsane :/net/Officejet_6500_E709n?ip=192.168.1.149


gives me the result:

Code:
No log handling enabled - turning on stderr logging
Cannot find module (IP-MIB): At line 0 in (none)
Cannot find module (IF-MIB): At line 0 in (none)
Cannot find module (TCP-MIB): At line 0 in (none)
Cannot find module (UDP-MIB): At line 0 in (none)
Cannot find module (HOST-RESOURCES-MIB): At line 0 in (none)
Cannot find module (SNMPv2-MIB): At line 0 in (none)
Cannot find module (SNMPv2-SMI): At line 0 in (none)
Cannot find module (NOTIFICATION-LOG-MIB): At line 0 in (none)
Cannot find module (DISMAN-EVENT-MIB): At line 0 in (none)
Cannot find module (DISMAN-SCHEDULE-MIB): At line 0 in (none)
Cannot find module (UCD-SNMP-MIB): At line 0 in (none)
Cannot find module (UCD-DEMO-MIB): At line 0 in (none)
Cannot find module (SNMP-TARGET-MIB): At line 0 in (none)
Cannot find module (NET-SNMP-AGENT-MIB): At line 0 in (none)
Cannot find module (HOST-RESOURCES-TYPES): At line 0 in (none)
Cannot find module (SNMP-FRAMEWORK-MIB): At line 0 in (none)
Cannot find module (SNMP-MPD-MIB): At line 0 in (none)
Cannot find module (SNMP-USER-BASED-SM-MIB): At line 0 in (none)
Cannot find module (SNMP-VIEW-BASED-ACM-MIB): At line 0 in (none)
Cannot find module (SNMP-COMMUNITY-MIB): At line 0 in (none)
Cannot find module (IP-FORWARD-MIB): At line 0 in (none)
Cannot find module (NET-SNMP-EXTEND-MIB): At line 0 in (none)
Cannot find module (UCD-DLMOD-MIB): At line 0 in (none)
Cannot find module (SNMP-NOTIFICATION-MIB): At line 0 in (none)
Cannot find module (SNMPv2-TM): At line 0 in (none)
Cannot find module (NET-SNMP-VACM-MIB): At line 0 in (none)

(xsane:11790): Gtk-WARNING **: GtkSpinButton: setting an adjustment with non-zero page size is deprecated


Even with all of the cannot find module messages xsane launches and works with my network scanner.

the full output of <lpstat -t> results in:

Code:
scheduler is running
system default destination: Officejet_6500_E709n
device for CUPS-PDF: pdf-writer:/export/share/pdf/
device for Officejet_6500_E709n: socket://192.168.1.149:9100
device for pdf_writer: pdf-writer:/dev/null
CUPS-PDF accepting requests since Sat 03 Jul 2010 04:06:21 AM EDT
Officejet_6500_E709n accepting requests since Mon 11 Jul 2011 01:55:14 PM EDT
pdf_writer accepting requests since Sat 03 Jul 2010 04:13:54 AM EDT
printer CUPS-PDF is idle.  enabled since Sat 03 Jul 2010 04:06:21 AM EDT
printer Officejet_6500_E709n is idle.  enabled since Mon 11 Jul 2011 01:55:14 PM EDT
printer pdf_writer is idle.  enabled since Sat 03 Jul 2010 04:13:54 AM EDT


net:/ And hpaio:/net/ both work
Back to top
View user's profile Send private message 
rcrsn51


Joined: 05 Sep 2006
Posts: 9066
Location: Stratford, Ontario

PostPosted: Mon 11 Jul 2011, 20:54    Post subject:  

Wow. The correct URI I saw on an HP site is
Code:
xsane hpaio:/net/Officejet_6500_E709n?ip=192.168.1.149

so I'm surprised that it works at all.

I am trying the same thing with an Officejet 4500. I get the same set of error messages as you, but then Xsane aborts with an I/O error.

I saw a reference that you can fix this by turning on "SNMP writing" somewhere. I think that they were talking about a router setting.

I suspect that this method only applies to HP scanners.
Back to top
View user's profile Send private message 
plinej

Joined: 13 Aug 2006
Posts: 1522

PostPosted: Mon 11 Jul 2011, 20:57    Post subject:  

That's possible, hopefully it helps someone out though.
Back to top
View user's profile Send private message 
rcrsn51


Joined: 05 Sep 2006
Posts: 9066
Location: Stratford, Ontario

PostPosted: Mon 11 Jul 2011, 21:07    Post subject:  

It works! I had been testing in Quirky, but when I switched to Lupu it worked.

I will set up a Brother networked printer and see what happens there.

Thanks.

[Edit] Your method did not work with a Brother unit. However, Brother has their own method for setting up a networked scanner which works fine in Puppy.
Back to top
View user's profile Send private message 
rcrsn51


Joined: 05 Sep 2006
Posts: 9066
Location: Stratford, Ontario

PostPosted: Mon 11 Jul 2011, 22:22    Post subject:  

I got HP network scanning working with Quirky and Wary. The problem was that CUPS 1.3.11 did not correctly report the device name. If I used the CUPS 1.4 name, xsane would scan.

Also, I was able to modify Peasyscan so it would work with a networked HP scanner.
Back to top
View user's profile Send private message 
plinej

Joined: 13 Aug 2006
Posts: 1522

PostPosted: Mon 11 Jul 2011, 22:29    Post subject:  

Did you post an update for peasyscan? I wouldn't mind using that.
Back to top
View user's profile Send private message 
rcrsn51


Joined: 05 Sep 2006
Posts: 9066
Location: Stratford, Ontario

PostPosted: Mon 11 Jul 2011, 22:39    Post subject:  

It takes some manual modification.

1. Go to the folder /usr/local/peasyscan.

2. Open the file "peasyscan" and delete Lines 6-10. This block of code checks for a scanner. But the scanimage command can't detect a remote HP scanner.

3. Open the file "scan". Change Line 3 from
Code:
$PEASYPATH/xscanimage-peasy 2> /dev/null

to, for example:
Code:
$PEASYPATH/xscanimage-peasy hpaio:/net/Officejet_4500_G510n-z?ip=192.168.2.215 2> /dev/null


So instead of running xsane, you are launching xscanimage-peasy with the command line from your hack above.

Please report back.

[Update] Read here for a patch that lets Peasyscan access HP networked printer/scanners.

Last edited by rcrsn51 on Tue 12 Jul 2011, 08:37; edited 1 time in total
Back to top
View user's profile Send private message 
plinej

Joined: 13 Aug 2006
Posts: 1522

PostPosted: Tue 12 Jul 2011, 00:19    Post subject:  

Works good, thanks.
Back to top
View user's profile Send private message 
plinej

Joined: 13 Aug 2006
Posts: 1522

PostPosted: Tue 12 Jul 2011, 00:34    Post subject:  

I'm not sure why but out.pnm gets saved to /root not /tmp in peasyscan so I modified the script a bit to find the file in /root instead.
Back to top
View user's profile Send private message 
rcrsn51


Joined: 05 Sep 2006
Posts: 9066
Location: Stratford, Ontario

PostPosted: Tue 12 Jul 2011, 01:01    Post subject:  

Press the Reset button in the first screen. That will get the output going back to /tmp.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [12 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Hardware » Printers
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0817s ][ Queries: 12 (0.0041s) ][ GZIP on ]