# Problem with Hp Officejet printer

## lafuma

I have HP Officejet v40 all-in-one printer and I am having trouble to get it to print. I managed to get it scanning but not printing.

I have installed hpoj and hpijs drivers, cups and foomatic.

When i connect localhost:631 and try to add new printer there's no device i could choose.

For command: foomatic-configure -n HP-OfficeJet_V40 -c ptal:/dev/ptal-printd/mlc_usb_OfficeJet_V40 -s cups -p HP-OfficeJet_V40 -d hpijs

i get this error:

lpadmin: Unable to connect to server: Connection refused

Could not set up/change the queue "HP-OfficeJet_V40"!

Hope I've told everything that is needed. All kind of help is welcome.

----------

## whatalotta

Hi,

I've got the V40xi.  I have been having a very similar problem.  Unfortunately, I haven't been able to solve it either.

My guess is that our cupsd.conf file is messed up somehow.  I've been playing with mine to try to get it to work.  When I step through the Gentoo printing guide, I get the connection refused statement at exactly the same place you do.

When you unplug your printer momentarily and plug it back in and dmesg, is your printer recognized by the system?

You can actually connect to localhost:631?  Could you post your cupsd.conf?  Don't know if I can help, but you might be able to give me some clues if you post that file.

----------

## lafuma

yes i can connect to localhost:631 my cupsd.conf you can see @ http://www.void.ee/pub/cupsd.conf

dmesg says something like that about printer.c:

printer.c: usblp0: USB Bidirectional printer dev 2 if 0 alt 1 proto 2 vid 0x03F0 pid 0x0F11

printer.c: usblp0: nonzero read/write bulk status received: -2

printer.c: usblp0: error -2 reading from printer

what those errors could be ?

----------

## whatalotta

The fact that you can connect to localhost:631 makes me think that you are in better shape than I am.  However, the error message received from dmesg makes me wonder.  I apologize if I'm asking stupid questions, but I just want to make sure we understand each other.  

When you do modprobe usbcore and modprobe printer do you get any error messages?

If you try:

touch test.txt

echo "put anything inside these quotes" > test.txt

cat test.txt > /dev/usb/lp0

Do you print the words that you put in quotes?  Mine trys to but hangs up.  Not sure how to implement the ^L (cntrl-L).

in your foomatic-configure line, have you tried it without the hpoj verbage?  Something like:

foomatic-configure -n HP-OfficeJet_V40 -c file:/dev/usb/lp0 -s cups -p HP-OfficeJet_V40 -d hpijs 

I sure hope this helps.  I'm lost too.  Any Guru's out there that may be able to help us?

----------

## lafuma

When you do modprobe usbcore and modprobe printer do you get any error messages? 

No i can load modules without any errors.

If you try:

touch test.txt

echo "put anything inside these quotes" > test.txt

cat test.txt > /dev/usb/lp0 

$ echo "pla" > /dev/usb/lp0 

bash: /dev/usb/lp0: Device or resource busy

but i can print without problem using /dev/ptal-printd/mlc_usb_OfficeJet_V40

in your foomatic-configure line, have you tried it without the hpoj verbage? Something like:

foomatic-configure -n HP-OfficeJet_V40 -c file:/dev/usb/lp0 -s cups -p HP-OfficeJet_V40 -d hpijs

no it tells me the same thing

$ foomatic-configure -n HP-OfficeJet_V40 -c file:/dev/usb/lp0 -s cups -p HP-OfficeJet_V40 -d hpijs

lpinfo: Unable to connect to server: Connection refused

lpadmin: Unable to connect to server: Connection refused

Could not set up/change the queue "HP-OfficeJet_V40"!

----------

## whatalotta

https://forums.gentoo.org/viewtopic.php?t=22291 Try using this guide.  It appears to work for some.  Note that the versions of Cups/foomatic/gimp-print/ghostscript that he calls out are not available in portage anymore.

