Skip to content

Can't reconnect to device #49

@X-Y

Description

@X-Y

System: Ubuntu 16.04 LTS
Browser: Firefox
plugin version: downloaded from bin/Linux_x86_64/npjUART.so at commit 979c040
Test process: Have an Arduino board constantly sending data to serial port connected to computer. With the following code, the data will be displayed to the console. However, if the device is disconnected and reconnected, calling ser.is_open() will return true, but no message can be received anymore

<html>
    <head>
        <title>test page for object fbcontrol</title>
    </head>
    <script type="text/javascript">
        var ser;
        function plugin0()
        {
            return document.getElementById('plugin0');
        }
        plugin = plugin0;
        
        function recv(bytes, size)
        {
            console.log(bytes);
        }
        
        function pluginLoaded() 
        {
            ser = plugin().Serial;// Get a Serial object
			ser.open("/dev/ttyACM0");// Open a port
			ser.set_option(115200,0,8,0,0);// Set port options 
			ser.recv_callback(recv); // Callback function for recieve data
        }

        setInterval(function() {
            if(!plugin().Serial.is_open()){
                console.log("reconnecting");
                pluginLoaded();
            }
        }, 1000);
    </script>
    <body onload="load()">
        <object id="plugin0" type="application/x-juart" width="0" height="0" >
            <param name="onload" value="pluginLoaded"  />
        </object><br />
        <h1>jUART Serial Port Echo Test</h1><br/>
        This test will echo the data you sent through serial port.
    </body>
</html>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions