You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
408 B
21 lines
408 B
#!/bin/bash
|
|
set -e
|
|
dev=/dev/usb/lp0
|
|
|
|
text="$1"
|
|
size="$(printf '%s' "$text" | wc -c)"
|
|
size="$(expr "$size" + 3)"
|
|
size="$(printf '%04x' "$size" | sed -e 's/\(..\)\(..\)/\\x\2\\x\1/g')"
|
|
|
|
# Store data
|
|
printf '\x1D(k' > $dev
|
|
printf "$size" > $dev
|
|
printf '\x31\x50\x30' > $dev
|
|
printf '%s' "$text" > $dev
|
|
|
|
# Print data
|
|
printf '\x1D(k' > $dev
|
|
printf '\x03\0\x31\x51\x30' > $dev
|
|
|
|
# Cut paper
|
|
printf '\x1DVA\0' > $dev
|
|
|