mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-04 11:07:46 +00:00
machine/usb/descriptor: avoid bytes package
We can't use the bytes package in Go 1.24 since it would result in an import cycle. Therefore, use bytealg.Index instead. (I'm not sure this code is correct - just searching for a range of bytes seems brittle. But at least this commit shouldn't change the code).
This commit is contained in:
committed by
Ron Evans
parent
52b9fcd57f
commit
a1be8cd9fe
@@ -1,9 +1,9 @@
|
||||
package descriptor
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"internal/binary"
|
||||
"internal/bytealg"
|
||||
)
|
||||
|
||||
var configurationCDCHID = [configurationTypeLen]byte{
|
||||
@@ -87,7 +87,7 @@ func FindClassHIDType(des, class []byte) (ClassHIDType, error) {
|
||||
|
||||
// search only for ClassHIDType without the ClassLength,
|
||||
// in case it has already been set.
|
||||
idx := bytes.Index(des, class[:ClassHIDTypeLen-2])
|
||||
idx := bytealg.Index(des, class[:ClassHIDTypeLen-2])
|
||||
if idx == -1 {
|
||||
return ClassHIDType{}, errNoClassHIDFound
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user