# Thermal Printer Ideas I got a [[Thermal Printer]] from [[Adafruit]] for a ridiculously overpriced amount: - [Mini Thermal Receipt Printer : ID 597 : $49.95 : Adafruit Industries, Unique & fun DIY electronics and kits](https://www.adafruit.com/product/597) I started a rust crate that works on the host, after hacking the USB: - [GitHub - wesen/printy: Thermal Printer Crate](https://github.com/wesen/printy) This is what I can currently printout, thinking of the almanach: - ![[PROJ - Thermal printer ideas-1665675141860.jpeg]] ## Ideas ### Almanach - Almanach printout with weather, info about plants, etc... See all the images in [[2022-07-30]] ![[2022-07-30-1659243436648.jpeg]] (from [[Jazz DiMauro]]) ![[2022-07-30-1659243502529.jpeg]] ![[2022-07-30-1659243548197.jpeg]] ![[2022-07-30-1659244081906.jpeg]] More typography experiments: ![[2022-07-30-1659244514867.jpeg]] from [Johnson Banks](https://www.johnsonbanks.co.uk/news/things-seen-at-new-blood). ### Other ideas - one time pad like printouts with [[Zettelkasten]] numbers that can be crossed off (and reserved in [[Obsidian]] too, through an [[Obsidian Plugins]]) - Print out TODO items with a [[QR Codes]] that when scanned cross off the item in [[Todoist]] for example, or link to a page with more information - Daily "newsletter" with curated facts and beautiful images about a topic, that can be subscribed to - [[PROJ - Font glyph rendering crate for thermal printer]] - feed subscription mechanism, with XML format to generate nicely formatted and rendered printouts (tailored for receipt printers) ## Zulip notes about XON/XOFF flow control From: [Zulip - USB Serial XON XOFF](https://recurse.zulipchat.com/#narrow/stream/26440-small-questions/topic/macosx.20usbserial.20XON.2FXOFF) I can't for the life of me set XON/XOFF flow control on my usb serial interface on OSX. I'm using https://github.com/wesen/printy/blob/main/examples/test-xon-xoff.rs with ```shell ❯ cargo run --example test-xon-xoff -- /dev/tty.usbmodem21102 Opening /dev/tty.usbmodem21102 Getting termios from 3 Before 0 Setting 1536 After 0 Setting 3648 After 64 ``` and you can see that IXON IXOFF are not set (should be 600). Same with stty: ```shell ❯ stty -F /dev/tty.usbmodem21102 ixon ixoff stty: /dev/tty.usbmodem21102: unable to perform all requested operations ``` Of course things work fine on linux. Am I being daft, or what the heck OSX? As far as I can tell, this is all the stock USB CDC/ACM drivers too: ``` > kextstat ... 251 2 0xfffffe00073fe520 0x4000 0x4000 com.apple.driver.usb.cdc (5.0.0) 9F3E4A41-C56F-34E1-8BFF-F470BAF994EE <210 128 56 5 4 3 1> 252 0 0xfffffe0007406df0 0x4000 0x4000 com.apple.driver.usb.realtek8153patcher (5.0.0) 2DFA344A-2A21-31F1-81C5-02C0B30FA0D6 <56 5 4 3 1> 254 0 0xfffffe0007401fb0 0x4000 0x4000 com.apple.driver.usb.cdc.ecm (5.0.0) BEF9B7AF-0977-3885-8430-4D8593649126 <251 210 56 55 45 5 4 3 1> 255 1 0xfffffe0007407460 0x4000 0x4000 com.apple.driver.usb.serial (6.0.0) 7E154FCF-BB5B-3A67-9A65-6B02B241A518 <56 44 5 4 3 1> 256 0 0xfffffe00073fa7a0 0x4000 0x4000 com.apple.driver.usb.cdc.acm (5.0.0) 84700FBF-81A3-3E40-B119-73D7A9B23970 <255 251 210 128 56 44 5 4 3 1> ... ``` I'm sure I had XON/XOFF on osx working the last time I tried (15 years ago??). This is actually seriously bugging me because the device I'm controlling is being very aggressive with its STOP and only sending it right before it overflows, which means I literally would have to poll it on every byte I write. So correction, linux pl2303 does only support XOFF, not XON: https://patchwork.kernel.org/project/linux-usb/patch/[email protected]/ . Background is, I'm trying to print to the adafruit thermal printer, and in their tutorial they seem to have XON/XOFF working because they interface with a raspberry PI. There is a DTR pin I unearthed in the printer internals, but it looks like it is not active anymore. I also unearthed some USB pins, so I'm gonna try wiring that up because what do I have to lose at this point... In the worst case, I'll build my own XON/XOFF CDC/ACM board, because I really want to print "high quality" bitmaps on that printer, and my "fake flow control" makes it the device stutter and introduces grayscale variance. so oddly enough i added USB to the motherboard of the printer, which also loads the lp2303 driver, and still doesn't have ixon with stty, but this time, the zj58 cups driver seems to not trip over itself, and i can confirm the printer can do smooth continuous printing. Now I need to figure out how to get my rust to do the same. ![[PROJ - Thermal printer ideas-1664631255864.jpeg]] for the sake of completeness, since i'm going to use this thread to document my findings, i do see the STOP byte when sniffing the hardware serial. of course i left my usb sniffer at my previous workplace and can;t just decode the CDC USB stream (although i know linux software sniffers are quite good, so I'll look into that). I suppose it's the usb serial in the device itself that does the flow control, and no real STOP byte is sent to the host. but if i just yeet bytes at it in rust it times out, yet the zj58 driver doesn't seem to care either I guess it just works in rust now as well, I had to adjust the timeout duration on the serial port, and instead of chunking my output into multiple raster images as I was doing before, I do need to send the whole raster, and then wait, because sending a new raster while the first is still printing is not great. Of course, th eprinter itself doesn't send much back in terms of status, so it's still a bit of a gamble also this cheap paper from adafruit is absolutely nasty, you literally can feel the BPA coating your fingers even if you just touch it lightly. I have other paper for my zebra printers that is much less aggressive