Flush input buffers on printer initialization
Seems to be necessary, not sure why.
This commit is contained in:
parent
39e2c5b76d
commit
412efcb1ae
|
@ -108,16 +108,14 @@ func (p *Printer) Initialize() error {
|
||||||
|
|
||||||
// Flush any former responses in the printer's queue.
|
// Flush any former responses in the printer's queue.
|
||||||
//
|
//
|
||||||
// I'm not sure if this is necessary, or rather whether the kernel driver
|
// I haven't checked if this is the kernel driver or the printer doing
|
||||||
// does any buffering that could cause data to be returned at this point.
|
// the buffering that causes data to be returned at this point.
|
||||||
/*
|
|
||||||
var dummy [32]byte
|
var dummy [32]byte
|
||||||
for {
|
for {
|
||||||
if _, err := f.Read(dummy[:]); err == io.EOF {
|
if _, err := p.File.Read(dummy[:]); err == io.EOF {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -185,10 +185,12 @@ func printLabel(id string) error {
|
||||||
}
|
}
|
||||||
defer printer.Close()
|
defer printer.Close()
|
||||||
|
|
||||||
|
/*
|
||||||
printer.StatusNotify = func(status *ql.Status) {
|
printer.StatusNotify = func(status *ql.Status) {
|
||||||
log.Printf("\x1b[1mreceived status\x1b[m\n%+v\n%s",
|
log.Printf("\x1b[1mreceived status\x1b[m\n%+v\n%s",
|
||||||
status[:], status)
|
status[:], status)
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if err := printer.Initialize(); err != nil {
|
if err := printer.Initialize(); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in New Issue