Unable to build
Closed this issue ยท 5 comments
Hi, thanks for this, I'm just having a bit of trouble getting it to work.
When trying to build minimal example using latest Pico SDK and the tinyusb version it comes with, I get the following error
In file included from /home/haystack/source/pico-sdk/lib/tinyusb/src/common/tusb_common.h:70:0,
from /home/haystack/source/pico-sdk/lib/tinyusb/src/host/usbh.h:34,
from /home/haystack/win/Documents/PlatformIO/Projects/XCube/lib/tusb_xinput/xinput_host.c:8:
/home/haystack/win/Documents/PlatformIO/Projects/XCube/lib/tusb_xinput/xinput_host.c: In function 'xinputh_open':
/home/haystack/win/Documents/PlatformIO/Projects/XCube/lib/tusb_xinput/xinput_host.c:216:19: warning: implicit declaration of function 'tuh_edpt_open'; did you mean 'usbh_edpt_open'? [-Wimplicit-function-declaration]
TU_ASSERT(tuh_edpt_open(dev_addr, desc_ep));
^
/home/haystack/source/pico-sdk/lib/tinyusb/src/common/tusb_verify.h:110:10: note: in definition of macro 'TU_VERIFY_DEFINE'
if ( !(_cond) ) { _handler; return _ret; } \
^~~~~
/home/haystack/source/pico-sdk/lib/tinyusb/src/common/tusb_verify.h:104:51: note: in expansion of macro 'ASSERT_1ARGS'
#define GET_3RD_ARG(arg1, arg2, arg3, ...) arg3
^~~~
/home/haystack/win/Documents/PlatformIO/Projects/XCube/lib/tusb_xinput/xinput_host.c:216:9: note: in expansion of macro 'TU_ASSERT'
TU_ASSERT(tuh_edpt_open(dev_addr, desc_ep));
^~~~~~~~~
/home/haystack/win/Documents/PlatformIO/Projects/XCube/lib/tusb_xinput/xinput_host.c:220:35: warning: implicit declaration of function 'tu_edpt_packet_size'; did you mean 'tu_edpt_validate'? [-Wimplicit-function-declaration]
xid_itf->epout_size = tu_edpt_packet_size(desc_ep);
^~~~~~~~~~~~~~~~~~~
tu_edpt_validate
[ 29%] Building C object CMakeFiles/XCube.dir/home/haystack/source/pico-sdk/lib/tinyusb/src/portable/raspberrypi/rp2040/hcd_rp2040.c.obj
[ 30%] Building C object CMakeFiles/XCube.dir/home/haystack/source/pico-sdk/lib/tinyusb/src/portable/raspberrypi/rp2040/rp2040_usb.c.obj
[ 31%] Building C object CMakeFiles/XCube.dir/home/haystack/source/pico-sdk/lib/tinyusb/src/host/usbh.c.obj
[ 32%] Building C object CMakeFiles/XCube.dir/home/haystack/source/pico-sdk/lib/tinyusb/src/host/usbh_control.c.obj
[ 33%] Building C object CMakeFiles/XCube.dir/home/haystack/source/pico-sdk/lib/tinyusb/src/host/hub.c.obj
[ 34%] Building C object CMakeFiles/XCube.dir/home/haystack/source/pico-sdk/lib/tinyusb/src/class/cdc/cdc_host.c.obj
[ 36%] Building C object CMakeFiles/XCube.dir/home/haystack/source/pico-sdk/lib/tinyusb/src/class/hid/hid_host.c.obj
[ 37%] Building C object CMakeFiles/XCube.dir/home/haystack/source/pico-sdk/lib/tinyusb/src/class/msc/msc_host.c.obj
[ 38%] Building C object CMakeFiles/XCube.dir/home/haystack/source/pico-sdk/lib/tinyusb/src/class/vendor/vendor_host.c.obj
[ 39%] Building C object CMakeFiles/XCube.dir/home/haystack/source/pico-sdk/lib/tinyusb/src/tusb.c.obj
[ 40%] Building C object CMakeFiles/XCube.dir/home/haystack/source/pico-sdk/lib/tinyusb/src/common/tusb_fifo.c.obj
[ 41%] Building C object CMakeFiles/XCube.dir/home/haystack/source/pico-sdk/lib/tinyusb/hw/bsp/rp2040/family.c.obj
[ 43%] Linking CXX executable XCube.elf
/usr/lib/gcc/arm-none-eabi/7.3.1/../../../arm-none-eabi/bin/ld: CMakeFiles/XCube.dir/lib/tusb_xinput/xinput_host.c.obj: in function `xinputh_open':
xinput_host.c:(.text.xinputh_open+0xb2): undefined reference to `tuh_edpt_open'
/usr/lib/gcc/arm-none-eabi/7.3.1/../../../arm-none-eabi/bin/ld: xinput_host.c:(.text.xinputh_open+0xc6): undefined reference to `tu_edpt_packet_size'
/usr/lib/gcc/arm-none-eabi/7.3.1/../../../arm-none-eabi/bin/ld: xinput_host.c:(.text.xinputh_open+0xe4): undefined reference to `tu_edpt_packet_size'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/XCube.dir/build.make:942: XCube.elf] Error 1
make[1]: *** [CMakeFiles/Makefile2:144: CMakeFiles/XCube.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
I tried checking out tinyusb to the same commit that your fork is on and then applying the changes again, but that just gave a different error:
[ 25%] Building CXX object CMakeFiles/XCube.dir/src/main.cpp.obj
In file included from /home/haystack/source/pico-sdk/lib/tinyusb/src/host/usbh.h:35:0,
from /home/haystack/source/pico-sdk/lib/tinyusb/src/tusb.h:45,
from /home/haystack/source/pico-sdk/lib/tinyusb/hw/bsp/board.h:42,
from /home/haystack/win/Documents/PlatformIO/Projects/XCube/src/main.cpp:1:
/home/haystack/source/pico-sdk/lib/tinyusb/src/host/hcd.h: In function 'void hcd_event_xfer_complete(uint8_t, uint8_t, uint32_t, xfer_result_t, bool)':
/home/haystack/source/pico-sdk/lib/tinyusb/src/host/hcd.h:216:3: sorry, unimplemented: non-trivial designated initializers not supported
};
^
make[2]: *** [CMakeFiles/XCube.dir/build.make:63: CMakeFiles/XCube.dir/src/main.cpp.obj] Error 1
make[1]: *** [CMakeFiles/Makefile2:144: CMakeFiles/XCube.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
It looks like youre using an old version of Tinyusb. usbh_edpt_open
which it is trying to suggest was removed back in March.
The non-trivial designated initializer error has been fixed upstream in commit hathach/tinyusb@688a3a0 which only happens on some compilers.
Try updating to latest upstream TinyUSB
Just got around to trying again and I've got it compiling now. Thanks for your help ๐
Is this supposed to work on 3rd party 360 wireless adapters? Mine has VID 045E and PID 0291 which I think is the same as the official one but it doesn't seem to be picking up controller inputs or even entering the xinput mount callback.
This is the debug logging I get from unplugging the adapter and plugging it back in:
[0:0:0] USBH DEVICE REMOVED
Address = 1
XINPUT close
HUB close
hcd_device_close 1
[0:] USBH DEVICE ATTACH
hcd_port_reset
hcd_port_connect_status
[0:0:0] USBH DEVICE REMOVED
[0:] USBH DEVICE ATTACH
hcd_port_reset
hcd_port_connect_status
Full Speed
[0:0] Open EP0 with Size = 8
hcd_edpt_open dev_addr 0, ep_addr 0
hw_endpoint_init dev 0 ep 0 out xfer 0
dev 0 ep 0 out setup buffer @ 0x50100180
endpoint control (0x50100100) <- 0xa0000180
Get 8 byte of Device Descriptor
[0:0] Get Descriptor: 80 06 00 01 00 00 08 00
hw_endpoint_init dev 0 ep 0 out xfer 0
dev 0 ep 0 out setup buffer @ 0x50100180
endpoint control (0x50100100) <- 0xa0000180
Transfer complete
Sent setup packet
on EP 00 with 8 bytes
hcd_edpt_xfer dev_addr 0, ep_addr 0x80, len 8
hw_endpoint_init dev 0 ep 0 in xfer 0
dev 0 ep 0 in setup buffer @ 0x50100180
endpoint control (0x50100100) <- 0xa0000180
Prepare BufCtrl: [0] = 0x7408 [1] = 0x0000
Buffer complete
buf_status 0x00000001
Single Buffered: ep_ctrl = A0000180
Sync BufCtrl: [0] = 0xe008 [1] = 0x0000
Completed transfer of 8 bytes on ep 0 in
Transfer complete
on EP 80 with 8 bytes
[0:0] Control data:
0000: 12 01 00 02 FF FF FF 08 ||
hcd_edpt_xfer dev_addr 0, ep_addr 0x0, len 0
hw_endpoint_init dev 0 ep 0 out xfer 0
dev 0 ep 0 out setup buffer @ 0x50100180
endpoint control (0x50100100) <- 0xa0000180
Prepare BufCtrl: [0] = 0xf400 [1] = 0x0000
Buffer complete
buf_status 0x00000001
Single Buffered: ep_ctrl = A0000180
Sync BufCtrl: [0] = 0x6000 [1] = 0x0000
Short packet on buffer 0 with 0 bytes
Completed transfer of 0 bytes on ep 0 out
Transfer complete
on EP 00 with 0 bytes
Set Address = 1
[0:0] Set Address: 00 05 01 00 00 00 00 00
hw_endpoint_init dev 0 ep 0 out xfer 0
dev 0 ep 0 out setup buffer @ 0x50100180
endpoint control (0x50100100) <- 0xa0000180
Transfer complete
Sent setup packet
on EP 00 with 8 bytes
hcd_edpt_xfer dev_addr 0, ep_addr 0x80, len 0
hw_endpoint_init dev 0 ep 0 in xfer 0
dev 0 ep 0 in setup buffer @ 0x50100180
endpoint control (0x50100100) <- 0xa0000180
Prepare BufCtrl: [0] = 0x7400 [1] = 0x0000
Buffer complete
buf_status 0x00000001
Single Buffered: ep_ctrl = A0000180
Sync BufCtrl: [0] = 0xe000 [1] = 0x0000
Short packet on buffer 0 with 0 bytes
Completed transfer of 0 bytes on ep 0 in
Transfer complete
on EP 80 with 0 bytes
hcd_device_close 0
[0:1] Open EP0 with Size = 8
hcd_edpt_open dev_addr 1, ep_addr 0
hw_endpoint_init dev 1 ep 0 out xfer 0
dev 1 ep 0 out setup buffer @ 0x50100180
endpoint control (0x50100100) <- 0xa0000180
Get Device Descriptor
[0:1] Get Descriptor: 80 06 00 01 00 00 12 00
hw_endpoint_init dev 1 ep 0 out xfer 0
dev 1 ep 0 out setup buffer @ 0x50100180
endpoint control (0x50100100) <- 0xa0000180
Transfer complete
Sent setup packet
on EP 00 with 8 bytes
hcd_edpt_xfer dev_addr 1, ep_addr 0x80, len 18
hw_endpoint_init dev 1 ep 0 in xfer 0
dev 1 ep 0 in setup buffer @ 0x50100180
endpoint control (0x50100100) <- 0xa0000180
Prepare BufCtrl: [0] = 0x3408 [1] = 0x0408
Buffer complete
buf_status 0x00000001
Double Buffered: ep_ctrl = D0000180
Sync BufCtrl: [0] = 0xa008 [1] = 0x8008
Prepare BufCtrl: [0] = 0x7402 [1] = 0x0000
Buffer complete
buf_status 0x00000001
Single Buffered: ep_ctrl = A0000180
Sync BufCtrl: [0] = 0xe002 [1] = 0x0000
Short packet on buffer 0 with 2 bytes
Completed transfer of 18 bytes on ep 0 in
Transfer complete
on EP 80 with 18 bytes
[0:1] Control data:
0000: 12 01 00 02 FF FF FF 08 5E 04 91 02 07 01 00 00 ||
0010: 00 01 ||
hcd_edpt_xfer dev_addr 1, ep_addr 0x0, len 0
hw_endpoint_init dev 1 ep 0 out xfer 0
dev 1 ep 0 out setup buffer @ 0x50100180
endpoint control (0x50100100) <- 0xa0000180
Prepare BufCtrl: [0] = 0xf400 [1] = 0x0000
Buffer complete
buf_status 0x00000001
Single Buffered: ep_ctrl = A0000180
Sync BufCtrl: [0] = 0x6000 [1] = 0x0000
Short packet on buffer 0 with 0 bytes
Completed transfer of 0 bytes on ep 0 out
Transfer complete
on EP 00 with 0 bytes
Get Configuration[0] Descriptor (9 bytes)
[0:1] Get Descriptor: 80 06 00 02 00 00 09 00
hw_endpoint_init dev 1 ep 0 out xfer 0
dev 1 ep 0 out setup buffer @ 0x50100180
endpoint control (0x50100100) <- 0xa0000180
Transfer complete
Sent setup packet
on EP 00 with 8 bytes
hcd_edpt_xfer dev_addr 1, ep_addr 0x80, len 9
hw_endpoint_init dev 1 ep 0 in xfer 0
dev 1 ep 0 in setup buffer @ 0x50100180
endpoint control (0x50100100) <- 0xa0000180
Prepare BufCtrl: [0] = 0x3408 [1] = 0x4401
Buffer complete
buf_status 0x00000001
Double Buffered: ep_ctrl = D0000180
Sync BufCtrl: [0] = 0xa008 [1] = 0xc001
Short packet on buffer 1 with 1 bytes
Completed transfer of 9 bytes on ep 0 in
Transfer complete
on EP 80 with 9 bytes
[0:1] Control data:
0000: 09 02 41 01 08 01 00 A0 82 ||
hcd_edpt_xfer dev_addr 1, ep_addr 0x0, len 0
hw_endpoint_init dev 1 ep 0 out xfer 0
dev 1 ep 0 out setup buffer @ 0x50100180
endpoint control (0x50100100) <- 0xa0000180
Prepare BufCtrl: [0] = 0xf400 [1] = 0x0000
Buffer complete
buf_status 0x00000001
Single Buffered: ep_ctrl = A0000180
Sync BufCtrl: [0] = 0x6000 [1] = 0x0000
Short packet on buffer 0 with 0 bytes
Completed transfer of 0 bytes on ep 0 out
Transfer complete
on EP 00 with 0 bytes
process_enumeration 1343: ASSERT FAILED
Not sure how to find out exactly what that assertion is that's failing, and I don't think I'm seeing any logging from the actual XInput host driver here. Though I do notice that when unplugging it logs XINPUT close
, so it seems like it is using the correct driver?
Did you increase CFG_TUH_ENUMERATION_BUFSIZE
? stock is 256, try 512.
I did not. And now I see that that was in the README... To be fair it wasn't there when I first read it. It seems to be working perfectly now! Thanks so much again ๐