# Hp deskjet 5940



## sk8harddiefast (Dec 14, 2010)

They just gave me this printer  Is compatible with FreeBSD?


----------



## tingo (Dec 14, 2010)

Openprinting.org says yes: http://www.openprinting.org/printer/HP/HP-DeskJet_5940
You might want to use print/hplip, I am using it for my HP Photosmart 8250.


----------



## sk8harddiefast (Dec 14, 2010)

Ok. Can someone help me how to setup a printer? I have completely none idea. I had never a printer!


----------



## wblock@ (Dec 14, 2010)

The Handbook Printing chapter.
A FreeBSD article on CUPS, if that's your thing.
My own lpd Printing With FreeBSD.


----------



## sk8harddiefast (Dec 14, 2010)

I try to understand. Use cups, hplip and gnuteprint-cups or lpd? My printer is connected with usb


----------



## wblock@ (Dec 14, 2010)

For print/hplip, CUPS is required.


----------



## sk8harddiefast (Dec 15, 2010)

Following the handbook:
My /etc/devfs.rules

```
[system=10]
add path 'unlpt*' mode 0660 group cups
add path 'ulpt*' mode 0660 group cups
add path 'lpt*' mode 0660 group cups
add path 'usb/X.Y.Z' mode 0660 group cups
```

My /etc/rc.conf

```
cupsd_enable="YES"
devfs_system_ruleset="system"
```

I installed cups,hplip,gutenprint-cups but I cannot find how to open the gui. I guess there is a gui with oprtions etc. I don't think that printing is only from terminal!


----------



## phoenix (Dec 15, 2010)

http://localhost:631

That opens the web GUI for CUPS.  You can add printers from there.


----------



## sk8harddiefast (Dec 15, 2010)

Well I don't understand nothing over there 
How make my printer be recognized? Add printer ask for a username and passwd witch is not me. Even as root.


----------



## phoenix (Dec 15, 2010)

You may need to add your user to the *lp* and/or *lpadmin* groups.  Check /usr/local/etc/cups/cupsd.conf for the *SystemGroup* directive.  You need to be part of that group to add printers.


https://localhost:631
Administration tab
Add Printer button
Depending on the version of CUPS, you may see a list of local printers that it has detected.  Either select the printer, or the port the printer is connected to.  Click Continue.
Give the printer a name (this is how it will appear in printer listings, and is the name of the print queue), description, location, etc.  Click Continue.
Then, either find the printer driver in the list by selecting the manufacturer and then the driver;  or, if you have a PPD file for it already, you can click Browse and point it at the .ppd file.
Click Add Printer to save the printer.

After that, you should have a print queue available.  You can go to the Printers tab, and click the Print Test Page link next to the print queue to send a CUPS test print.

If that works, you can then load up an app and see if the printer shows up in the list when you print from that app.


----------



## sk8harddiefast (Dec 15, 2010)

> You may need to add your user to the lp and/or lpadmin groups. Check /usr/local/etc/cups/cupsd.conf for the SystemGroup directive. You need to be part of that group to add printers.


 This is the section that I cannot understand how to do it.


----------



## phoenix (Dec 15, 2010)

As root:

```
# grep SystemGroup /usr/local/etc/cups/cupsd.conf
<probably shows lpadmin group>
# ee /etc/group
<find the lpadmin line, add your username to the end of the list>
# /usr/local/etc/rc.d/cupsd reload
```
You will need to logout and login again in order for the system to pick up your new group membership.

You can check the output of the *id* command at a shell prompt, to make sure it lists lpadmin.

After that, you can connect to CUPS and add a new printer.


----------



## sk8harddiefast (Dec 15, 2010)

As root:

```
grep SystemGroup /usr/local/etc/cups/cupsd.conf
```
return:
SystemGroup wheel


> ee /etc/group


There is no lpadmin line. I see only: cups:*:193:
I guess so be something like lpadmin:*:*value*:. Right?


----------



## phoenix (Dec 15, 2010)

Since the SystemGroup is listed as *wheel*, you need to add your user to the *wheel* group.  

Not lpadmin.


----------



## sk8harddiefast (Dec 15, 2010)

```
wheel:*:0:root,emberdaemon
```
I guess that I am on wheel user. Right? Then why cups not understand my username even as root? I cannot add a printer if I will not be logged in


----------



## phoenix (Dec 15, 2010)

Hrm.  Odd.  You're accessing the https site?  And using *emberdaemon* as the user when prompted?


----------



## sk8harddiefast (Dec 15, 2010)

No https. I hit this: http://localhost:631 as URL on chrome. Open this. I go to Administration tab and I choose option: Add printer. Ask for username and password. I give as username: emberdaemon and as password, my passwd. Just refuse to login. I try as root too. Same result.


