XInput with USB Serial possible?

xnorlax

New member
I'm working on a project where I send control commands to a Teensy 4.1, and then use XInput to map those commands as gamepad outputs.
The control commands are protobuf encoded, and coming over Serial. In a perfect world, I'd only use Serial USB, but I'm struggling to create a USB descriptor that supports the Xbox controller emulation and a USBSerial. For now I am using an FTDI chip with a Hardware serial port.

This seems technically possible - am I wrong?
My current attempt uses the `USB_XINPUT` descriptor from this repo.
I grab the necessary definitions from the stock USB dual serial descriptor, then move

Code:
#define USB_SERIAL_DTR  0x01
#define USB_SERIAL_RTS  0x02
extern volatile uint8_t usb_configuration;

Out of the `ifdefine` block in the modified `usb_serial.h` file to get the code to compile. I'm also updating the `config_desc_size` field to account for the additional interfaces and endpoints, but I'm not able to get my PC to recognize both the Xbox controller and the usb device without warnings. I'm attaching my work commented out in case that's helpful.

Any pointers are much appreciated
 

Attachments

  • usb_desc.h
    41.9 KB · Views: 36
Last edited:
I doubt you can just mash the interface descriptors together and still have it be recognized as both devices, especially because a real xbox pad wouldn't have a serial interface attached but also because the driver would claim the entire device.
 
Back
Top