Open GoogleCodeExporter opened 9 years ago
same problem
Original comment by icq.6990...@gmail.com
on 5 Feb 2011 at 8:25
hi, sorry for late response, dont know if you still in trouble. Cron is to
launch scripts at scheduled times rather than launching at "needs", what you
need to do is adding a run line to the bootup scripts, eg. any script in
/etc/init.d/*
Original comment by ted.cho...@gmail.com
on 12 Feb 2011 at 11:14
Thanks for the responses, but i don't have the tools in the nas to pull this,
or i'm not finding them as i would in a normal linux distro, I know that this
is a very compact kernel, but, for example, i placed the script in the
/etc/init.d, gave execution privileges, so far so good, but i don't have an
Update-rc.d, besides using this method only enables me to send the firmare to
the printer if the nas is plugged off and then on, right? if i unplug and plug
the printer the nas will not send the firm( at least that's what i think), if
you could give me a hand, or explain very briefly how to make it work. I don't
mind punching the combo to upload the script every time that i have to print, i
wanted to do it this way cuz i'm not the only one in my house who uses the
printer, and my family don't know shit about ssh, and sihp1020.dll and such...
so i'd be really grateful if you could give me a hand on this one. Thanks in
advance, and sorry to bother.
Max.
Original comment by maximili...@gmail.com
on 13 Feb 2011 at 12:45
[deleted comment]
[deleted comment]
[deleted comment]
[deleted comment]
[deleted comment]
[deleted comment]
[deleted comment]
I can't thank you enough! i'll give it a try. GENIUS!
Original comment by maximili...@gmail.com
on 2 Mar 2011 at 4:22
[deleted comment]
[deleted comment]
[deleted comment]
I've managed to write a better script:
1. Add the following text to the last line of start() routine inside any file
in /etc/init.d of a service that you use. In my case I used ddns:
while [ ${HP_SIZE:-empty} != "126151" ] ; do
HP_SIZE=$(ls -l /tmp/sihpP1005.dl | sed 's/.*\(126151\).*/\1/')
HP_SIZE=$(echo $HP_SIZE | sed 's/.*\(sihp1020.dl\).*/\1/')
cd /tmp
wget http://oleg.wl500g.info/hplj/sihp1020.dl
sleep 20
done
/etc/init.d/shp
2. Create a file in /etc/init.d called shp with the following text:
#!/bin/sh
#
echo /dev/mdev -s > /proc/sys/kernel/hotplug
sleep 5
if [ `ls /dev/lp0 2>/dev/nul | grep -c "lp0"` -gt 0 ] ; then cat
/tmp/sihp1020.dl > /dev/lp0 ; fi
sleep 5
echo /etc/init.d/shp > /proc/sys/kernel/hotplug
3. Make it executable by setting 0755 file properties or sshing: chmod 755
/etc/init.d/shp
4. Save config file in webconfig (SYSTEM - CONFIG - SAVE CONFIG)
5. Reboot NAS
You're done. The NAS will send the firmware to the printer everytime it is
connected or the NAS is restarted.
Original comment by eliss...@gmail.com
on 31 Aug 2011 at 3:31
Why would you redownload the firmware every startup instead of saving it
somewhere?
Alternative suggestion.
Mdev runs a scripts when a device is added or removed. There's already a rule
in /etc/mdev.conf that runs /usr/share/snake/setprinter for printers.
What about creating a wrapper for setprinter that loads the firmware and then
runs the actual setprinter script?
something like:
#!/bin/sh
DEV=$1
ACTION=$2
FIRMWARE=<path to firmware>
if [ "$ACTION" = "add" ]; then
cat $FIRMWARE > /dev/$DEV
fi
/usr/share/snake/setprinter $DEV $ACTION
Save as /etc/lpfw.sh and make executable.
In /etc/mdev.conf replace
lp[0-9]* 0:0 660 */usr/share/snake/setprinter $MDEV $ACTION
with
lp[0-9]* 0:0 660 */etc/lpfw.sh $MDEV $ACTION
Note: I haven't actually tested this.
Original comment by stefansc...@googlemail.com
on 31 Aug 2011 at 8:39
In my case I have to download it every startup because I don't have a media
storage attached, and the NAS itself doesn't have sufficient memory to save
that file. I'm currently using this NAS only for the printer. I've moved the
other services to goflexnet.
I like your alternate solution. Will try it out.
Original comment by eliss...@gmail.com
on 3 Sep 2011 at 8:04
Ah ok.
I wonder if you could fit the firmware into the config partition. 128kb are
alloceted for the contents of /etc/. It's gzipped before saving. I can't check
right now if it could work but gzipping the firmware yields a 68kb file.
Original comment by stefansc...@googlemail.com
on 5 Sep 2011 at 11:43
Hi people!
Stefan,Eliss, check this out:
Copy sihp1020.dll to /etc,
then save this script, as lj1020.sh and chmod +x, (save it to /etc as well)
#!/bin/sh
FIRMWARE=”/etc/sihp1020.dll”
//The following IF contains the laserjet 1020 module id, so my guess is that
when you plug the printer, it should look for this.//
if [ "$PRODUCT" = "3f0/2b17/100" ]
then
if [ "$ACTION" = "add" ]
then
sleep 10
cat $FIRMWARE > /dev/lp0
fi
fi
Now, here's the thing, i'm thinking that this needs to be loaded in the
mdev.conf too. So the question would be: what should i do with the $MDEV and
the $ACTION variables INSIDE the script?
among other thoughts, this could also work for nas leds, at startup. There's an
issue posted with the printf commands to be loaded as a hotplug event.
So basically, here's another input, if i could get some feedback i'd be really
grateful.
Thanks in advance.
Max.
Original comment by maximili...@gmail.com
on 5 Sep 2011 at 7:04
Hi all, comment #16 is the right script for me (hp1005) with one important
comment:
the call to setprinter, must be before sending the firmware to /dev/lpx. In
other case, I was never able to load the firmware correctly. I added as well
few sleeping seconds between calling "setprinter" and sending the firmware to
the /dev/lpx.
really of help! Thank you!
Original comment by Angel.M....@gmail.com
on 16 Oct 2011 at 2:05
@Angel & @Stefan,
Thanks a lot for your help with all this.
Can anyone help me with this minor scripting problem that is still left? I
thought I had things working following both suggestions.
Stefans script, that is, and Angels suggestion to first make the call to
setprinter and then send the firmware.
What it does now is: everytime the printer is turned on, it sends the firmware
and I can print.
However, if I turn off the NAS and the printer, then turn the printer back on,
and then finally the NAS back on, then (and only then) the firmware doesn't get
sent and I cannot print. So, for example, after a power failure, things would
not work anymore.
What do you think: is this to be expected, because $action = add is never
called? (the printer is already there at startup). Is there a fix? Is it the
same for you, Angel? Can I send the firmware in another script that checks for
a printer being present at startup?
I've found a different suggestion:
http://www.dd-wrt.com/phpBB2/viewtopic.php?t=47053&postdays=0&postorder=asc&star
t=15&sid=d7b14739f78109056b71e7de558325c9
This script is from the dd-wrt discussion. Do you think it would take away the
problem I now have with Stefan's script? I don't fully understand it,
though..., and it seems to be left running all the time.
Code:
#!/bin/sh
#last line at dmesg |grep "printer.c: usblp0
#when printer is turned off
PRINTEROFF="printer.c: usblp0: removed"
#time to watch for printer state
WATCHTIME=5
FIRMWARE="/jffs/hp1018.dl"
LASTPRINTER=" "
while true; do
sleep $WATCHTIME
LAST=`dmesg |grep "printer.c: usblp0" | tail -n -1`
if [ "$LAST" != "$PRINTEROFF" ];then
if [ "$LAST" != "$LASTPRINTER" ]; then
LASTPRINTER=$LAST
#echo flashing the printer
cat $FIRMWARE > /dev/usb/lp0
fi
fi
done
Last note: There is a wiki that gives a warning that firmware should not be
loaded more than once.... However, I have not been able to check that, because
in the current script (Stefans) adding it more than once is impossible.
Reportedly this should be the case for a HP1005 (I have a HP1018, so I don't
know if it's OK to load its firmware twice) (I could check manually, of course,
and will do that in a minute). See:
http://wiki.openwrt.org/doc/howto/p910nd.server
It says there: "Some printers, like HP LaserJet 1005, stop working properly
when the firmware is loaded more than once. It's best to check whether the
firmware is already present in the printer with the usb_printerid command."
HJJ
Original comment by raadselw...@gmail.com
on 22 Mar 2012 at 9:14
Update: So, OK, I checked, I can load the firmware twice without a problem.
I will now add the line
cat /etc/init.d/sihp1018.dl >/dev/lp0
to a script in /etc/init.d
I'll take the samba script, sound like the best alternative.
Then I'll save config, turn off NAS (& printer) and try again....
However, that still was unsuccesfull. I guess that Samba was started before the
printer was started, maybe that's why the firmware wasn't sent to the
printer....
Any help would be very much appreciated!
HJJ
Original comment by raadselw...@gmail.com
on 22 Mar 2012 at 10:05
Hi all,
It worked the second time I tried it, moved the line to the top of the
/etc/init.d/samba script. So now the firmware is sent at startup and later
every time a printer is connected.
Setback: when the printer stays connected but the NAS is rebooted, the firmware
is sent for the second time. For me, this is not a problem (reportedly, for a
HP1005 it is). I have a HP1018.
HJJ
Original comment by raadselw...@gmail.com
on 23 Mar 2012 at 8:31
Hi Jansen, good you have solve it. in any case, let me show you what i did in
case it is of help.
Background:
-----------
* I have 2 hp printers:
-> Printer A: hp laserject 1005: NAS only detect it when it is switched on
-> Printer B: old hpdeskjet 940c: "infinite ink devourer" curiously, NAS detect
always this printer even if it is switched off.
My solution:
------------
Since PinterB is always detected by NAS (I was lucky here), it is always
detected as "lp0". And when PrinterA is switched on, it is detected always as
"lp1".
Hence, I did:
* store sihp1005.dl under a local usb mem (connected via usbhup):
"/usb/2G_swap/php/sihp1005.dl"
* create my own lpfs.sh to inject the firmware if a printer appears under lp1
(see below)
* modify mdev.conf to call lpfs.sh only if activity is found on lp1.
* Save conf. If you do not, you will loose any change when NAS is reloaded.
------------mdev.conf----------
sd[a-z][0-9]* 0:0 660 */usr/share/snake/automount $MDEV $ACTION
lp0* 0:0 660 */usr/share/snake/setprinter $MDEV $ACTION
lp[2-9]]* 0:0 660 */usr/share/snake/setprinter $MDEV $ACTION
lp1* 0:0 660 */etc/lpfw.sh $MDEV $ACTION
-------------end mdev.conf script---------
------lpfw.conf--------------
#!/bin/sh
DEV=$1
ACTION=$2
#
# local firmware location
FIRMWARE="/usb/2G_swap/php/sihp1005.dl"
#
echo "Adding printer with setprinter $DEV $ACTION"
/usr/share/snake/setprinter $DEV $ACTION
echo "Printer added!"
sleep 10
echo "...esperamos 10 segundos..."
# these 10 secs are given to allow printer to init with
# original firmware before loading the new fireware
if [ "$ACTION" = "add" ]; then
echo "Adding a Printer via LPFW.SH. Action: $ACTION"
if [ "$DEV" = "lp1" ]; then
echo "Loading firmware for Laser HP on dev $DEV ..."
cat $FIRMWARE > /dev/$DEV
echo "firmware $FIRMWARE cargado!"
fi
fi
------------------end lpfw.sh script -------------
I hope that helps.
By the way, I am very upset with the NAS because of the frozen transfers (issue
11). No way to make it working normally over wifi. Even over cable, if
transfers takes long, i suffer the same boring behaviour. If you know someone
that fixed it (with wifi 11g) I will be very grateful if you could give me his
contact (or ask him to contact me). I was not able to make it working neither
using the RF filters, which seemed the final solution. Very boring...
Original comment by Angel.M....@gmail.com
on 24 Mar 2012 at 10:45
Hi all, comment #16 is also the right script for me (hp1020). No but. Working
like a charm.
Thank you!
Original comment by leoic...@gmail.com
on 14 Jun 2013 at 11:54
Original issue reported on code.google.com by
maximili...@gmail.com
on 30 Nov 2010 at 4:43