Add USB HID joystick support (#3366)

machine/usb: add USB HID joystick support
This commit is contained in:
irieda
2023-01-08 06:30:40 +09:00
committed by GitHub
parent 0566bbfeb4
commit a7ff2731b9
10 changed files with 482 additions and 14 deletions
+5 -4
View File
@@ -14,10 +14,11 @@ var (
)
const (
hidEndpoint = 4
hidEndpoint = usb.HID_ENDPOINT_IN
usb_SET_REPORT_TYPE = 33
usb_SET_IDLE = 10
REPORT_TYPE_INPUT = 1
REPORT_TYPE_OUTPUT = 2
REPORT_TYPE_FEATURE = 3
)
type hidDevicer interface {
@@ -51,7 +52,7 @@ func handler() {
func setupHandler(setup usb.Setup) bool {
ok := false
if setup.BmRequestType == usb_SET_REPORT_TYPE && setup.BRequest == usb_SET_IDLE {
if setup.BmRequestType == usb.SET_REPORT_TYPE && setup.BRequest == usb.SET_IDLE {
machine.SendZlp()
ok = true
}