CUPS, USB Printer

I have a FreeBSD box running 8.2/amd64 and a Brother HL-5240 laser printer. This printer has both parallel and USB ports on it, but the motherboard doesn't have a parallel port and all the PCI slots are full, so I have to use USB to interface with it. However, I've been unable to figure out how to get CUPS to see the printer.

I've searched and found information that says it should work, but it's mostly old. The handbook doesn't seem to have much on the USB portion of it. I heard that the USB stack was rewritten in 8 and am thinking this may be the source of the information I've found not working - /dev/ulpt doesn't exist.

Does anybody know of instructions on how to set up a USB laser printer in FreeBSD 8? Alternately, what's the basic process in order to get CUPS to see the printer?
 
Ruler2112 said:
Does anybody know of instructions on how to set up a USB laser printer in FreeBSD 8? Alternately, what's the basic process in order to get CUPS to see the printer?

Check this URL, there is some stuff for a brother 5240 on 8.1:
http://macroexpand.com/~bm3719/fbsd_setup.html

The first thing needed is entries for /dev/ulptX and /dev/unlptX. If not, check the kernel messages (on the console or with dmesg(8)) when you plug the printer.

As the printer looks to be is a postscript one that should work.

Regards.
 
The Brother-5040 does not like to be connected using a USB HUB, so make sure you directly connect it to a port. And remember that some ports on the MB can be routed through a hub, like front ports or sometimes those atop a tower.
 
OK, I've solved one problem, found a mistake, and have encountered another problem.

I couldn't figure out why /dev/ulpt0 wasn't being created when the printer was plugged in. Discovered why when I tried power cycling it and nothing happened. Thought it was in power saving mode all this time when in fact I'd unplugged it accidentally when moving it out to pull the parallel port cable out... :OOO

Also, I was mistaken about the printer model - it's an HL-5040. Thought it was a 5240, but must've swapped it out for another somewhere...

OK, so now FreeBSD is creating the correct device nodes, they're owned by root:cups and have mode 660. Great - now I'll just restart cups with /usr/local/etc/rc.d/cupsd restart and be able to add the printer, right? :) Nope. :(

Nothing shows up under local printers. At all. The printer is connected directly to a USB port on the back of the motherboard. I was able to add a printer by selecting 'LPD/LPR Host or Printer' and putting usb:/dev/ulpt0 as the device. Bad part about this is that it didn't work. When trying to do a test print, it says "Waiting for printer to become available."

I also tried using webmin to add the printer. It has the local printer options in a drop-down list and includes Parallel Port (even though there isn't a parallel port in the system) and Serial Port as options, but no USB.

The following is more troubleshooting.

Code:
# lpinfo -v
Password for root on localhost?
network http
network ipp
network lpd
network ipps
network socket
network https
# ls -l /usr/local/libexec/cups/backend/
total 236
lrwxr-xr-x  1 root  wheel      3 Nov 11 14:18 http -> ipp
lrwxr-xr-x  1 root  wheel      3 Nov 11 14:18 https -> ipp
-rwx------  1 root  wheel  57864 Nov 11 14:18 ipp
lrwxr-xr-x  1 root  wheel      3 Nov 11 14:18 ipps -> ipp
-rwx------  1 root  wheel  38920 Nov 11 14:18 lpd
-r-xr-xr-x  1 root  wheel  29384 Nov 11 14:18 parallel
-r-xr-xr-x  1 root  wheel  29224 Nov 11 14:18 serial
-r-xr-xr-x  1 root  wheel  24496 Nov 11 14:18 snmp
-r-xr-xr-x  1 root  wheel  33448 Nov 11 14:18 socket
-r-xr-xr-x  1 root  wheel  20256 Nov 11 14:18 usb
# /usr/local/libexec/cups/backend/usb
DEBUG: list_devices
DEBUG: usb_find_busses=1
DEBUG: usb_find_devices=8
direct usb://Brother/HL-5040%20series?serial=L3J496832 "Brother HL-5040 series" "Brother HL-5040 series" "MFG:Brother;CMD:PJL,PCL,PCLXL;MDL:HL-5040 series;CLS:PRINTER;" ""

It looks like the CUPS USB backend can see the printer, but CUPS just can't see it's own USB backend. (???)

I've added myself to group 'cups', even though it shouldn't matter for a test page. When I cat a file to the /dev/ulpt0 device node as root, nothing happens. When using /dev/unlpt0, nothing happens on the printer and the console port locks up until I control-C out. Went back and confirmed that the USB option was checked in print/cups-base, so I really don't know what else to check or try.
 
When installing cups you performed the steps described in /usr/ports/print/cups-base/pkg-message?
Any errors or entries in either /var/log/cups/access_log or /var/log/cups/error_log ?
 
More importantly, the article says a few things about /etc/devfs.rules.

This is what you need to do to enable the system to detect the printer after boot:

Code:
- Create [file]/etc/devfs.rules[/file] with the following, which sets the permissions and associates print devices with the cups group:

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

- Add root and other users to cups group in /etc/group
- Enable CUPS and the above rules at startup by adding these lines to [file]/etc/rc.conf:[/file]

cupsd_enable="YES"
devfs_system_ruleset="system"
 
fmw said:
More importantly, the article says a few things about /etc/devfs.rules.

My bad, currently I am not at my box. You are right, devfs.rules it is.
 
qsecofr said:
When installing cups you performed the steps described in /usr/ports/print/cups-base/pkg-message?
...

That would have been too easy... turns out the devfs.rules needs different information in for 8.


For people who find this thread in the future, add to /etc/devfs.rules:

Code:
[system=10]
add path 'usb*' mode 0770 group cups
add path 'ugen*' mode 0660 group cups

The /etc/rc.conf entry for the above remains the same:

Code:
devfs_system_ruleset="system"

Also need to copy /usr/local/share/examples/cups/ulpt-cupsd.conf to /usr/local/etc/devd. Restart cupsd and devfs - printer appears in the CUPS web interface.

Thanks for the help all.



Is it just me or does it seem like every single port either relates the post-install configuration information in a different way or assumes you know how?
 
Back
Top