----------



## phoenix (Dec 16, 2010)

Try it with the https link.


----------



## sk8harddiefast (Dec 16, 2010)

https://localhost:631/ return me this:

```
SSL connection error.
Unable to make a secure connection to the server. This may be a problem with the server, or it may be requiring a client authentication certificate that you don't have.
```


----------



## teckk (Dec 16, 2010)

Found some info on that printer
It is a HP PCL3e Host based printer.
http://www-01.ibm.com/support/docview.wss?uid=nas1ba0863cfa6463903862569c10078c903

HP PCL3 GUI
HP PCL3e
HP PCL3 Enhanced 	The terms HP PCL3 GUI, HP PCL3e and HP PCL3 Enhanced indicate that the printer accepts a version of the HP PCL3 printer data stream that uses a compressed raster format that is not compatible with standard HP PCL 3 . Some users have gotten Remote Output Queues, *LAN 3812 PJL device descriptions, or *LAN 3812 SNMP device descriptions to work with HP PCL3 GUI, HP PCL3e or HP PCL3 Enhanced printers, but these are Host-based or Windows-only printer data streams so no guarantees can be made .


----------



## tingo (Dec 16, 2010)

@sk8harddiefast:
if you are using hplip, there are two ways to setup your printer; via hplip or via cups. If the hplip way works, you don't have to touch cups at all. And that is nice, because cups needs a bit of fiddling before it will work (in my experience, anyway).

The hplip way to setup a printer is described at the HPLIP web site. unfortunately that seems to be offline just now.
But here is a guide: http://www.people.fas.harvard.edu/~dsteinbr/computing/freebsd/howto/hplip.rb
(my apologies if you have already read it).
Basically, all you should need to do is to run `# hp-setup`, which will detect and install your printer. Then, as your normal user, run `$ hp-systray` to get the tray icon which will open the gui to manage the printer.

If you don't get a working printer after running hp-setup, there are other commands which can hekp you in finding the problem; `$ hp-info` and `$ hp-check`. Also, watch /var/log/messages, hplip binaries and / or cups will write some error / debug messages there.

HTH


----------



## sk8harddiefast (Dec 16, 2010)

> hp-setup


Found my printer  Cups recognize it too


----------



## tingo (Dec 16, 2010)

Yes, PPD files lives in /usr/local/share/ppd. PPD files for HP printer live in /usr/local/share/ppd/HP. Just select the one that matches your printer.


----------



## tingo (Dec 16, 2010)

BTW, hp-setup will work as a GUI program, but since you run it as root, it needs the DISPLAY variable of your user. If DISPLAY=:0.0, run hp-setup likes this `# DISPLAY=:0.0 hp-setup`.


----------



## sk8harddiefast (Dec 16, 2010)

hp-systray return me this error (running the command as user):


```
HP Linux Imaging and Printing System (ver. 3.10.9)
System Tray Status Service ver. 2.0

Copyright (c) 2001-9 Hewlett-Packard Development Company, LP
This software comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to distribute it
under certain conditions. See COPYING file for more details.

Traceback (most recent call last):
  File "/usr/local/bin/hp-systray", line 85, in <module>
    mod.lockInstance()
  File "/usr/local/share/hplip/base/module.py", line 649, in lockInstance
    ok, self.lock_file = utils.lock_app(self.mod)
  File "/usr/local/share/hplip/base/utils.py", line 117, in lock_app
    os.makedirs(dir)
  File "/usr/local/lib/python2.6/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/home/emberdaemon/.hplip'
```


----------



## tingo (Dec 16, 2010)

Well, if your user doesn't have write permissions in his own home directory, nothing is going to work. What are the permissions and ownership on /home/emberdaemon? And if $HOME/.hplip exists, what are the permissions on it?


----------



## sk8harddiefast (Dec 16, 2010)

I gave:

```
sudo chown -R emberdaemon /home
sudo chown -R emberdaemon /home/emberdaemon
sudo chown -R emberdaemon /home/emberdaemon/.hplip
```
Now I guess hole home directory own to me.
Run again hp-systray:
Open a gui and a balloon with error: *Device communication error*


----------



## tingo (Dec 16, 2010)

Hmm, perhaps you need to run it as `$ hp-systray &`.
But - do you get the hp icon in the systray? (Which desktop environment are you using?)


----------



## sk8harddiefast (Dec 16, 2010)

> But - do you get the hp icon in the systray?


Yeap. I use fluxbox. I see the systray of hp. I double click on it. Open the program and this balloon appears.
Terminal return this:

