machine/usb: refactoring descriptors into subpackage for modularity

Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
deadprogram
2023-04-02 12:12:32 +02:00
committed by Ron Evans
parent 6a2dd35fe6
commit 2ab7ee6a8a
15 changed files with 1190 additions and 266 deletions
@@ -0,0 +1,17 @@
package descriptor
const (
classSpecificTypeLen = 5
)
type ClassSpecificType struct {
data []byte
}
func (d ClassSpecificType) Bytes() []byte {
return d.data[:d.data[0]]
}
func (d ClassSpecificType) Length(v uint8) {
d.data[0] = byte(v)
}