Installing an HP F4280 on Slackware 12.1

Edit::: I managed to forget to renew that old domain (darksky.info), and thus, revived this one...

This post and several others have been moved to darksky.info as this blog will soon be well, left alone. Please post any comments and/or violent reactions there. Thank you.

I purchased an HP DeskJet F4280 AIO as a late Christmas present for us, and installed it on my (of course) Slackware system. But before we move forward, lets look at what happened step by step.

I got the HP Deskjet F4280 because of the HPLIP drivers, which would make things easier. On opening the box, it had of course, packaging, marketing materials, one USB cable, one power supply, and one Win/MacOSX driver CD (fairly standard, don't you think?). So there I go, plugging the whole thing into the PC, fire up cups with

sh /etc/rc.d/rc.cups start

and all goes well after powering up (oddly enough, I didn't even think about running the HPLIP tools, oh well).

Now, when I ask cups to "Find New Printers" on the Administration tab, it couldn't see anything. So, I go check dmesg, and find:

$ dmesg

[lots of stuff here]
usb 1-2: new full speed USB device using uhci_hcd and address 3
usb 1-2: configuration #1 chosen from 1 choice
usblp0: USB Bidirectional printer dev 6 if 1 alt 0 proto 2 vid 0x03F0 pid 0x2504
[more stuff]

Well, there I see that Slackware CAN see the darn thing. From this, I can see that the printer was plugged into bus 1 (if 1) with the device number 6 (dev 6).

Going into /dev, I check for permissions, thinking that the device nodes didn't have r/w permissions, and true enough, ls -al shows

crw-rw---- 1 root root 189, 5 2009-01-03 00:41 usbdev1.6
crw-rw---- 1 root root 250, 4 2009-01-03 00:41 usbdev1.6_ep00
crw-rw---- 1 root root 250, 5 2009-01-03 00:41 usbdev1.6_ep01
crw-rw---- 1 root root 250, 9 2009-01-03 00:41 usbdev1.6_ep06
crw-rw---- 1 root root 250, 7 2009-01-03 00:41 usbdev1.6_ep08
crw-rw---- 1 root root 250, 6 2009-01-03 00:41 usbdev1.6_ep82
crw-rw---- 1 root root 250, 10 2009-01-03 00:41 usbdev1.6_ep87
crw-rw---- 1 root root 250, 8 2009-01-03 00:41 usbdev1.6_ep89

Simple enough, we could chmod 0666 /dev/usbdev1.6* to get r/w permissions (0666 is equivalent to chmod ugo+rw /dev/usbdev1.6*). However, printers by their nature aren't on all the time, and on powering down and powering up, I found that the HP DeskJetF4280 was assigned a different device number. Not to mention that inserting other USB devices (like your handy-dandy flash drive) are going to change things up even more.

So, what to do, what to do...? udev rules of course! First to find some information. Doing an /sbin/lsusb gave me:

Bus 002 Device 001: ID 0000:0000
Bus 001 Device 007: ID 03f0:2504 Hewlett-Packard
Bus 001 Device 001: ID 0000:0000

Kinda thin, dontchathink? But it does give me two things, the USB Vendor ID and product ID. we confirm that with udevinfo -ap /bus/usb/devices/1-2, which gives me:

looking at device '/devices/pci0000:00/0000:00:11.2/usb1/1-2':
ATTR{bNumInterfaces}==" 3"
ATTR{bMaxPower}==" 2mA"
ATTR{version}==" 2.00"
ATTR{product}=="Deskjet F4200 series"

[more irrelevant stuff follows]

Now, wait a minute, how did I know that the proper device is 1-2? And where did /bus/usb/devices come from? Well, udevinfo reads from /sys, and so, you leave that out of your command. As for 1-2, see dmesg above. It says, usb 1-2. Not exactly rocket science, but also not immediately obvious.

Well, this confirms the vendor and product id (see ATTR{idVendor} and ATTR{idProduct}). It also shows us the product serial number (ATTR{serial}=="CN89P3G0TC05BR"). Useful things for manipulating udev with.

So, here we go, heading off to /etc/udev/rules.d, and what do I find? Nothing about printers. I did find a few lines in 50-udev-default.rules something about printers, but nothing that I'd want to toy with... so looking again, I remember that this HP F4280 IS an All-In-One (or Printer-Scanner-Copier, whichever you prefer). And there is that file that's called /etc/udev/rules.d/80-libsane.rules.

HEY!! I thought this was about installing and getting the printer to work!!!

Yes, it is, just bear with me for a few more minutes.

Anyway, checking that rule-file, I find that there is no rule for the HP F4280 in there. So, fire up vim, and add this near the bottom, just before the segment about autosuspend. If you're not sure what I'm talking about, you can add this after the last line that looks most like it.

# HP Deskjet F4280
ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="2504", MODE="0666", GROUP="scanner", ENV{libsane_matched}="yes"

If you're in vim, you'd hit ESC :wq at this point to save and quit.

You will notice that I have MODE="0666" and GROUP="scanner". Why? Well, libsane IS about scanners anyway. But about the MODE="0666"? Well, the HP F4280 again, is an All in One. If I don't change this to rwrwrw (0666) for everyone, then I'll be able to scan, but not print. Why? Because printing is a write function to the printer device.

So, after the rule is written, lets power down and power up the printer again. Lets check /dev as to what I have for my usbdev now.

crw-rw-rw- 1 root scanner 189, 7 2009-01-03 01:14 usbdev1.8
crw-rw---- 1 root root 250, 4 2009-01-03 01:14 usbdev1.8_ep00
crw-rw---- 1 root root 250, 5 2009-01-03 01:14 usbdev1.8_ep01
crw-rw---- 1 root root 250, 9 2009-01-03 01:14 usbdev1.8_ep06
crw-rw---- 1 root root 250, 7 2009-01-03 01:14 usbdev1.8_ep08
crw-rw---- 1 root root 250, 6 2009-01-03 01:14 usbdev1.8_ep82
crw-rw---- 1 root root 250, 10 2009-01-03 01:14 usbdev1.8_ep87
crw-rw---- 1 root root 250, 8 2009-01-03 01:14 usbdev1.8_ep89

Looks like we have read/write capability for this node now! But lets check some more.

ls /dev/bus/usb/001/008 -al

drwxr-xr-x 2 root root 80 2009-01-03 01:14 ./
drwxr-xr-x 4 root root 80 2009-01-03 08:09 ../
crw-r--r-- 1 root root 189, 0 2009-01-03 08:09 001
crw-rw-rw- 1 root scanner 189, 7 2009-01-03 01:14 008

Looking good!

Just one last thing. sane wouldn't be able to see your scanner. Why? It doesn't quite know about it yet. Go into /etc/sane.d and edit the file hp4200.conf. Change the figures after usb to read:

usb 0340:2504

Now drop out of root, and try xsane. If the gui launches, then you're good to go. Just to add the printer.

Fire up your browser, and head of to localhost:631, to access cups. Head to Administration, and click on Find New Printers. After that, just go on clicking on next etc. etc. When you get to the part where it asks for the "Model/Driver for HP_Deskjet_F4200_series_*", look for the HPDeskJetf4200 series driver. Follow till the end, and click "Print Test Page".

Note: If you have a default install of Slackware 12.1, you'll have to upgrade the HPLIP package from the 12.2 series to find the f4200series driver in cups.

There you have it, how to install an HP F4280 on Slackware Linux 12.1. Hope you had fun!


serpentwar said...

I wrote a post in portuguese based in yours at http://alunos.if.uff.br/alanfr/?p=444 .

Thank's for this "tutorial", it's very helpfully for me.


Alan Franco

LJSenger said...

very useful, it works nice on slackware 12.1 also.