New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opened port immediately disconnects with an ENXIO error on OS X #886

codybonney opened this Issue Jul 27, 2016 · 4 comments


2 participants

codybonney commented Jul 27, 2016

SerialPort version: 4.0.1
NodeJS Version: 4.4.7
Operating System and Hardware: OS X El Capitan 10.11.2 MacBook Pro
Python Version: 2.7.10
Are you using Electron/Atom/NwJS?: No
Device: Mini Maestro 12-Channel USB Servo Controller

Summary of Problem

When a port is opened, it disconnects almost immediately with an ENXIO error.

Expected Behavior

A port can be opened and stay open, without it immediately disconnecting with an error.

Actual Behavior

I'm able to detect and open a port. However, it disconnects very shortly after it's opened (~100-400ms) with the following error:

{ [Error: ENXIO: no such device or address, read] errno: -6, code: 'ENXIO', syscall: 'read' }


  • I'm able to write to the port in that very short window before it disconnects and closes. The device does respond.
  • Running the script quickly in succession results in it not being able to detect the port in the first place. It detects it again after waiting for 1-2sec
  • After running the script quickly in succession, ls -la /dev/cu.usbmodem00043071 returns No such file or directory but reappears after 1-2sec
  • I had no problems communicating with the device on an older version of OS X, node, and node-serialport (<v1.0.0).
  • The user account on OS X has admin privileges

Steps and Code to Reproduce the Issue

  1. Plug in Mini Maestro Device
  2. Copy/Paste path to serial port into script
  3. Run script node SerialPortTest.js (see below)


// Requires
var SerialPort  = require("serialport");

var portOpenMS = 0,
    portOpenTimer = null,
    startPortOpenInterval = function() {
        portOpenTimer = setInterval(function() {
            portOpenMS += 1;
        }, 1)
    stopPortOpenInterval = function() {
    resetPortOpenInterval = function() {
        portOpenMS = 0;

serialPort = new SerialPort('/dev/cu.usbmodem00043071', {
    autoOpen : false

 * Setup event handlers
serialPort.on('open', function() {
    console.log("Port was opened");

serialPort.on('data', function(data) {
    console.log("Port received data - " + data)

serialPort.on('disconnect', function(err) {
    console.log("Port was disconnected - ");

serialPort.on('error', function(err) {
    console.log("Port threw error - ");

serialPort.on('close', function() {
    console.log("Port was closed - port was open for " + portOpenMS + "ms");

// Manually open the port (err) {

    // short circuit if error
    if (err) {
        return console.log('Error opening port: ', err.message);

    if (serialPort.isOpen()) {
        console.log("Port is open");
    else {
        console.log("Port should be open, but is not");


Port was opened
Port is open
Port was disconnected - 
{ [Error: ENXIO: no such device or address, read] errno: -6, code: 'ENXIO', syscall: 'read' }
Port was closed - port was open for 236ms

This comment has been minimized.


reconbot commented Jul 27, 2016

I'm willing to bet your browning out the USB to serial chip and it restarts. Are you using external power?


This comment has been minimized.


reconbot commented Jul 27, 2016

In fact I know that at some point OSX limited current draw on the USB ports (except for iPhones) so that might be the reason it used to work.

@reconbot reconbot added the support label Jul 28, 2016


This comment has been minimized.

codybonney commented Aug 6, 2016

Thank you for the reply! I didn't know about OS X limiting current draw!

I ended up trying several different configurations for powering the controller and servos, including an externally powered USB hub. Unfortunately, I kept running into the same issue.

After some more research, I found out that Polulu released a firmware update for the device very recently.

The solution was to spin up a Windows VM in VirtualBox, install Pololu's software, and upgrade the device to the new firmware version. After that, everything worked perfectly with the latest version of node-serialport on OS X!

I wrote up a little guide on how to upgrade the pololu firmware using OS X and VirtualBox in case anyone else gets stuck in the same situation. A few parts were a little tricky.

Thanks again so much for your help and for maintaining this project!

@codybonney codybonney closed this Aug 6, 2016


This comment has been minimized.


reconbot commented Aug 6, 2016


On Sat, Aug 6, 2016, 1:29 AM Cody Bonney wrote:

Closed #886

You are receiving this because you commented.

Reply to this email directly, view it on GitHub
#886 (comment),
or mute the thread

@lock lock bot locked as resolved and limited conversation to collaborators May 6, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.