# How to use a USB printer ?



## errandonea (Apr 15, 2011)

Hi, everybody

I'd like to print with my USB printer but the handbook only explains how to use a serial or a parallel one.

My printer is a HP PSC 1410. It's recognised in /dev/ as ulpt0. I've activated the usb and ulpt modules in /boot/loader.conf. Here is what /var/run/dmesg.boot has to say about it:


```
ulpt0 : <HP PSC 1400 series, class 0/0, rev 2.00/1.00, addr 2> on usbus1
ulpt0 : using bi-directional mode
```

Of course, none of the tests suggested by the handbook for serial and parallel printers work with mine.

How can I fix this?


----------



## SirDice (Apr 15, 2011)

Just follow the procedures for a parallel printer and use /dev/ulpt0 instead of /dev/lpt0


----------



## errandonea (Apr 15, 2011)

I had tried this with the interrupt-driven method. I just tried it with the polled method. In both cases, I encounter the same problem with *lptcontrol*, which tells me :


```
lptcontrol: ioctl: Operation not supported by device
```

Of course, I replaced lptN with ulpt0.


----------



## lbol (Apr 15, 2011)

Try /dev/unlpt0. Your printer may not be able to handle the reset on open.

From ulpt(4)


> Some printers cannot handle the reset on open; in case of problems try
> the unlpt device


----------



## errandonea (Apr 15, 2011)

Same result with ulpt0 and unlpt0. 

I tried:

`lptcontrol -i -d /dev/ulpt0`

and

`lptcontrol -i -d /dev/unlpt0`

with the line 


```
hint.ppc.0.irq="7"
```

uncommented in /boot/device.hints.

Then, I commented this very same line, rebooted and tried:

`lptcontrol -p -d /dev/ulpt0`

and

[CMD="]"]lptcontrol -p -d /dev/unlpt0[/CMD]

Each time, the output is exactly the same:


```
lptcontrol: ioctl: Operation not supported by device
```

After reading another thread, I added the line :


```
/dev/ulpt0 0664
```

to /etc/devfs.conf and


```
lpd_enable="YES"
```

to /etc/rc.conf.

But that doesn't change anything.


----------



## lbol (Apr 15, 2011)

BTW, why would you run lptcontrol(8) on the USB printer
After setting up /etc/printcap and restarting lpd(8)the printer should be ready.

See also lpc(8) to check to status of your printer.


----------



## wblock@ (Apr 15, 2011)

errandonea said:
			
		

> I'd like to print with my USB printer but the handbook only explains how to use a serial or a parallel one.



lpd Printing With FreeBSD



> My printer is a HP PSC 1410.



First, look it up on openprinting.org.  Bad news from there, it's yet another inkjet with a proprietary PDL.  That probably means print/hplip and print/cups are required.


----------



## DutchDaemon (Apr 15, 2011)

errandonea, format your posts, please.


----------



## wblock@ (Apr 15, 2011)

errandonea said:
			
		

> I installed *hplip* and *cups*



CUPS is an alternative to lpd(8).



> then I carefully followed your how-to but when I tried this :
> 
> `% printf â€œThis is a test\r\n\fâ€ | lpr`
> 
> ...



Yes, because the real lpr(1) is in /usr/bin/, while the CUPS replacement lpr goes in /usr/local/bin.



> I replaced ulpt0 with unlpt0 but nothing changed. Is there a way to print with this printer ? Do I have to configure *hplip* and/or *cups* ?



I think CUPS is required for HPLIP, and you'll probably have to use the built-in web management to set up the printer.  See CUPS on FreeBSD.


----------



## errandonea (Apr 16, 2011)

Hello,

Following _wblock_'s advice, I read the CUPS chapter in the handbook, activated cupsd and used CUPS's web interface (localhost:631).

When I click *Add Printer* on this web interface, I have to choose the model of my printer in a list. This list features numerous HP printers but neither my *HP PSC 1410* nor any *1400 serie*. 

Alternatively, it's written that I can send a PPD file. What is a PPD file and where can I find the good one ?


----------



## lbol (Apr 16, 2011)

for ppd files see http://openprinting.org


----------



## wblock@ (Apr 16, 2011)

A PPD for the PSC 1400 series is included with HPLIP, /usr/local/share/ppd/HP/hp-psc_1400_series-hpijs.ppd.gz.  Whether CUPS should find that automatically, I don't know.


----------



## errandonea (Apr 16, 2011)

It works ! I gunziped the .ppd.gz file and gave the path and name of the resulted .ppd one on CUPS' web interface. Now, I can print both plain text and PDF files. I think other formats will work as well.

Thanks to everyone.


----------



## errandonea (Apr 16, 2011)

Troubles are back. I've enabled the mounting of USB storage devices. The mounting works fine. But now, I can't print anymore. On the 'Printers' section of its web interface, CUPS complains : 


```
"impossible to open file /dev/ulpt0 : Permission denied"
```

Here are my devfs.rules and rc.conf :

devfs.rules :


```
[localrules=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/1.2*' mode 0660 group cups
add path 'da*' mode 0660 group operator
```

Bottom of rc.conf :


```
devfs_system_ruleset="localrules"

lpd_enable="YES"
cupsd_enable="YES"
```

I tried to return these files to their previous states but didn't succeed. Where did I make a mistake ?


----------



## wblock@ (Apr 16, 2011)

errandonea said:
			
		

> Troubles are back. I've enabled the mounting of USB storage devices. The mounting works fine. But now, I can't print anymore. On the 'Printers' section of its web interface, CUPS complains :
> 
> _"impossible to open file /dev/ulpt0 : Permission denied"_
> 
> ...



USB devices are dynamically numbered.  The printer may not always show up as 1.2.  Depending on what you feel is permissible, you might want to make that "usb/*".



> Bottom of rc.conf :
> 
> 
> ```
> ...



CUPS doesn't need lpd.


----------



## errandonea (Apr 17, 2011)

I tried usb/*. It doesn't change anything. No matter lpd is enabled or not. CUPS still complains he can't access ulpt0. I don't understand why I can't print anymore.


----------



## wblock@ (Apr 17, 2011)

After changing devfs.rules, did you restart devfs and disconnect/reconnect the printer?


----------



## errandonea (Apr 17, 2011)

Yes, I did. I also tried to completely reboot the computer.


----------



## wblock@ (Apr 17, 2011)

What are the permissions on ulpt0?
`% ls -l /dev/ulpt0`

As root, you can change permissions, owner, and group on ulpt0.  If that works, then it's a devfs or devfs.rules problem.


----------



## errandonea (Apr 17, 2011)

```
%ls -l /dev/ulpt0
crw-rw----  1 root  cups    0, 103 17 avr 17:30 /dev/ulpt0
```


----------



## errandonea (Apr 18, 2011)

I tried everything about ulpt0, even this :


```
# ls -l ulpt0
crwxrwxrwx  1 cups  cups    0, 103 18 avr 15:23 ulpt0
```

CUPS still pretends he can't access /dev/ulpt0. I restarted it but nothing changed. It's clearly a cups problem but which one?


----------



## errandonea (Apr 18, 2011)

I continued giving more and more right to cups. I made him a member of groups operator, wheel and, of course, cups.

No more success...


----------

