I have a RPi Zero W as a printer gadget, and it shows up as a printer on my Macbook (solved here in comments https://unix.stackexchange.com/questions/408293/how-to-make-g-printer-usb-gadget-printer-work-in-raspberian-pi?noredirect=1#comment731094_408293). I have it set on the Mac as an Epson 9-pin (a very basic printer).

If I send data from my Macbook with lp -d linux_g_printer some_text_file.txt and listen on the RPi as sudo cat /dev/g_printer0 the RPi receives garbage characters.

Is the lp operation trashing the text due to the driver? Is the cat operation not appropriate to listen? How do I test the interface and send data?

  • Did you try strings /dev/g_printer0 – RubberStamp Dec 2 '17 at 17:46
  • The file I'm sending is a readme text file so it should be text except for newlines. Running strings on the file on the Macbook displays the lines of the file. Running it on the RPi displays nothing. It looks like the data arriving at g_printer0 is being corrupted (or modified) so mostly non-printable data (binary) is being returned, and thus no output from strings. It's like a classical serial port baud rate problem, but that should not apply here. – George Shaw Dec 2 '17 at 18:00
  • Try setting the output of the Mac to "raw" ... MacOSx uses CUPS... in fact, Apple is the vendor of CUPS... you can probably change many of the more advanced printer settings through the CUPS web interface at http://localhost:631 – RubberStamp Dec 2 '17 at 18:45
  • Fantastic! That worked. – George Shaw Dec 4 '17 at 18:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.