Skip to content

Commit 2684efe

Browse files
committed
Incorrect number of written bytes
1 parent d815e0c commit 2684efe

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

hid_enabled.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,13 @@ func (dev *Device) Write(b []byte) (int, error) {
188188
failure, _ := wcharTToString(message)
189189
return 0, errors.New("hidapi: " + failure)
190190
}
191+
192+
if runtime.GOOS == "windows" {
193+
// Do not consider the prepended byte when returning number of written bytes
194+
// otherwise this can lead to confusion in other layers
195+
written -= 1
196+
}
197+
191198
return written, nil
192199
}
193200

0 commit comments

Comments
 (0)