mirror of
https://github.com/clockworkpi/DevTerm.git
synced 2025-12-17 12:48:49 +01:00
Created Guide To Setup thermal printer from source code (markdown)
parent
6ad6944226
commit
32da2153b8
66
Guide-To-Setup-thermal-printer-from-source-code.md
Normal file
66
Guide-To-Setup-thermal-printer-from-source-code.md
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
# Prepare
|
||||||
|
Before everything
|
||||||
|
We assume that you have a Devterm with stock os running
|
||||||
|
and a little bit of Linux compiling experience
|
||||||
|
know how to install packages through `apt`
|
||||||
|
|
||||||
|
|
||||||
|
## CM3 or CM4
|
||||||
|
```
|
||||||
|
sudo apt install -y wiringpi libwiringpi-dev libcups2-dev
|
||||||
|
```
|
||||||
|
|
||||||
|
## A06 A04
|
||||||
|
```
|
||||||
|
git clone https://github.com/clockworkpi/DevTerm.git
|
||||||
|
cd DevTerm/Code/devterm_wiringpi_cpi/
|
||||||
|
sudo ./build
|
||||||
|
#chose 0 or 1 depend which board you have
|
||||||
|
```
|
||||||
|
|
||||||
|
## R01
|
||||||
|
```
|
||||||
|
git clone https://github.com/clockworkpi/DevTerm.git
|
||||||
|
wget https://github.com/WiringPi/WiringPi/archive/refs/tags/final_official_2.50.tar.gz
|
||||||
|
tar zxvf final_official_2.50.tar.gz
|
||||||
|
cd WiringPi-final_official_2.50/
|
||||||
|
cp ../DevTerm/Code/patch/d1/wiringCP0329.patch .
|
||||||
|
git apply wiringCP0329.patch
|
||||||
|
sudo ./build
|
||||||
|
#Choice: 2
|
||||||
|
```
|
||||||
|
|
||||||
|
# Compile thermal printer code
|
||||||
|
```
|
||||||
|
git clone https://github.com/clockworkpi/DevTerm.git
|
||||||
|
cd DevTerm/Code/thermal_printer
|
||||||
|
make
|
||||||
|
sudo systemctl stop devterm-printer
|
||||||
|
sudo cp -rf devterm_thermal_printer.elf /usr/local/bin
|
||||||
|
sudo systemctl start devterm-printer
|
||||||
|
```
|
||||||
|
## debug or run it from manually
|
||||||
|
1. setup socat socket for data receving for thermal printer
|
||||||
|
```
|
||||||
|
sudo socat -d -d pty,link=/tmp/DEVTERM_PRINTER_OUT,raw,echo=0 pty,link=/tmp/DEVTERM_PRINTER_IN,raw,echo=0
|
||||||
|
sudo ./usr/local/bin/devterm_socat.sh # <- this .sh file is in DevTerm/Code/thermal_printer/usr/local/bin/
|
||||||
|
```
|
||||||
|
1. run devterm_thermal_printer.elf
|
||||||
|
```
|
||||||
|
sudo ./devterm_thermal_printer.elf
|
||||||
|
```
|
||||||
|
|
||||||
|
now you can test the printer by cat or echo something into `/tmp/DEVTERM_PRINTER_IN`
|
||||||
|
eg: `echo "hello world\n\n\n\n\n\n\n\n\n\n" > /tmp/DEVTERM_PRINTER_IN
|
||||||
|
|
||||||
|
## For cups
|
||||||
|
just install `devterm-thermal-printer-cups`
|
||||||
|
``` sudo apt install devterm-thermal-printer-cups```
|
||||||
|
|
||||||
|
this package will add a CUPS serial printer adapter,a CUPS filter for the DevTerm's thermal printer
|
||||||
|
and will let other programs to print content through image printing using DevTerm's thermal printer
|
||||||
|
source code is in https://github.com/clockworkpi/DevTerm/tree/main/Code/devterm_thermal_printer_cups
|
||||||
|
|
||||||
|
all devterm related deb packages available at
|
||||||
|
|
||||||
|
https://github.com/clockworkpi/apt
|
||||||
Loading…
x
Reference in New Issue
Block a user