This commit is contained in:
root 2024-02-14 10:17:16 +03:00
parent 0b9e97255f
commit b827f045b1

View File

@ -7,7 +7,11 @@ define("LF", "\x0a");
define("PORT", "/dev/usb/lp0"); define("PORT", "/dev/usb/lp0");
function rawlen($data) { function rawlen($data) {
if (strlen($data)<255 and strlen($data)<MAX_CHAR) { if (strlen($data)<255 and strlen($data)<MAX_CHAR) {
return hex2bin(dechex(strlen($data))); if (strlen($data)<16) {
return hex2bin("0" . dechex(strlen($data)));
} else {
return hex2bin(dechex(strlen($data)));
}
} else { } else {
return false; return false;
} }