New USB Host library for Teensy 4.x

I had an issue when I tried to use my Novation launch key with the library after changing and getting the Numa and audio to work.

Since I’m driving Claude I eventually got a simple project and compared the connection on both this and the standard library. Standard worked each time but never in teensy4_usbhost.

Now this might be complete and utter bull but please see the response. I pulled out all other tests and the changes were the only fix. I have trust issues with Claude but this is out my depth.

Within device.cpp

Code:
  const bool initial_activation = (di->active < 0);
  di->active = altsetting;
  if (altsetting < 0)
    return;
 
 // alt 0 is already selected by SET_CONFIGURATION; some devices
 // (e.g. Novation Launchkey MK2) stop responding if it is sent again
  if (!(initial_activation && altsetting == 0)) {
    // set the new interface
    control.Transfer(USB_REQTYPE_INTERFACE_SET, USB_REQ_SET_INTERFACE, altsetting, interface, 0, NULL, this);
  }

I did try to double check other routes but this was the path consistently returned.

Any other ideas I’m happy to go with?

Thanks
 
The problem is there are some devices that don't default to altsetting 0 (e.g. they don't enable the interface at all without a SET_INTERFACE request). But I guess they are in the minority and it would be better to handle that case in the driver rather than force it on everything else.
 
No, I mean I'll probably change the core to remove the initial SET_INTERFACE requests and any device that needs them will have to perform them in its own driver.
 
Testing a 1000TX usb CDC-ECM (ethernet) adapter:
$ iperf -c 192.168.0.117 -i 1
------------------------------------------------------------
Client connecting to 192.168.0.117, TCP port 5001
TCP window size: 512 KByte (default)
------------------------------------------------------------
[ 1] local 192.168.0.30 port 56063 connected with 192.168.0.117 port 5001
[ ID] Interval Transfer Bandwidth
[ 1] 0.0000-1.0000 sec 17.6 MBytes 148 Mbits/sec
[ 1] 1.0000-2.0000 sec 17.6 MBytes 148 Mbits/sec
[ 1] 2.0000-3.0000 sec 17.9 MBytes 150 Mbits/sec
[ 1] 3.0000-4.0000 sec 17.9 MBytes 150 Mbits/sec
[ 1] 4.0000-5.0000 sec 17.9 MBytes 150 Mbits/sec
[ 1] 5.0000-6.0000 sec 17.9 MBytes 150 Mbits/sec
[ 1] 6.0000-7.0000 sec 17.9 MBytes 150 Mbits/sec
[ 1] 7.0000-8.0000 sec 17.8 MBytes 149 Mbits/sec
[ 1] 8.0000-9.0000 sec 17.2 MBytes 145 Mbits/sec
[ 1] 9.0000-10.0000 sec 17.2 MBytes 145 Mbits/sec
[ 1] 0.0000-10.0152 sec 177 MBytes 148 Mbits/sec
This thing is a PITA though... it requires a powered hub, sometimes gets stuck in a loop where it keeps constantly bringing the link up and down, and only seems to implement the bare minimum of CDC-ECM functionality (no multicast filtering, no statistic collection). However if it's used under windows with the proprietary driver there's a bunch of extra options like configuring the link mode, tcp/udp checksum offload, etc. So there must be a bunch of vendor-specific commands...
 
Back
Top