Open / Closing device added to sendData

This commit is contained in:
Matthias Fulz 2022-07-02 13:50:36 +02:00
parent 90ae4ac116
commit 3556fedfdd
1 changed files with 7 additions and 2 deletions

View File

@ -285,8 +285,13 @@ func setCfg(dev *QEncDevice, cfg QEncCfg, val uint8) (err error) {
} }
func sendDataWrapper(dev *QEncDevice, data []byte, cmd QEncCmd, id uint32) (ret []byte, err error) { func sendDataWrapper(dev *QEncDevice, data []byte, cmd QEncCmd, id uint32) (ret []byte, err error) {
dev.Lock() if err = dev.Open(); err != nil {
defer dev.UnLock() return nil, err
}
if err = dev.Lock(); err != nil {
return nil, err
}
defer dev.Close()
done := make(chan bool) done := make(chan bool)
msgc := make(chan string) msgc := make(chan string)