```
error: Fax disabled.
error: Fax disabled.
warning: Please install version 2.0+ of Reportlab for coverpage support.
error: Fax address book disabled - Python 2.3+ required.
error: Unable to communicate with device (code=12): hp:/usb/Deskjet_5900_series?serial=CN6431Z13604KF
error: Device not found
```

Ps: My hp-setup and cups see the printer. On cups recognize my printer like this: *HP Deskjet 5900 Series hpijs, 3.10.9.11* and as PPD, I choosed that: *hp-deskjet_5900_series-hpijs.ppd.gz* I made something wrong?


----------



## JimW (Dec 16, 2010)

sk8harddiefast said:
			
		

> Open a gui and a balloon with error: *Device communication error*



Your problem could be how you have your */etc/devfs.rules* file setup.

Did you set it up correctly for your USB device?

Follow the instructions here pertaining to USB printer devices...

http://www.freebsd.org/doc/en/articles/cups/article.html

After you set it up correctly, you then have to restart *devfs*...


```
/etc/rc.d/devfs restart
```


----------



## sk8harddiefast (Dec 16, 2010)

On my post 7, I say that I have already made that 
Also I run /etc/rc.d/devfs restart but still the error won't go away


----------



## JimW (Dec 16, 2010)

sk8harddiefast said:
			
		

> On my post 7, I say that I have already made that



Oh my..... Well if your *devfs.rules* file looks like this for a USB device, then it is not correct...


```
[system=10]
add path 'unlpt*' mode 0660 group cups
add path 'ulpt*' mode 0660 group cups
add path 'lpt*' mode 0660 group cups
add path 'usb/X.Y.Z' mode 0660 group cups
```


----------



## tingo (Dec 16, 2010)

ok, what does `$ hp-info` and `$ hp-check` say? Lastly, if you run hp-setup as your user, does it still see the printer?


----------



## sk8harddiefast (Dec 16, 2010)

hp-info Open a gui and an error:

```
Unable to open device hp:/usb/Deskjet_5900_series?serial=CN6431Z13604KF
```
hp-check return: http://pastie.org/1384201

Also this is my hplip flags:


```
[X] QT     Graphical User Interface (Qt4)                                  
[ ] FAX    PC Send Fax support                                 
[ ] SNMP   Network/JetDirect support                                     
[ ] SCAN   Scanning support                                    
[ ] XSANE  Install XSane for scanning (requires SCAN)
```

Only the first I need. I have no fax, scanner or use my printer via network.



> Oh my..... Well if your devfs.rules file looks like this for a USB device, then it is not correct...



Just edit this: add path 'usb/X.Y.Z' mode 0660 group cups to add path 'usb/6.2' mode 0660 group cups according my dmesg: ugen6.2: <HP> at usbus6

And Yes. Printer is connected on my FreeBSD via USB


----------



## tingo (Dec 16, 2010)

