I am still having problems with the Loupedeck live. It is well possible that the problems are not USBHost_t36 related, but just making sure.
THE BACKGROUND
The current situation is I can make connection with the device. It has kind of WS over serial protocol.
The communication is initialised by sending
Code:
char WS_UPGRADE_HEADER[] = "GET /index.html\r\n"
"HTTP/1.1\r\n"
"Connection: Upgrade\r\n"
"Upgrade: websocket\r\n"
"Sec-WebSocket-Key: 123abc\r\n\r\n";
and it returns
HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Accept: ALtlZo9FMEUEQleXJmq++ukUQ1s=
so the serial communication works. after this it provides the button presses, encoder rotations and multi touch touch screen data, no problem.
The problems start when I try to send any command to it. (turn button LEDs on, request serial number etc.) So far the result has been that after any 4 bytes it drops the WS connection and goes to sleep state. Resending the initialisation restores the above functionality.
The commands I have tested so far are short, less than 20 bytes. I have never got response to any command except the initialisation.
THE QUESTIONS
1. Do the following have any effect to the USB Host serial communication ?
#define USBBAUD 256000
uint32_t baud = USBBAUD;
uint32_t format = USBHOST_SERIAL_8N1;
userial.begin(baud);
2. on the USBHost_t36 there is moments like // This is setting handshake need to figure out what... could this cause problems like this?
3. The device info is as follows, is there any other than serial interface (but would be strange if commands should be send on an other interface)
Code:
* USBDeviceInfo claim this=2000CAC8
****************************************
** Device Level **
vid=2EC2
pid=4
bDeviceClass = 239
bDeviceSubClass = 2
bDeviceProtocol = 1
08 0B 00 02 02 02 00 05 09 04 00 00 01 02 02 01 05 05 24 00 10 01 05 24 01 03 01 04 24 02 06 05
24 06 00 01 07 05 82 03 40 00 07 09 04 01 00 02 0A 00 00 06 07 05 01 02 00 02 01 07 05 81 02 00
02 01
USBDeviceInfo claim this=2000CAC8
****************************************
** Interface Level **
09 04 00 00 01 02 02 01 05 05 24 00 10 01 05 24 01 03 01 04 24 02 06 05 24 06 00 01 07 05 82 03
40 00 07 09 04 01 00 02 0A 00 00 06 07 05 01 02 00 02 01 07 05 81 02 00 02 01
bInterfaceNumber = 0
number end points = 1
bInterfaceClass = 2
bInterfaceSubClass = 2
Communicatons and CDC
bInterfaceProtocol = 1
USBDeviceInfo claim this=2000CAC8
****************************************
** Interface Level **
09 04 01 00 02 0A 00 00 06 07 05 01 02 00 02 01 07 05 81 02 00 02 01
4. only the USBSerial_BigBuffer work at all. (maybe because initialisation message length) other messages so far are short, but display update messages will be big.
//USBSerial userial(myusb); // works only for those Serial devices who transfer <=64 bytes (like T3.x, FTDI...)
USBSerial_BigBuffer userial(myusb, 1); // Handles anything up to 512 bytes
//USBSerial_BigBuffer userial(myusb); // Handles up to 512 but by default only for those > 64 bytes
I use userial.write(DATA, sizeof(DATA)); will test writing a byte at time...
EDIT: writing the init (the GET...above) message works with
for (uint16_t i = 0; i < sizeof(WS_UPGRADE_HEADER); i++) {userial.write(WS_UPGRADE_HEADER
);delay(1);}
USBSerial_BigBuffer, also of course without the delay, tried that just to be sure that too fast write was not why USBSerial fails, it does not work at all?