You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was running the getStatus() method (with a serial interface) and it only ever returns undefined every time. I'm not sure I understand how this is supposed to work exactly, maybe someone can explain! Also, if it's just my printer you can tell me to go kick rocks.
In the Epson config, we have TRANSMIT_PAPER_STATUS set to the hex buffer of 0x1d, 0x72, 0x01 (which corresponds to this docs page for transmitting status. However, I don't see any serial read in the codebase here, I'm not sure how the interface parses responses?
If I didn't miss the obvious and there is serial reading, it might be better to use the real-time status for the whole printer in these DLE EOT commands (0x10, 0x04, 0x04 specifically)
I have a little bash script I had written as a PoC, but it would be much nicer to have this in the library!
#!/bin/bash# this is my path, replace obviously
PRINTER="/dev/usb/lp2"check_printer_access() {
if [ !-w"$PRINTER" ];thenecho"Error: Cannot access $PRINTER. Make sure you have the right permissions."exit 1
fi
}
get_printer_status() {
# referenced here: https://download4.epson.biz/sec_pubs/pos/reference_en/escpos/dle_eot.htmlecho -en '\x10\x04\x04'>"$PRINTER"
sleep 0.1
response=$(xxd -b "$PRINTER"| head -n 1 | awk '{print $2}')echo"$response"
}
interpret_status() {
local binary="$1"echo"binary status: $binary"# check bits 2 and 3 for roll paper near-end sensor
near_end="${binary:2:2}"case"$near_end"in"00") echo"NEAR-end sensor: paper adequate" ;;
"11") echo"NEAR-end sensor: paper near-end" ;;
*) echo"NEAR-end sensor: unknown status ($near_end)" ;;
esac# check bits 5 and 6 for roll paper end sensor
paper_end="${binary:5:2}"case"$paper_end"in"00") echo"END sensor: paper present" ;;
"11") echo"END sensor: paper not present" ;;
*) echo"END sensor: unknown status ($paper_end)" ;;
esac
}
check_printer_access
status=$(get_printer_status)
interpret_status "$status"
The text was updated successfully, but these errors were encountered:
I was running the
getStatus()
method (with a serial interface) and it only ever returnsundefined
every time. I'm not sure I understand how this is supposed to work exactly, maybe someone can explain! Also, if it's just my printer you can tell me to go kick rocks.In the Epson config, we have
TRANSMIT_PAPER_STATUS
set to the hex buffer of0x1d, 0x72, 0x01
(which corresponds to this docs page for transmitting status. However, I don't see any serial read in the codebase here, I'm not sure how the interface parses responses?If I didn't miss the obvious and there is serial reading, it might be better to use the real-time status for the whole printer in these DLE EOT commands (
0x10, 0x04, 0x04
specifically)I have a little bash script I had written as a PoC, but it would be much nicer to have this in the library!
The text was updated successfully, but these errors were encountered: