[SOLVED] p910nd and HP1020

Re: p910nd and HP1020

Postby Jocko » Thu Apr 16, 2015 11:38 am

matt_max wrote:One thing is strange: when I change /etc/services, restart the daemon and try to print something I see that job in spool but printer do nothing.
Maybe we didn't use the right service name.

matt_max wrote:I have to send firmware first:
Code:
cat /direct-usb/public/sihp1020.dl > /dev/usb/lp0

then the printer "wakes up". After that I can send document and HP1020 starts printing (endlessly). Without firmware it is completely useless.

In my opinion, this would mean that there is a compatibility issue between our firmware and your firmware.

So no more idea
Jocko
Site Admin - expert
 
Posts: 11367
Joined: Tue Apr 12, 2011 4:48 pm
Location: Orleans, France

Re: p910nd and HP1020

Postby matt_max » Thu Apr 16, 2015 1:08 pm

Jocko wrote:Maybe we didn't use the right service name.

So what you suggest me to do? I can try to add some other name.

Jocko wrote:In my opinion, this would mean that there is a compatibility issue between our firmware and your firmware.

Maybe you are right but in DD-WRT or OpenWRT it is working and your firmware isn't significantly different.
matt_max
Donator VIP
Donator VIP
 
Posts: 124
Joined: Fri Apr 03, 2015 9:56 am
Location: Warsaw, Poland

Re: p910nd and HP1020

Postby matt_max » Thu Apr 16, 2015 1:59 pm

Ok I think I've got it. All you need to do is turn off bi-directional support in the port tab of the printer's properties dialog in Windows.
Now I need to set up some magic script to automatically send firmware to my printer when it is connected. I found this:
Code: Select all
cat /etc/hotplug.d/usb/20-hplj1020
#!/bin/sh

FIRMWARE="/usr/lib/sihp1020.dl"
DEVICE=/dev/lp0
LOGFILE=/var/log/hp

if [ "$PRODUCT" = "3f0/2b17/100" -a "$ACTION" = "add" ]
then
        for i in $(seq 30); do
                if [ -c $DEVICE ]; then
                        echo "$(date) : Sending firmware to printer." > $LOGFILE
                        cat $FIRMWARE > $DEVICE
                        echo "$(date) : done." >> $LOGFILE
                        exit
                fi
                sleep 1
        done
fi

But there is no hotplug feature in your firmware.
matt_max
Donator VIP
Donator VIP
 
Posts: 124
Joined: Fri Apr 03, 2015 9:56 am
Location: Warsaw, Poland

Re: p910nd and HP1020

Postby Jocko » Thu Apr 16, 2015 2:25 pm

matt_max wrote:hotplug feature in your firmware.
It is an old feature and replaced by udev rules.

So in the folder /etc/udev/rules.d, create a file 60-udev.rules (use a number larger than 50: your rule must be run after some rules from 50-udev.rules)

In this file add the line
Code: Select all
BUS=="usb", ENV{PRODUCT}=="3f0/2b17/100",  KERNEL=="lp0", ACTION=="add", RUN="/bin/sh /path..to/loadprinterfirmware.sh"

Then create a file loadprinterfirmware.sh where you want and put the content
Code: Select all
#!/bin/sh

FIRMWARE="/usr/lib/sihp1020.dl"  (replace with the real path)
DEVICE=/dev/lp0
LOGFILE=/var/log/hp

for i in $(seq 30); do
     if [ -c $DEVICE ]; then
            /bin/echo "$(date) : Sending firmware to printer." > $LOGFILE
            /bin/cat $FIRMWARE > $DEVICE
            /bin/echo "$(date) : done." >> $LOGFILE
             exit
      fi
      sleep 1
done


Note: with udev rules you need to use full path with the commands
Jocko
Site Admin - expert
 
Posts: 11367
Joined: Tue Apr 12, 2011 4:48 pm
Location: Orleans, France

Re: p910nd and HP1020

Postby Jocko » Thu Apr 16, 2015 5:06 pm

Just an additional question:

Where did you get the file sihp1020.dl and how have it been compiled ?
Jocko
Site Admin - expert
 
Posts: 11367
Joined: Tue Apr 12, 2011 4:48 pm
Location: Orleans, France

Re: p910nd and HP1020

Postby matt_max » Fri Apr 17, 2015 8:37 am

sihp1020.dl is available here. AFAIK it is made from original HP file. Check this. As you can see:
The original HP files are named '*.img'. Sometimes HP supplies
these files ready-to-download to the printer, sometimes they are raw
ARM executables and need to have a special header added to them before
they can be downloaded. The "make install" step will use the supplied
"arm2hpdl" program to automatically detect which kind of file they are
and convert them (if needed) to the downloadable '*.dl' format.

In the drivers package downloaded from HP site there is file called hp1020.img. I will try to convert it to the *.dl format.
matt_max
Donator VIP
Donator VIP
 
Posts: 124
Joined: Fri Apr 03, 2015 9:56 am
Location: Warsaw, Poland

Re: p910nd and HP1020

Postby matt_max » Fri Apr 17, 2015 10:08 am

I have to modify your udev rule a little bit because there is no ENV{PRODUCT}. It should be sth like this:
Code: Select all
BUS=="usb", SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="2b17", SYSFS{serial}=="JL3M1PL", KERNEL=="lp0", ACTION=="add", RUN="/bin/sh /usr/bin/loadprinterfirmware.sh

or even "oneliner":
Code: Select all
BUS=="usb", SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="2b17", SYSFS{serial}=="JL3M1PL", KERNEL=="lp0", ACTION=="add", RUN="/bin/cat /usr/lib/sihp1020.dl > /dev/usb/lp0
matt_max
Donator VIP
Donator VIP
 
Posts: 124
Joined: Fri Apr 03, 2015 9:56 am
Location: Warsaw, Poland

Re: p910nd and HP1020

Postby Jocko » Fri Apr 17, 2015 10:21 am

You have right, these two udev lines should work.

if you want to load them without reboot the nas you need to do
Code: Select all
udevadm control --reload-rules
(better if the printer is not plugged)

If you want to trace this rule you must use the first line

Note: check idVendor and idProduct are enough
Jocko
Site Admin - expert
 
Posts: 11367
Joined: Tue Apr 12, 2011 4:48 pm
Location: Orleans, France

Previous

Return to Lacie Internet space vs1

Who is online

Users browsing this forum: No registered users and 3 guests

cron