machine/usb/descriptor: rename and export Append() to make it easier to create new descriptors in user code
Signed-off-by: deadprogram <ron@hybridgroup.com>
Этот коммит содержится в:
родитель
d8ee520bdc
коммит
90935703e6
5 изменённых файлов: 7 добавлений и 7 удалений
|
@ -152,7 +152,7 @@ var InterfaceCDCData = InterfaceType{
|
|||
|
||||
var CDC = Descriptor{
|
||||
Device: DeviceCDC.Bytes(),
|
||||
Configuration: appendSlices([][]byte{
|
||||
Configuration: Append([][]byte{
|
||||
ConfigurationCDC.Bytes(),
|
||||
InterfaceAssociationCDC.Bytes(),
|
||||
InterfaceCDCControl.Bytes(),
|
||||
|
|
|
@ -46,7 +46,7 @@ func (d *Descriptor) Configure(idVendor, idProduct uint16) {
|
|||
conf.TotalLength(uint16(len(d.Configuration)))
|
||||
}
|
||||
|
||||
func appendSlices[T any](slices [][]T) []T {
|
||||
func Append[T any](slices [][]T) []T {
|
||||
var size, pos int
|
||||
|
||||
for _, s := range slices {
|
||||
|
|
|
@ -113,7 +113,7 @@ var ClassHID = ClassHIDType{
|
|||
|
||||
var CDCHID = Descriptor{
|
||||
Device: DeviceCDC.Bytes(),
|
||||
Configuration: appendSlices([][]byte{
|
||||
Configuration: Append([][]byte{
|
||||
ConfigurationCDCHID.Bytes(),
|
||||
InterfaceAssociationCDC.Bytes(),
|
||||
InterfaceCDCControl.Bytes(),
|
||||
|
@ -130,7 +130,7 @@ var CDCHID = Descriptor{
|
|||
EndpointEP4IN.Bytes(),
|
||||
}),
|
||||
HID: map[uint16][]byte{
|
||||
2: appendSlices([][]byte{
|
||||
2: Append([][]byte{
|
||||
HIDUsagePageGenericDesktop,
|
||||
HIDUsageDesktopKeyboard,
|
||||
HIDCollectionApplication,
|
||||
|
|
|
@ -68,7 +68,7 @@ var ClassHIDJoystick = ClassHIDType{
|
|||
data: classHIDJoystick[:],
|
||||
}
|
||||
|
||||
var JoystickDefaultHIDReport = appendSlices([][]byte{
|
||||
var JoystickDefaultHIDReport = Append([][]byte{
|
||||
HIDUsagePageGenericDesktop,
|
||||
HIDUsageDesktopJoystick,
|
||||
HIDCollectionApplication,
|
||||
|
@ -136,7 +136,7 @@ var JoystickDefaultHIDReport = appendSlices([][]byte{
|
|||
// custom configurations.
|
||||
var CDCJoystick = Descriptor{
|
||||
Device: DeviceJoystick.Bytes(),
|
||||
Configuration: appendSlices([][]byte{
|
||||
Configuration: Append([][]byte{
|
||||
ConfigurationCDCJoystick.Bytes(),
|
||||
InterfaceAssociationCDC.Bytes(),
|
||||
InterfaceCDCControl.Bytes(),
|
||||
|
|
|
@ -220,7 +220,7 @@ var ConfigurationCDCMIDI = ConfigurationType{
|
|||
|
||||
var CDCMIDI = Descriptor{
|
||||
Device: DeviceCDC.Bytes(),
|
||||
Configuration: appendSlices([][]byte{
|
||||
Configuration: Append([][]byte{
|
||||
ConfigurationCDCMIDI.Bytes(),
|
||||
InterfaceAssociationCDC.Bytes(),
|
||||
InterfaceCDCControl.Bytes(),
|
||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче