Find the answer to your Linux question:
Results 1 to 6 of 6
I am using a derivative of Puppy Linux. I compiled the driver for the HP Laserjet 1020 printer. For the printer to work the firmware has to be loaded every ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Aug 2007
    Posts
    5

    Auto load firmware when USB printer turned on


    I am using a derivative of Puppy Linux. I compiled the driver for the HP Laserjet 1020 printer. For the printer to work the firmware has to be loaded every time the printer is turned on.

    I have added the following command to the rc.local file in Puppy Linux which runs every time Puppy Linux boots up:


    Code:
    cat /usr/share/foo2zjs/firmware/sihp1020.dl > /dev/usb/lp0

    This works fine if the printer is on when I boot into Puppy Linux. If the printer is not on when I boot up then I have to run the code in a shell before the printer will print.

    This is OK for me but my family members need to be able to just turn on the printer any time and have it print. They do not even know what a shell is and cannot be expected to issue shell commands to get the printer to work.

    My question is this:

    Can I put the above code in a script that will execute every time the USB printer is turned on?

    Knowing the kind of operating system that Linux is, I am sure that there is a way to do this. I'm just not skilled enough to know how to do it.

    Any help would be much appreciated.

    bdika

  2. #2
    Linux Guru bigtomrodney's Avatar
    Join Date
    Nov 2004
    Location
    Ireland
    Posts
    6,132
    There should have been a rule for udev/hotplug included in the driver. Do you have udev/hotplug on your system? I'm not sure if it's included in Puppy. That will trigger the firmware to be loaded. If you had a file called hplj10xx.rules in your install folder, rename it to 40-hplj10xx.rules (or any number higher than 40) and put it in /etc/udev/rules.d so it can load when you turn it on. If not post back and I'll post the contents of the file for you to create it.

  3. #3
    Just Joined!
    Join Date
    Aug 2007
    Posts
    5
    Thanks for the reply bigtom.

    A search on my Puppy Linux system for udev comes up blank. A search for hotplug produces /sbin/hotplug, /etc/hotplug and /proc/sys/kernel/hotplug.

    When I installed the driver, there were directions to "make install hotplug" which I did. But it didn't have any effect on my Puppy Linux system. I have used this driver on Ubuntu and other more traditional Linux distributions without any problems. In other words turning on the usb printer automatically loaded the firmware. But no luck with Puppy Linux.

    I look forward to your reply.

    Thanks.

    bdika

  4. #4
    Just Joined!
    Join Date
    Aug 2007
    Posts
    5
    Hi bigtom

    Sorry I didn't read your reply close enough before responding.

    I did look in the driver folder and there was a file called hplj10xx.rules. I renamed it to 41-hplj10xx.rules and placed it in the folder /etc/udev/rules.d. I had to create the folder udev in /etc and I had to create the folder rules.d in /etc/udev. I then placed the file 41-hplj10xx.rules in the newly created /etc/udev/rules.d/ folder. I rebooted the computer and turned on the computer after the reboot but the firmware did not load.

    I look forward to your reply.

    Thanks.

    bdika

  5. #5
    Just Joined!
    Join Date
    Aug 2007
    Posts
    5
    Hi bigtom:

    I was searching around in my Puppy Linux and I found a script called mut.tcl in /etc/lib/mut which I think is for auto mounting CD drives and flash USB drives and to auto start applications.

    Part of this file (which is a bash script) is the following:

    Code:
    proc usb_autoscan {{how refresh}} {
    	if {[file exists /proc/bus/usb/devices]} {
    		if {$how == "on"} {
    			if {$::debug} {puts "usb_autoscan $how"}
    			full_refresh_display
    			after 2000 usb_autoscan refresh2000
    			return
    		}
    		set hotplug [file mtime /proc/bus/usb/devices]
    		if {$hotplug != $::last_hotplug} {
    			if {$::debug} {puts "usb_autoscan $how now=$hotplug last=$::last_hotplug"}
    			after 1000 full_refresh_display
    			after 1500 usb_autoscan refresh1500
    		} else {
    			after 200 usb_autoscan refresh200
    		}
    	}
    }
    Is this relevant?

    Thanks.

    bdika

  6. #6
    Linux Guru bigtomrodney's Avatar
    Join Date
    Nov 2004
    Location
    Ireland
    Posts
    6,132
    I'm not familar with that script, but it does seem that Puppy doesn't include udev which is essential to the process. udev is the infrastructure for managing device connection and performing required tasks. I guess aside from doing it manually you could either create a script to make it easier or a more inefficient way would be to create a daemon or cronjob looking out for its connection and running the firmware script.

    On the other hand the script you've provided may be able to do something for you but I'm not that hot on TCL so I wouldn't be much help there

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •