jeelabs / esp-link

esp8266 wifi-serial bridge, outbound TCP, and arduino/AVR/LPC/NXP programmer
Other
2.82k stars 720 forks source link

Implement rfc2217 #444

Open lsr1 opened 5 years ago

lsr1 commented 5 years ago

Hi,

it would beyond awesome if esp-link could understand rfc2217 commands (to set properties of the serial port).

My use-case: I have a Raspi3 with Octoprint, where in Octoprint I would like to send gcode over the network to an esp8266 (D1 mini) running esp-link, which in turn pipes it to the serial port on my 3d-printerboard

I have set up Octoprint to enable redirection of the gcode output to a network serial port.

This then fails in Octoprint with the following error message: Connecting to: rfc2217://10.0.30.103:23Changing monitoring state from "Offline" to "Error: Connection error, see Terminal tab "Unexpected error while connecting to serial port: rfc2217://10.0.30.103:23 SerialException: 'Remote does not accept parameter change (RFC2217): [stopsize:REQUESTED, parity:REQUESTED, baudrate:REQUESTED, datasize:REQUESTED]' @ comm.py:_openSerial:2617 (hook default)

Trace from Octoprint log for illustration:

2019-05-18 23:17:40,873 - octoprint.util.comm - ERROR - Unexpected error while connecting to serial port: rfc2217://10.0.30.103:23 SerialException: 'Remote does not accept parameter change (RFC2217): [stopsize:REQUESTED, parity:REQUESTED, baudrate:REQUESTED, datasize:REQUESTED]' @ comm.py:_openSerial:2617 (hook default)
Traceback (most recent call last):
  File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/util/comm.py", line 2617, in _openSerial
    serial_obj = factory(self, self._port, self._baudrate, settings().getFloat(["serial", "timeout", "connection"]))
  File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/util/comm.py", line 2604, in default
    serial_obj = serial.serial_for_url(str(port))   #lsr
  File "/home/pi/oprint/local/lib/python2.7/site-packages/serial/__init__.py", line 88, in serial_for_url
    instance.open()
  File "/home/pi/oprint/local/lib/python2.7/site-packages/serial/rfc2217.py", line 485, in open
    self._reconfigure_port()
  File "/home/pi/oprint/local/lib/python2.7/site-packages/serial/rfc2217.py", line 528, in _reconfigure_port
    raise SerialException("Remote does not accept parameter change (RFC2217): {!r}".format(items))
SerialException: Remote does not accept parameter change (RFC2217): [stopsize:REQUESTED, parity:REQUESTED, baudrate:REQUESTED, datasize:REQUESTED]
2019-05-18 23:17:41,114 - octoprint.plugins.tracking - INFO - Sent tracking event commerror_connection, payload: {'throttled_now': False, 'throttled_past': True, 'commerror_text': 'Connection error, see Terminal tab', 'throttled_mask': 851976}

I have attached a tcpdump (to be opened with wireshark) that shows the traffic between the hosts. output.file.zip

Last edit: Just realized I haven't even thanked you for writing this awesome piece of software. Also the lack of a 'please is purely b/c of the technical focus, not for lack of appreciation :-)