sending raw data through usb on linux

Lucas d. Prim picture Lucas d. Prim · Aug 19, 2010 · Viewed 22.2k times · Source

I'm printing some labels on a Zebra TLP-2844 printer, and have been doing it fine on Windows by sending the EPL instructions to the shared USB printer as follows:

type Label.prn > \my-pc\zebra

and it seems to work with serial ports too, with

type Label.prn > COM1

Now I'm trying to to the same on Linux, but it's getting really hard! My first guess was:

cat Label.prn | /dev/bus/usb/005/002

since my printer is on bus 005, device 002 (checked it with lsusb command) but it doesn't work at all, as I get the following:

bash: /dev/bus/usb/005/002: Permission denied

Any guesses?

Answer

unbeli picture unbeli · Aug 20, 2010

The command you did

cat Label.prn | /dev/bus/usb/005/002

will try to run /dev/bus/usb/005/002, which is not executable, hence "permission denied". The correct command would be, similar to windows

cat Label.prn > /dev/bus/usb/005/002

However, not sure if you actually can write anything to a printer like that in linux. If the printer is set up properly, you might also try:

lpr Label.prn