From a1be8cd9fefb5f085d84ce8f2b1115ec287be7d5 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Sun, 16 Feb 2025 15:29:55 +0100 Subject: [PATCH] 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). --- src/machine/usb/descriptor/hid.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/machine/usb/descriptor/hid.go b/src/machine/usb/descriptor/hid.go index ea65f1ed9..06b980153 100644 --- a/src/machine/usb/descriptor/hid.go +++ b/src/machine/usb/descriptor/hid.go @@ -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 }