serialport on Yun can't detect ATH0 port [SOLVED]

Hello, I'm about to pull my hair from my head =( I've been trying to get node and node-serialport installed on my yun for about two weeks now and I can't figure out why serialport simply can't see the ATH0 port for Serial1.

After successfully installing node and node-serialport, I open the node console, try to list the ports and it's always empty:

var serialPort = require("serialport"); serialPort.list(function (err, ports) { console.log(ports); });

Any help would be greatly appreciated.


Try with

var serialPort = require("serialport"); serialPort.list(console.log);

This way it will log the error as well

Hi Federico, thank you for your suggestion. Unfortunately it didn't work. It basically did the same thing, I'm posting the response here, I was hoping to see an error msg that would shed some light on the problem:

var serialPort = require("serialport"); serialPort.list(console.log);
null []

Do you have any other ideas that I may try to figure out what's the issue?

Thanks again

Hey guys, just wondering if anyone had any other ideas that I may try to see if I can get this yun to work, any help is greatly appreciated :slight_smile:

Maybe serialport is not able to identify ATH0 as a serial device. Can you try just opening and using it?

Hi Federico, thanks for your response. I actually think I found the problem, just don't know how to work around it.

It seems like the yun and it's ttyATH0 port are fine. The issue is the node-serialport library. It seems like its list() method, which is used heavily all over the place wants to lookup for serial ports at /dev/serial/by-id but there's an issue. The openwrt distribution of the yun does not have those directories, there's simply no /dev/serial directory, which is why it's returning an empty array [].

No the thing is that I don't know if this is an issue with the distribution or simply something that needs to be changed with node-serialport. I was hoping you could suggest something to try.

Your help is greatly appreciated : )

I suppose those folders are created by "udev", but the yun does not ship udev by default (usual disk space and memory constraints)

I think you can

  1. don't worry about it, just open the port
  2. install udev and see if it suffices

Thanks Federico. I like you idea #1 but how do you just open the port with serialport in node?

I was also wondering, if I install udev, is there something you need to do to get it to create the /dev/serial/by-id directory structure? I actually expanded my yun's rootfs with an sdcard and I think it can easily install it.

I've never done that on the yun: I guess it will create a service that will start at boot. You may need to reboot after installing.
As for #1, doesn't this work?

new SerialPort.SerialPort(port, {
baudrate: baudrate

(taken from )

I see what you mean, the issue with that is that I'm not directly using serialport, I'm using firmata and johnny-five, which rely on that list method to find the port but you peaked my interest, I think there's a way to explicitly give johnny-five a serialport object already initiated. I'll try that and let you know how it goes.

Thanks for the suggestions, they're greatly appreciated.

Hola Federico, guess what, it worked! Passing the serialport object already instantiated worked! :smiley:

Here's the code in case you are curious:

board = new five.Board({ 
		port: new SerialPort("/dev/ttyATH0", { 
			baudrate: 57600, 
			buffersize: 1 
	  debug: true

Thank you again for your ideas, you definitively helped on this one! Take care.

Yeah! 8)
Can you edit the topic subject with "[solved]" ?