Fix status decoding
Mainly to reflect a real-world printer.
This commit is contained in:
parent
c9e5b4d1e9
commit
43b5536c4d
|
@ -62,15 +62,19 @@ func printStatusInformation(d []byte) {
|
||||||
switch b := d[11]; b {
|
switch b := d[11]; b {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
log.Println("media: no media")
|
log.Println("media: no media")
|
||||||
case 0x4a:
|
case 0x4a, 0x0a: // 0x4a = J, in reality we get 0x0a as in QL-1100 docs
|
||||||
log.Println("media: continuous length tape")
|
log.Println("media: continuous length tape")
|
||||||
case 0x4b:
|
case 0x4b, 0x0b: // 0x4b = K, in reality we get 0x0b as in QL-1100 docs
|
||||||
log.Println("media: die-cut labels")
|
log.Println("media: die-cut labels")
|
||||||
default:
|
default:
|
||||||
log.Println("media:", b)
|
log.Println("media:", b)
|
||||||
}
|
}
|
||||||
|
|
||||||
// d[14] seems to be 0x14 in a real-world QL-800.
|
// In a real-world QL-800, d[14] seems to be:
|
||||||
|
// 0x01 with die-cut 29mm long labels,
|
||||||
|
// 0x14 with 29mm tape,
|
||||||
|
// 0x23 with red-black 62mm tape,
|
||||||
|
// and directly corresponds to physical pins on the tape.
|
||||||
if d[12] != 0x00 || d[13] != 0x00 || d[14] != 0x3f {
|
if d[12] != 0x00 || d[13] != 0x00 || d[14] != 0x3f {
|
||||||
log.Println("unexpected status fixed bytes")
|
log.Println("unexpected status fixed bytes")
|
||||||
}
|
}
|
||||||
|
@ -83,7 +87,7 @@ func printStatusInformation(d []byte) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Media length.
|
// Media length.
|
||||||
log.Println("media width:", d[17], "mm")
|
log.Println("media length:", d[17], "mm")
|
||||||
|
|
||||||
// Status type.
|
// Status type.
|
||||||
switch b := d[18]; b {
|
switch b := d[18]; b {
|
||||||
|
@ -128,7 +132,9 @@ func printStatusInformation(d []byte) {
|
||||||
log.Println("notification number:", b)
|
log.Println("notification number:", b)
|
||||||
}
|
}
|
||||||
|
|
||||||
// d[25] seems to be 0x01 in a real-world QL-800.
|
// In a real-world QL-800, d[25] seems to be:
|
||||||
|
// 0x01 with 29mm tape or die-cut 29mm long labels,
|
||||||
|
// 0x81 with red-black 62mm tape.
|
||||||
if d[23] != 0x00 || d[24] != 0x00 || d[25] != 0x00 || d[26] != 0x00 ||
|
if d[23] != 0x00 || d[24] != 0x00 || d[25] != 0x00 || d[26] != 0x00 ||
|
||||||
d[27] != 0x00 || d[28] != 0x00 || d[29] != 0x00 || d[30] != 0x00 ||
|
d[27] != 0x00 || d[28] != 0x00 || d[29] != 0x00 || d[30] != 0x00 ||
|
||||||
d[31] != 0x00 {
|
d[31] != 0x00 {
|
||||||
|
|
|
@ -109,9 +109,9 @@ func printStatusInformation(d []byte) {
|
||||||
switch b := d[11]; b {
|
switch b := d[11]; b {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
log.Println("media: no media")
|
log.Println("media: no media")
|
||||||
case 0x4a:
|
case 0x4a, 0x0a: // 0x4a = J, in reality we get 0x0a as in QL-1100 docs
|
||||||
log.Println("media: continuous length tape")
|
log.Println("media: continuous length tape")
|
||||||
case 0x4b:
|
case 0x4b, 0x0b: // 0x4b = K, in reality we get 0x0b as in QL-1100 docs
|
||||||
log.Println("media: die-cut labels")
|
log.Println("media: die-cut labels")
|
||||||
default:
|
default:
|
||||||
log.Println("media:", b)
|
log.Println("media:", b)
|
||||||
|
@ -121,7 +121,7 @@ func printStatusInformation(d []byte) {
|
||||||
log.Println("mode:", d[15])
|
log.Println("mode:", d[15])
|
||||||
|
|
||||||
// Media length.
|
// Media length.
|
||||||
log.Println("media width:", d[17], "mm")
|
log.Println("media length:", d[17], "mm")
|
||||||
|
|
||||||
// Status type.
|
// Status type.
|
||||||
switch b := d[18]; b {
|
switch b := d[18]; b {
|
||||||
|
|
2
ql/ql.go
2
ql/ql.go
|
@ -2,6 +2,8 @@
|
||||||
package ql
|
package ql
|
||||||
|
|
||||||
// Resources:
|
// Resources:
|
||||||
|
// http://etc.nkadesign.com/Printers/QL550LabelPrinterProtocol
|
||||||
|
// https://github.com/torvalds/linux/blob/master/drivers/usb/class/usblp.c
|
||||||
// http://www.undocprint.org/formats/page_description_languages/brother_p-touch
|
// http://www.undocprint.org/formats/page_description_languages/brother_p-touch
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
Loading…
Reference in New Issue