Emulated_USB_Printer
Emulated_USB_Printer copied to clipboard
Raspberry Pi 4 - Problems with accessing /dev/g_printer0
On a Raspberry Pi 4B, I have used this code and have the USB-OTG port correctly configured to emulate an Epson TM-T88V printer. The host machine recognises the Raspberry Pi as the Epson printer.
Unfortunately, I have hit a problem.
I have the code running in /home/pi/software, and the compiled program has chown root:root on it.
If I use:
fd[0].fd = open(PRINTER_FILE, O_RDWR);
I get an error - cannot open /dev/g_printer0 (it shows in the /dev directory though)
If I change this to:
fd[0].fd = open(PRINTER_FILE, O_RDONLY);
or do a CHMOD 777 on /dev/g_printer0, the code opens the device successfully.
However, I get errors when polling the device - errno = 2 (No such file or directory)
Any ideas - could it be a cabling issue?
Hi, nice seeing you are playing around with this as well :) Mentioned you and your product a few times in my thesis! Sadly I never had the chance to play around with the RPI 4B. My first guess was that there is a second device descriptor which has a similar name like g_printer0. The original documentation mentions "/dev/g_printer" as the device descriptor.
I tested it with the RPI Zero WH having Linux raspberrypi 5.4.83+ armv6l installed. Dunno if the RPI 4B can run this version. I wouldn't think it's cabeling as the host seems to detect the pi correctly as a printer.
Maybe I will find some time this weekend to try myself. Also, it would be pretty cool if would share the parameters for the emulation of the Epson TM-T88V printer, but of course you don't have to ;)
Really interested in the implementation using the Raspberry Pi 4B!!
So far as I can tell, the Raspberry Pi only supports /dev/g_printer0
I would be interested to read your thesis some time :)
Hi :) Did you get any further? Thesis is in german :( Sorry about that.
Has anyone got any further with getting this to successfully run on the Raspberry Pi 4 so that a host computer still believes the original USB printer is connected?
So last year I got the Pi to emulate an Epson printer and managed to connect it to a Windows till system which recognised it as the Epson printer. I was then able to print out till receipts directly to the Pi and read them from /dev/g_printer0. Unfortunately, I don't remember how I got this to work and after putting the project down for a couple weeks and coming back to it I wasn't able to replicate my previous success. I appreciate that this isn't the most helpful comment but there is some light at the end of this tunnel 😂
Hi Rasperryy, Can you please help to configure and make it work Raspberry pi 4 ?
HI @yuvarajan-prs , unfortunately I don't have a Pi4 ready for testing. Have you tried it yet? Where do you get stuck?
Awesome repo , thanks for all the work you put into it
@RWAP any chance you still have the epson vid,pid and ipnp string still
Would save me having to buy a unit just to replace it with this code on a cm4
All I have is :
modprobe g_printer idVendor=0x04b8 idProduct=0x0e02 bcdDevice="256" iManufacturer="EPSON" iProduct="TM-T88V" iSerialNum="405139460344080000" iPNPstring="MFG:EPSON;CMD:ESC/POS;MDL:TM-T88V;CLS:PRINTER;DES:EPSON TM-T88V;CID:EpsonTM00000001;"
I never got this to work reliably on a Pi 4 though
You are the man
Cool! Thanks for sharing :) I will add it to the repo too. If you have any additional connection details, please share them with us '-'
Did anyone manage to get this working on a Pi 4? I've tried everything I can think of. It worked on a zero but I really need a wired ethernet connection....
Interestingly, it has worked randomly twice. I am currently wondering about power consumption.... Will try a powered hub (plugged into the computer not the pi)
Hi there! Unfortunately I didn't have time to try and use the RaspberryPi4 yet. You will definitely not be able to power the RPI 4 per USB2 Bus though, that's for sure. Please keep me updated with your findings once you use an external Power Supply. Also, please share your printer parameters (vendorID, iPNPstring, ...) with us here, that is always helpful!
Did anyone manage to get this working on a Pi 4? I've tried everything I can think of. It worked on a zero but I really need a wired ethernet connection....
If everything else fails, maybe there is an adapter for the RaspberryPi Zero for Ethernet?
I have an ENC28J60 on the way to try and do that over SPI.....
Weirdly, I've ended up with one SD card that seems to work (with the pi4). I have no idea why. I'm currently taking a backup of it in case I break it! I've even managed to convert the .bin data to html using this project: https://github.com/receipt-print-hq/escpos-tools/blob/master/doc/esc2html.md I'm using the parameters for an Epson TM-T88V above.
Using a powered hub (well my docking station) didn't help :(
Will keep the group posted on progress