can't find raspberry pi USB device path
Printer: TM-T20II Connection: USB -> raspberry pi 3
used python-escpos with p = printer.Usb(0x04b8,0x0e15,0) which works perfect.
now I'm having trouble printing with php-escpos
lsusb returns this:
# lsusb
Bus 001 Device 010: ID 04b8:0e15 Seiko Epson Corp.
and the dev path for usb devices shows these:
/dev/bus/usb/001# ls
001 002 003 004 005 006 010
so i'd assume that 010 is the printer's device file path.
and running the following php code doesn't do anything except printing DONE on putty
`<?php require 'vendor/mike42/escpos-php/autoload.php'; use Mike42\Escpos\Printer; use Mike42\Escpos\PrintConnectors\FilePrintConnector;
$connector = new FilePrintConnector("/dev/bus/usb/001/010"); $printer = new Printer($connector); $printer -> text("123\n"); $printer -> cut(); $printer -> close(); echo "DONE";`
any kind of help is appreciated to help me actually print something.
Generally best test connections on the command-line before attempting PHP code (less things to go wrong).
The usual USB setup for this driver on a pi would use usblp if available- Maybe have a read of this blog post, which shows how this would work.
The linux USB example should make more sense once you've sent some "Hello world" lines from a terminal.
Hi @mike42,
I've read through it, and im using root for the sake of the user privilege problems. and i have added root to lp goup. but nothing helps.
also ran modprobe usblp doesnt show anything, so i suppose i already have it?
the problem right now is that when i send data to "/dev/bus/usb/001/010" nothing happens. and that gotta be the printer. so i don't know what i'm doing wrong right now.
I really need the textChinese() function as I can't figure it out in python for the encoding problems.
You are not sending data to a device provided by usblp, so you can't be sure it's a printer at all, nor does your test show whether usblp is loaded (use lsmod for that). Maybe go back through the post again.
If you follow it top-down, I would expect that you end up with paths like /dev/usb/lp0 or /dev/usb/lp1, some dmesg output that verifies usblp has identified the printer, and a command-line test like so.
echo "Hello World!" > /dev/usb/lp0
Aside, Epson TM-T20II does not support Chinese text, and textChinese() is specific to the ZJ-5890 and related printers. Some other printers can print Chinese (driver support here varies), or you can do a search for ImagePrintBuffer on the issue tracker, which should turn up some examples (prints text to an image, then send the image to the printer!)
Hi Kris,
Sorry but I have nothing to add On 23 Nov 2019, 17:55 +1030, kristian-mypos [email protected], wrote:
Hi Mike. how are you doing. I have been using php escpos for a while on Raspberry pi running linux and it worked fine with /dev/usb/lp0 But now i sat my system up on android running termux. so it uses /dev/bus/usb/001/003 and if i run: termux-usb -r /dev/bus/usb/001/003 Access granted. if i do : ls -l /dev/bus/usb/001/003 crw-rw---- 1 root usb 189, 2 Nov 23 13:58 /dev/bus/usb/001/003 I am able to print a test if I use an app called Quick Printer escpos app which uses the same /dev/bus/usb/001/003. But I also have a php/angular backend running which also needs to print. and I am a bit out of ideas. So hoping for you know or have tried termux and can guide me a little :) Best regards Kristian — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.
Hi Kris, Sorry but I have nothing to add … On 23 Nov 2019, 17:55 +1030, kristian-mypos @.***>, wrote: Hi Mike. how are you doing. I have been using php escpos for a while on Raspberry pi running linux and it worked fine with /dev/usb/lp0 But now i sat my system up on android running termux. so it uses /dev/bus/usb/001/003 and if i run: termux-usb -r /dev/bus/usb/001/003 Access granted. if i do : ls -l /dev/bus/usb/001/003 crw-rw---- 1 root usb 189, 2 Nov 23 13:58 /dev/bus/usb/001/003 I am able to print a test if I use an app called Quick Printer escpos app which uses the same /dev/bus/usb/001/003. But I also have a php/angular backend running which also needs to print. and I am a bit out of ideas. So hoping for you know or have tried termux and can guide me a little :) Best regards Kristian — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.
okay fair enough. dont know why you replied then :D Anyways i fixed it. and its working now thats why i deleted the post