Querela / termux-usb-python

USB access with Python on Termux (Android)
MIT License
62 stars 13 forks source link

Feature request: RFC 2217 Server #2

Closed chrstnwhlrt closed 2 years ago

chrstnwhlrt commented 4 years ago

Nice work done here! I was wondering if it would be possible to use this device implementation in pyserial to start the rfc2217 server example:

https://github.com/pyserial/pyserial/blob/master/examples/rfc2217_server.py

Why? To forward this "telnet" support using ssh remotely to a server which connects using e.g. the esptool to flash esp32 controller connected to the android device.

Querela commented 4 years ago

Hi, thanks. I'm writing so you know that I have read your request but I'm currently short on time, so will not be able to work on this for now.

I think/know that the dtr/rts control lines are not working as intended ... I have - to test it - written a shallow wrapper to interface with pyserial, according to this: https://github.com/pyserial/pyserial/blob/master/serial/__init__.py (essential your own protocol, e.g. "usb_fd://" to wrap the pyusb device into a pyserial class) Mixed results.

As esptools is written in Python, I tried to use the above method to simply read the device version etc. but nothing worked. So I assume the control lines fail or some timings did not work correctly.

I also may have tried the original pyusb library on a Windows (wsl?) or Linux VM with the wrapper code and pyserial, and patched esptool to use it, but this also failed. Not sure why - maybe the pyusb backend drivers do not support the data throughput - or something with the control lines.... (too many unknowns)

I will work on this later but I'm currently rather busy. I can try to find my wrapper code, if I still have it somewhere, but it did not yet work...

Essentially, I still have much more to do. :-) Especially signal debugging (just without any tools - I will have to jury-rig something).