-
Notifications
You must be signed in to change notification settings - Fork 1
make rallisport challenge work #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,7 +25,7 @@ | |
| #include "hw/usb/desc.h" | ||
| #include "ui/input.h" | ||
|
|
||
| // #define DEBUG_XID | ||
| #define DEBUG_XID | ||
| #ifdef DEBUG_XID | ||
| #define DPRINTF printf | ||
| #else | ||
|
|
@@ -112,7 +112,7 @@ static const USBDescIface desc_iface_xbox_gamepad = { | |
| .bInterfaceProtocol = 0x00, | ||
| .eps = (USBDescEndpoint[]) { | ||
| { | ||
| .bEndpointAddress = USB_DIR_IN | 0x02, | ||
| .bEndpointAddress = USB_DIR_IN | 0x01, | ||
| .bmAttributes = USB_ENDPOINT_XFER_INT, | ||
| .wMaxPacketSize = 0x20, | ||
| .bInterval = 4, | ||
|
|
@@ -347,10 +347,10 @@ static void usb_xid_handle_control(USBDevice *dev, USBPacket *p, | |
| DPRINTF("Set rumble power to 0x%x, 0x%x\n", | ||
| s->out_state.left_actuator_strength, | ||
| s->out_state.right_actuator_strength); | ||
| p->actual_length = s->out_state.length; | ||
| } else { | ||
| assert(false); | ||
| } | ||
| //p->status = USB_RET_STALL; | ||
| break; | ||
| /* XID requests */ | ||
| case VendorInterfaceRequest | USB_REQ_GET_DESCRIPTOR: | ||
|
|
@@ -364,9 +364,9 @@ static void usb_xid_handle_control(USBDevice *dev, USBPacket *p, | |
| } | ||
| break; | ||
| case VendorInterfaceRequest | XID_GET_CAPABILITIES: | ||
| DPRINTF("xid XID_GET_CAPABILITIES 0x%x\n", value); | ||
| DPRINTF("xid 0x%X XID_GET_CAPABILITIES 0x%x\n", request, VendorInterfaceRequest); | ||
| /* FIXME: ! */ | ||
| p->status = USB_RET_STALL; | ||
| // p->status = USB_RET_STALL; | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe this one is what fixed the game - but needs further research
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Very likely. This should return the capabilty masks. |
||
| //assert(false); | ||
| break; | ||
| case ((USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_DEVICE) << 8) | ||
|
|
@@ -399,23 +399,30 @@ static void usb_xid_handle_data(USBDevice *dev, USBPacket *p) | |
| { | ||
| USBXIDState *s = (USBXIDState *)dev; | ||
|
|
||
| DPRINTF("xid handle_data 0x%x %d 0x%zx\n", p->pid, p->ep->nr, p->iov.size); | ||
| if ((p->pid != 0x69) || (p->ep->nr != 1) || (p->iov.size != 0x20)) { | ||
| DPRINTF("xid handle_data 0x%x %d 0x%zx\n", p->pid, p->ep->nr, p->iov.size); | ||
| } | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just a printf filter, can be ignored - but it's quite useful |
||
|
|
||
| switch (p->pid) { | ||
| case USB_TOKEN_IN: | ||
| if (p->ep->nr == 2) { | ||
| if (p->ep->nr == 1) { | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed to reflect Controller S - see other change |
||
| if (s->in_dirty) { | ||
| usb_packet_copy(p, &s->in_state, s->in_state.bLength); | ||
| s->in_dirty = false; | ||
| } else { | ||
| p->status = USB_RET_NAK; | ||
| //p->status = USB_RET_NAK; | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Desperate attempts - can probably be reverted
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, this was correct |
||
| } | ||
| } else { | ||
| assert(false); | ||
| } | ||
| break; | ||
| case USB_TOKEN_OUT: | ||
| p->status = USB_RET_STALL; | ||
| if (p->ep->nr == 2) { | ||
| assert(false); | ||
| } else { | ||
| p->status = USB_RET_STALL; | ||
| assert(false); | ||
| } | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. More desperate tests, we pobably need something like this though?
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should also set the rumble; not sure about the still-unhandled case. but I assume |
||
| break; | ||
| default: | ||
| p->status = USB_RET_STALL; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this comes from my Controller S. Need to review using Duke
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My Duke reports
bEndpointAddress 0x02 EP 2 OUTLink to full
lsusboutputThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool, yeah - I'll also look at a duke still. I plan to run linux in QEMU and then compare using libusb [with a real gamepad + virtual gamepad connected at once, sending both the same requests]