Grobi, I was sort of interested in trying this again. After failing to talk to the non-existent descriptor I gave up. But maybe helping you will get me thinking right and finally get this done.
First what is the issue, you can not enumerate it? To me this is the easiest part. I looked back at the code and your device config is wrong. Should be
Code: Select all
0x12, //size of this descriptor in bytes
USBDESCR_DEVICE, //descriptor type = XBOXUSB_Device_Descriptor
0x10, 0x01, //USB Spec 2.0
0x00, //class code
0x00, //subclass code
0x00, //protocol code
0x08, //EPO buffer size ( needs to be 40, but I cant get it to work )
0x5E, 0x04, //vendor ID 04D8
0x89, 0x02, //product ID
0x21, 0x01, //device release number
0, /* manufacturer string index */
0, /* product string index */
0, /* serial number string index */
1, /* number of configurations */
I made a few changes to it myself but both of my versions worked fine. And yes you do not need a report desc. Also I do have two endpoints set up but think that is only for rumble.
UPDATE: Ok I see where your problem is

I's shocked no-one caught this.
Code: Select all
usbSetInterrupt(reportBuffer, sizeof(reportBuffer));
Not going to work... yoy need to use a size no greater then 8.
like
Now this is the trick here.. xbox has a report size of 20 ( decimal ) but the packet size is 0x20 ( 32).
So we should send it in 4 sets of 8..
Code: Select all
while (!usbInterruptIsReady()) usbPoll();
usbSetInterrupt((void *)&reportBuffer + 0, 8);
while (!usbInterruptIsReady()) usbPoll();
usbSetInterrupt((void *)&reportBuffer + 8, 8);
while (!usbInterruptIsReady()) usbPoll();
usbSetInterrupt((void *)&reportBuffer + 16, 8);
while (!usbInterruptIsReady()) usbPoll();
usbSetInterrupt((void *)&reportBuffer + 24, 8);
This is where I'm a bit stuck. If I set the report size to 10 I get all buttons working. But no analogs. Using a report of 8 I get flashy button ( wrong size I think ) and the pov works.
If I could send one set of 20 We'd be in good shape but maximum packet size for low-speed peripherals is 8 bytes, for full-speed peripherals it can be 8, 16, 32, or 64 bytes . v-usb also has 0 descriptor masters even Christian ovoids these questions and he really knows his stuff. On another project I needed more then 8 and was able to use two sets of 8, and everything worked out fine.
Code: Select all
while (!usbInterruptIsReady()) usbPoll();
usbSetInterrupt((void *)&reportBuffer + 0, 8);
while (!usbInterruptIsReady()) usbPoll();
usbSetInterrupt((void *)&reportBuffer + 8, 8);
So this method does work on v-usb.
Problem here is the usb will not enumerate if I use anything greater then 10. Why 10 I dont know..? We also can not use a packet size of 32, but as I showed above we can get over that by sending multiple packets.
I figure this would work.
Code: Select all
while (!usbInterruptIsReady()) usbPoll();
usbSetInterrupt((void *)&reportBuffer + 0, 10);
while (!usbInterruptIsReady()) usbPoll();
usbSetInterrupt((void *)&reportBuffer + 10, 10);
but I only get buttons the reports 10 and greater are ignored. The interesting thing is I dont get flashy buttons, so the packets are the right size I think?
my last idea what this
Code: Select all
while (!usbInterruptIsReady()) usbPoll();
usbSetInterrupt((void *)&reportBuffer + 0, 8);
while (!usbInterruptIsReady()) usbPoll();
usbSetInterrupt((void *)&reportBuffer + 8, 8);
while (!usbInterruptIsReady()) usbPoll();
usbSetInterrupt((void *)&reportBuffer + 16, 4);
still not right as the report over laps ( flashy buttons ). but here we maintain the packet size limit of 8, and dont go over 32. 8+8+4 totaling in 20. Will a low speed device work? And from what I know v-usb will not do or emulate a full speed deivce.
UPDATE2:
I notice that
Code: Select all
while (!usbInterruptIsReady()) usbPoll();
usbSetInterrupt((void *)&reportBuffer + 0, 8);
while (!usbInterruptIsReady()) usbPoll();
usbSetInterrupt((void *)&reportBuffer + 8, 4);
Will not cause the report to over lap
but
Code: Select all
while (!usbInterruptIsReady()) usbPoll();
usbSetInterrupt((void *)&reportBuffer + 0, 8);
while (!usbInterruptIsReady()) usbPoll();
usbSetInterrupt((void *)&reportBuffer + 8, 3);
Seems 10 is all the report will except, yet I know it should be 20. I tried to change the first bit to a 2 hoping it was the report ID, but no luck. Also reportBuffer[1] should be 14, but any other value has 0 effect. This is the report size. Not sure why its variable?
Also, I did try sending 10 and it does actually expect this..
Code: Select all
while (!usbInterruptIsReady()) usbPoll();
usbSetInterrupt((void *)&reportBuffer + 0, 10);
I'm able to control the black and white buttons with this. I'm not sure how the v-usb is allowing a report size of 10 out of a 8 max pipe? but it does.. and anything greater kills enumeration as expected.
My only other guess, and this is a long shot is to do this.
Code: Select all
while (!usbInterruptIsReady()) usbPoll();
usbSetInterrupt((void *)&reportBuffer + 0, 10);
wait some exact time..
usbSetInterrupt((void *)&reportBuffer + 10, 10);
UPDATE3: I just noticed sending in bytes of 10, prevent data from being change after the first send. That is to say, you only get one packet sent, I'm not too surprised since low speed device are designed to work with 8. So scratch all of the "10" examples above they wont work..
will not work..
Code: Select all
while (!usbInterruptIsReady()) usbPoll();
usbSetInterrupt((void *)&reportBuffer + 0, 10);
needs to be..
Code: Select all
while (!usbInterruptIsReady()) usbPoll();
usbSetInterrupt((void *)&reportBuffer + 0, 8);
And so far I can not send more then one pack..