44 lines
		
	
	
		
			920 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
		
			920 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/bin/bash
 | 
						|
DEVICE=/dev/ttyUSB0
 | 
						|
function init() {
 | 
						|
  stty -F $DEVICE 1:0:80000dbd:0:3:1c:7f:15:4:5:1:0:11:13:1a:0:12:f:17:16:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0
 | 
						|
 | 
						|
  # \x1b\x47     - Double Strike
 | 
						|
  # \x1b\x78\x01 - Standard Letter Mode
 | 
						|
  # \x1b\x52\x02 - German
 | 
						|
  printf "\x1b\x47\x1b\x78\x01\x1b\x52\x02" >> "$DEVICE"
 | 
						|
 | 
						|
}
 | 
						|
 | 
						|
function printFile() {
 | 
						|
  # Replace charset stuff
 | 
						|
  sed -i 's/╔/\xc9/g;s/═/\xcd/g;s/╗/\xbb/g;s/║/\xba/g;s/╚/\xc8/g;s/╝/\xbc/g;s/§/\x40/g;s/Ä/\x5b/g;s/Ö/\x5c/g;s/Ü/\x5d/g;s/ä/\x7b/g;s/ö/\x7c/g;s/ü/\x7d/g;s/ß/\x7e/g' "$1"
 | 
						|
 | 
						|
  # Eject
 | 
						|
  printf "\x0c" >> "$1"
 | 
						|
 | 
						|
  # Print
 | 
						|
  cat $1 >> "$DEVICE"
 | 
						|
}
 | 
						|
 | 
						|
function resetLetters() {
 | 
						|
  printf "\x12\x14\x1b\x35" >> "$1"
 | 
						|
}
 | 
						|
 | 
						|
function bigLetters() {
 | 
						|
  resetLetters "$1"
 | 
						|
  printf "\x0e" >> "$1"
 | 
						|
}
 | 
						|
 | 
						|
function smallLetters() {
 | 
						|
  resetLetters "$1"
 | 
						|
  printf "\x0f" >> "$1"
 | 
						|
}
 | 
						|
 | 
						|
function italicLetters() {
 | 
						|
  printf "\x1b\x34" >> "$1"
 | 
						|
}
 | 
						|
 | 
						|
init
 | 
						|
resetLetters $DEVICE
 |