aboutsummaryrefslogtreecommitdiff
path: root/ql
diff options
context:
space:
mode:
authorPřemysl Janouch <p@janouch.name>2019-04-14 21:34:56 +0200
committerPřemysl Janouch <p@janouch.name>2019-04-14 21:34:56 +0200
commit412efcb1aea3a0803dd3eeae24f80ce62de86238 (patch)
tree0991d60d3d31af31a50c0b3a666c6fba4e7de87f /ql
parent39e2c5b76d264904d34aec3e67665de816dfec4a (diff)
downloadsklad-412efcb1aea3a0803dd3eeae24f80ce62de86238.tar.gz
sklad-412efcb1aea3a0803dd3eeae24f80ce62de86238.tar.xz
sklad-412efcb1aea3a0803dd3eeae24f80ce62de86238.zip
Flush input buffers on printer initialization
Seems to be necessary, not sure why.
Diffstat (limited to 'ql')
-rw-r--r--ql/ql_linux.go16
1 files changed, 7 insertions, 9 deletions
diff --git a/ql/ql_linux.go b/ql/ql_linux.go
index 1b1f22c..9d465b5 100644
--- a/ql/ql_linux.go
+++ b/ql/ql_linux.go
@@ -108,16 +108,14 @@ func (p *Printer) Initialize() error {
// Flush any former responses in the printer's queue.
//
- // I'm not sure if this is necessary, or rather whether the kernel driver
- // does any buffering that could cause data to be returned at this point.
- /*
- var dummy [32]byte
- for {
- if _, err := f.Read(dummy[:]); err == io.EOF {
- break
- }
+ // I haven't checked if this is the kernel driver or the printer doing
+ // the buffering that causes data to be returned at this point.
+ var dummy [32]byte
+ for {
+ if _, err := p.File.Read(dummy[:]); err == io.EOF {
+ break
}
- */
+ }
return nil
}