ESP_Sprite wrote:
That doesn't make sense... the ESP32-S2 can be a host alright, but unless you have a very specific USB setup, computers generally cannot be a device. What specifically are you planning to do that you would need this functionality for?
That make a lot of sense. It allows to connect USB device to esp32 S2/S3 and pass all USB traffic between PC and that device using TCP sockets. With USB/IP PC is thinking that device is connected to local port when in real it is connected to esp32 and with good design it may be accesses over WAN, just like virtualhere.
Another use case may be intercept and altering HID packets or making printers work wireless etc, all without writing drivers on esp32, because all drivers are used on PC.
Of course it not very popular protocol, because only linux has some good support, windows not so much and i dont know about macOS.
http://usbip.sourceforge.net/
hibenji wrote:
Hey, thanks for your response, i am not sure if this is possible, but it would be cool.
Yes, it is totally possible. I do have some early code, which is working with CDC, CP210x, HID etc, but there is some limitation thou (or just my code is not very good).
For example CP210X/CDC based devkit cant be flashed, because device is disconnected for very short time. Maybe there should be implemented some mechanism that would reconnect device, but i think its not possible. I didnt do stress test yet, but with simple serial com it works for few hours without problem. Another problem i have so far is that only full speed device works. So, i have vireless keyboard and mouse with USB dongle, and this works, but wired keyboard is not working yet. I have only USB3 pendrive right now, and i cant make it works, because my linux MSC driver is trying to reset device after getting all descriptors and cant assign address to it.
I have to say i had a lot of problems to solve to get it work even if it seems to be easy protocol to implement.
Im not saying i will do it any time soon, but i would like to do a simple device that could intercept USB packets and display on simple website hosted on the same esp32, or maybe even on small server with use of UDP or WS, and make esp32 hardware USB analyzer.
esp32 running simple app, connected to another esp32 S3 running USB/IP
- Screenshot from 2022-03-26 21-35-52.png (113.92 KiB) Viewed 14380 times
PS i just did quick test: esp32 S2, with
Code: Select all
void loop() {
delay(10);
Serial.println("test");
}
And here are results:
Code: Select all
wired connection to PC:
22:12:07.357 -> test
22:12:07.357 -> test
22:12:07.357 -> test
22:12:07.390 -> test
22:12:07.390 -> test
22:12:07.390 -> test
22:12:07.423 -> test
22:12:07.423 -> test
22:12:07.423 -> test
22:12:07.423 -> test
wireless connection with USB/IP:
22:13:24.912 -> test
22:13:24.945 -> test
22:13:24.945 -> test
22:13:24.945 -> test
22:13:24.945 -> test
22:13:24.945 -> test
22:13:24.978 -> test
22:13:24.978 -> test