User Tools

Site Tools


User's Manual & Quick Start Guide


Where to Purchase

Donations & Support

Replacements Parts & Information

Mods & Improvements



Slicer Stuff




Web UI



Donations & Support

Amazon Affiliate Program Disclosure

Looking for the Monoprice MP Mini Delta Wiki?


This is an old revision of the document!

Serial Double Open Plugin

This plugin is still in testing.

Installation Instructions

foosel commented about 18 hours ago

So… here's something to test with.

It's a minimal plugin that changes the serial opening to what @ygator suggested. Note that a) it doesn't work at all on Windows based systems, b) it doesn't play nice with other printers (so I couldn't really test this) and c) I have absolutely no idea at all if this might actually help or not.

To test, on OctoPi, SSH into your machine, then:

cd ~/.octoprint/plugins
sudo service octoprint restart

Please report back. To uninstall/disable it again, it can be found as “Serial Double Open Plugin” in the Plugin Manager.

Minimal OctoPrint plugin that performs a double open on the serial port to potentially work around issues with Malyan printers. Put file into ~/.octoprint/plugins and restart the server. Based on
# coding=utf-8
from __future__ import absolute_import
import serial
import logging
import sys
import octoprint.plugin
from import Events, eventManager
def serial_factory(comm_instance, port, baudrate, read_timeout, *args, **kwargs):
    This is basically the default serial factory, just with a weird open/open/close sequence applied
        OPEN Parity.ODD
        OPEN Parity.NONE
        CLOSE Parity.ODD
        USE Parity.NONE
    if sys.platform == "win32":
        # Windows doesn't allow double open, log and bail
        logging.getLogger("octoprint.plugins.serial_double_open").error("Cannot run serial double open under windows")
        return None
    if port is None or port == 'AUTO':
        # no known port, try auto detection
        port = comm_instance._detect_port()
        if port is None:
            comm_instance._errorValue = 'Failed to autodetect serial port, please set it manually.'
            eventManager().fire(Events.ERROR, {"error": comm_instance.getErrorString()})
            comm_instance._log("Failed to autodetect serial port, please set it manually.")
            return None
    # connect to regular serial port
    comm_instance._log("Connecting to: %s" % port)
    if baudrate == 0:
        from octoprint.util.comm import baudrateList
        baudrates = baudrateList()
        baudrate = 115200 if 115200 in baudrates else baudrates[0]
    serial_obj1 = serial.Serial(str(port), baudrate, timeout=read_timeout, writeTimeout=10000,
    serial_obj2 = serial.Serial(str(port), baudrate, timeout=read_timeout, writeTimeout=10000,
    serial_obj1.close() # close the first instance, we don't actually need that
    return serial_obj2 # return the second instance
__plugin_name__ = "Serial Double Open Plugin"
__plugin_description__ = "Performs a double open on the serial port to potentially work around issues with Malyan printers"
__plugin_author__ = "Gina Häußge"
__plugin_homepage__ = ""
__plugin_hooks__ = {
    "octoprint.comm.transport.serial.factory": serial_factory
octoprint/serial_double_open_plugin.1516707200.txt.gz · Last modified: 2018/01/23 11:33 by Matthew Upp