Well, it seems like your user are missing something (permissions?) in order to communicate with your printer.
If you look at the hp-check output, it doesn't find your printer (lines 231-236).
Ok, one more detail: is you user a member of the group cups? (it doesn't look like it, from lines 264-269)


----------



## tingo (Dec 16, 2010)

sk8harddiefast said:
			
		

> Following the handbook:
> My /etc/devfs.rules
> 
> ```
> ...


Ok, I didn't notice this before now. Devices unlpt, ulpt and lpt have nothing to do with usb, and are not needed to get your printer to work.
Also, I hope that it is not literally 'usb/X.Y.Z' in your /etc/devfs.rules?
For now, try to change it to 'usb/*', re-plug your printer and see if that helps.
You probably also need a line for 'ugen*', like the one for 'usb/*'.
HTH


----------



## sk8harddiefast (Dec 16, 2010)

> is you user a member of the group cups?


Is now.... 
Also the problem maybe is somewhere on devfs.rules. as JimW said.

My devfs.rules


```
[system=10]
add path 'unlpt*' mode 0660 group cups
add path 'ulpt*' mode 0660 group cups
add path 'lpt*' mode 0660 group cups
add path 'usb/6.2' mode 0660 group cups
```

Ps. I changed it: add path 'usb/*' mode 0660 group cups
and 
	
	



```
/etc/rc.d/devfs restart.
```
Error Insist


----------



## tingo (Dec 16, 2010)

OK, just add the 'ugen*' line to your devfs.conf, hopefully that will fix it.


----------



## sk8harddiefast (Dec 16, 2010)

> OK, just add the 'ugen*' line to your devfs.conf, hopefully that will fix it.


What I must write exactly?


----------



## JimW (Dec 16, 2010)

Don't forget to restart *devfs* everytime you make changes...


```
/etc/rc.d/devfs restart
```


----------



## tingo (Dec 16, 2010)

sk8harddiefast said:
			
		

> What I must write exactly?



Use usbconfig to figure out what your printer is named, here is an example from me

```
tingo@kg-v2$ usbconfig
ugen0.1: <OHCI root HUB nVidia> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON
ugen1.1: <EHCI root HUB nVidia> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON
ugen2.1: <OHCI root HUB nVidia> at usbus2, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON
ugen3.1: <EHCI root HUB nVidia> at usbus3, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON
ugen2.2: <Snapscan1212u_2 AGFA> at usbus2, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON
ugen0.2: <PS2 to USB Converter CHESEN> at usbus0, cfg=0 md=HOST spd=LOW (1.5Mbps) pwr=ON
ugen1.3: <USB 2.0 Reader Generic> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON
ugen0.3: <USB-Serial Controller Prolific Technology Inc.> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON
ugen1.2: <Photosmart 8200 series HP> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON
```
As you can see, my printer is ugen1.2.
Then put 
	
	



```
add path 'ugenX.Y' mode 0660 group cups
```
 in your /etc/devfs.rules, in addition to lines there already.


----------



## sk8harddiefast (Dec 16, 2010)

My usbconfig:

```
ugen0.1: <UHCI root HUB Intel> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON
ugen1.1: <UHCI root HUB Intel> at usbus1, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON
ugen2.1: <UHCI root HUB Intel> at usbus2, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON
ugen3.1: <EHCI root HUB Intel> at usbus3, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON
ugen4.1: <UHCI root HUB Intel> at usbus4, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON
ugen5.1: <UHCI root HUB Intel> at usbus5, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON
ugen6.1: <UHCI root HUB Intel> at usbus6, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON
ugen7.1: <EHCI root HUB Intel> at usbus7, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON
ugen3.2: <product 0x8187 vendor 0x0bda> at usbus3, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON
ugen4.2: <USB camera vendor 0x045e> at usbus4, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON
ugen4.3: <Microsoft Basic Optical Mouse Microsoft> at usbus4, cfg=0 md=HOST spd=LOW (1.5Mbps) pwr=ON
ugen5.2: <USB Receiver Logitech> at usbus5, cfg=0 md=HOST spd=LOW (1.5Mbps) pwr=ON
[B]ugen6.2: <Deskjet 5900 series HP> at usbus6, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON[/B]
```

My devfs.rules

```
add path 'ugen6.2' mode 0660 group cups
```
Also I run again:
	
	



```
/etc/rc.d/devfs restart
```
Same result  Pff


----------



## sk8harddiefast (Dec 18, 2010)

Today I want to do one more try to make my printer to work. System cannot see the usb of printer. According all the above my system now have this.
My dmesg

```
ugen6.2: <HP> at usbus6
```
My usbconfig

```
ugen6.2: <Deskjet 5900 series HP> at usbus6, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON
```
My /etc/group

```
cups:*:193:root,emberdaemon
```
My devfs.rules

```
[system=10]
#add path 'unlpt*' mode 0660 group cups
#add path 'ulpt*' mode 0660 group cups
#add path 'lpt*' mode 0660 group cups
#add path 'usb/*' mode 0660 group cups
add path 'ugen6.2' mode 0660 group cups
```
My hplip flags:

```
[X] QT     Graphical User Interface (Qt4)                                  
[ ] FAX    PC Send Fax support                                 
[ ] SNMP   Network/JetDirect support                                     
[ ] SCAN   Scanning support                                    
[ ] XSANE  Install XSane for scanning (requires SCAN)
```
Only the first I need. I have no fax, scanner or use my printer via network.
My hp-info

```
Unable to open device hp:/usb/Deskjet_5900_series?serial=CN6431Z13604KF.
```
My hp-check
http://pastie.org/1387201
I have rebooted my system, devfs but my system refuse to see that my printer is on USB. What is missing? I really don't understand why is refusing. Should work


----------



## wblock@ (Dec 18, 2010)

sk8harddiefast said:
			
		

> My devfs.rules
> 
> ```
> [system=10]
> ...



lpt (line 3) is not needed for a USB printer, but uncomment the rest.  Make sure /etc/rc.conf contains

```
devfs_system_ruleset="system"
```

After connecting and turning on the printer, see if /dev/ulpt0 is created.


----------



## sk8harddiefast (Dec 18, 2010)

Solved  Now hp-systray see the printer fine  Because when I had setup my system, I hadn't a printer and I had set all my ports flags without printer support, is this the solution?
http://www.freebsd.org/doc/en_US.ISO8859-1/articles/cups/printing-cups-ports-knobs.html
I must add on make.conf only the first line or all?


----------