The part that may help is what to do when you get into localhost:631, and what to do if that does not work (go ppd-o-matic on linuxprinting.org-that is, if you haven't already done so).

Good luck.

----------

## whatalotta

Hi lafuma,

I just fixed my printer and wanted to let you know what I did.  I know that your problem is slightly different, but this may work for you too.  The only difference between our all-in-ones is the last to initials (xi).

Remember in my initial post, I was thinking the the cups.conf file might be the problem.  I noticed that yours was a lot more plain than mine.  I also noticed that when I unmerge cups, the file didn't go away.  This is what gave me a clue.

1. emerge unmerge cups 

2. emerge ummerge foomatic

3. emerge unmerge gimp-print (if installed)

4. emerge unmerge ghostscript (if installed)

5. emerge unmerge hpoj

6. emerge unmerge hpijs

7. rm * (it will complain that 3 directories can't be deleted).

8. rm -r certs interfaces ppd (this will get rid of anything that will be left over from the unmerge above)

9. ls -al (to make sure that the cups directory is empty-if not rm what ever is left)

10. rc-update del cups default (just to make sure)

11. /etc/init.d/cups stop (again just to make sure)

12. emerge cups

13. emerge ghostscript (not sure this is necessary, but at the end of the cups merge it says to do this).

14. emerge foomatic

15. emerge hpijs (you may need hpoj for scanning, but I haven't tried yet).

16. rc-update add cupsd default

17. /etc/init.d/cupsd start

18. foomatic-configure -s cups -p HP-OfficeJet_V40 -c file:/dev/usb/lp0 -n HPPrinter -d hpijs (do this exactly)

19. Now setup your printer through localhost:631 following the directions in the link that I gave you earlier today, or better yet if you are using KDE, go to print system -> add printer.  When you get to the printer selection part, select OfficeJet v40, hpijs.

20. Print a test page.

I hope this works for you!

To the Guru's out there, please let me know what is redundant and not needed above.  I want to learn!

----------

## Anarconda

Before start cups you need start hpoj (ptal-init).

    #/etc/init.d/ptal-init setup  -> To setup your printer.

    #/etc/init.d/ptal-init start   -> To init hpoj.

    #/etc/init.de/ptal-init stop  -> To stop hpoj.

Obviously, you can use rc-update with this utility but always has to start before cups.

(Sorry for my english)

----------

## whatalotta

Anarconda,

Thanks for the tip.  I will give it a try and let you know how it works out.

----------

## lafuma

i followed your every step and i still got this same error:

$ foomatic-configure -s cups -p HP-OfficeJet_V40 -c file:/dev/usb/lp0 -n HPPrinter -d hpijs

lpinfo: Unable to connect to server: Connection refused

lpadmin: Unable to connect to server: Connection refused

Could not set up/change the queue "HPPrinter"!

----------

## Anarconda

Have you start cups after 'ptal-init start'?

The message 'Unable to connect to server. Connection refused' seems to say that cups is not running.

You can try this:

#/etc/init.d/cupsd stop

#/etc/init.d/ptal-init stop

#/etc/init.d/ptal-init start      -> You must see a message like this: [*] mlc:usb:YOUR_PRINTER

#/etc/init.d/cupsd start

To test that all is OK.

1) In your browser go to: http://localhost:631

2) Select: Manage Printer, add printer, type any information in name, location and description and press continue, after that in the device list you must see a printer named: PTAL mlc:usb:YOUR_printer

If your printer is there all is right.

----------

## lafuma

like I said before theres no device i could choose after "name, location and description" field. And cupsd and ptal-init are working fine...

----------

## whatalotta

Hi lafuma and Anarconda,

Just wanted to share my experience in bringing my printer back up.  The post I left a couple of days ago is exactly what I did.  I think that the major thing that gave me results was getting rid of the files that aren't automatically created if they already exist.

Note that if you go to linux-printing.org, they will tell you that you need to have hpoj installed and setup and started.  I believe this to be true with some HP printers, but in the case of the V40xi, I know that it is not required.  I have the HP-OfficeJet_v40xi as grepped from foomatic.  I have removed hpoj from my system (unemerged and rc-update del hpoj default).  My printer has been working for two days straight with no problems.  I firmly believe that it is important to get rid of any files that aren't overwritten when you re-emerge cups.  This is why I removed the cups directory.  Note that it is not removed if you unmerge cups.

My thinking is that in lafuma's case, there may be other files/directories that need to be removed based on what has been installed previously.

I believe that the Gentto Printing Guide will work if followed exactly after cleaning out all installed directories.

I would unmerge all printing related stuff previously emerged.

Find all files/directories that have the names of packages unmerged.

Re-emerge cups, foomatic and hpijs per the printing guide.  Note that Gentoo updates this document periodically so if you are going by a version you have printed out some time ago, you might want to take a look at it again (specifically the USE flags).

Hope this helps.

----------

## dodger10k

I just tried to set-up my Officejet v40 with cups and everything looked quite ok to me. When I use the cups webadmin-page to print a test page I get "Printer not connected; will retry in 30 seconds..."

What did I miss here?

----------

## whatalotta

I'm not sure.  I have never used the webadmin page.  I use KDE and use the printing manager from the settings menu to finalize the setup once I have emerged all of the right programs.

I assume that since you posted on this thread that you have read the advice that I provided to lafuma above and have emerged hpijs and payed close attention to your USE flags.

Have you got a copy of the latest printing guide?  I have used this after wiping my hard drive for my v40xi and it worked perfectly (minus the part about web admin).

Good luck!

----------

## dodger10k

Thanks for the answer. I used the printing guide and docs from linuxprinting.org to run the whole story again and now everything works fine  :Smile: 

----------

## whatalotta

Great!

----------

