Distinguishing multiple Maestros in Linux

Is there a mechanism to predict which Linux device is connected to which maestro server controller.

I have two maestros and it would appear arbitary which one is ttyACM0 and which one is ttyACM2.

The perfect solution would be a command code which could be issued to the maestro which would return its identity.

Is there (besides the manual) a complete list of command codes.

Update: I now recommend using /dev/serial/by-id, which has stable names in it for the all of the Maestro COM ports. See this thread for more info.

Hello.

Using a udev rule, you should be able to assign the virtual serial ports unique names based on the serial number of the Maestro. Please see the discussion in this thread:

Unique Identifier for Simple Motor Controller over ASCII pro

Also, when you get it working, please post your udev rule file here so others can benefit from it.

–David

After much coding, which involved looking down all the /dev/ttyACM? ports and determining how many, if any, channels they could see I finally gave up that approach as there (not found yet) doesn’t appear to be a command I can send the maestro (serially) that will respond with the serial number.

The libusb syntax to return the serial number is :

char BoardSerial[100]
usb_get_string_simple( udev, dev->descriptor.iSerialNumber, BoardSerial, sizeof( BoardSerial ) );

however I was able to achieve the control of the ttyAM? creation with the udev rule :

SUBSYSTEM==“tty”, ATTRS(idVendor)==“1ffb”, ATTRS(idProduct)==“008c”, ATTRS(serial)==“00031189”, MODE=“0666”, SYMLINK+=“maestro12”

which would always create a symbolic link /dev/maestro12 to my 12 channel maestro whose serial number is 00031189

You will need to adapt the idProduct and serial to suit your configuration

This is on both Centos 6.3 and Wheezy Pi

Have fun

As an update and after much testing and retesting I have refined the udev rules :

KERNEL==“ttyACM0”, SUBSYSTEM==“tty”, SUBSYSTEMS==“usb”, ATTRS{idVendor}==“1ffb”, ATTRS{idProduct}==“008a”, ATTRS{serial}==“00031189”, MODE=“0666”, SYMLINK+=“TTYS_001”

KERNEL==“ttyACM2”, SUBSYSTEM==“tty”, SUBSYSTEMS==“usb”, ATTRS{idVendor}==“1ffb”, ATTRS{idProduct}==“008c”, ATTRS{serial}==“00053419”, MODE=“0666”, SYMLINK+=“TTYS_002”

KERNEL==“ttyACM2”, SUBSYSTEM==“tty”, SUBSYSTEMS==“usb”, ATTRS{idVendor}==“1ffb”, ATTRS{idProduct}==“008a”, ATTRS{serial}==“00031189”, MODE=“0666”, SYMLINK+=“TTYS_001”

KERNEL==“ttyACM0”, SUBSYSTEM==“tty”, SUBSYSTEMS==“usb”, ATTRS{idVendor}==“1ffb”, ATTRS{idProduct}==“008c”, ATTRS{serial}==“00053419”, MODE=“0666”, SYMLINK+=“TTYS_002”

This guarantees that the device 008a will always be TTY_001 and device 008c will be TTY_002 wherever I plug them in. Of course you will have to increase the array if more than two devices are seen.

To see the serial number of a USB device, simply unplug the device, then run this command:

sudo udevadm monitor

Then re-plug the device. The monitor command will now print out all the different identifying information for the device as it’s plugged in. You may have to scroll back a bit in the Terminal window to find what you need, but it will be there!

SUBSYSTEM==“usb”, ATTRS{idVendor}==“1ffb”, MODE=“0666”

KERNEL==“ttyACM*”, SUBSYSTEMS==“usb”, ACTION==“add”, ATTRS{idVendor}==“1ffb”, ATTRS{idProduct}==“008[0-f]”, MODE=“0666”, PROGRAM="/bin/bash -c ‘/bin/echo %p | /bin/grep -c :1.0/tty’", RESULT==“1”, SYMLINK+=“polulu_servo_serial_$attr{serial}”, GROUP=“dialout”

KERNEL==“ttyACM*”, SUBSYSTEMS==“usb”, ACTION==“add”, ATTRS{idVendor}==“1ffb”, ATTRS{idProduct}==“008[0-f]”, MODE=“0666”, PROGRAM="/bin/bash -c ‘/bin/echo %p | /bin/grep -c :1.2/tty’", RESULT==“1”, SYMLINK+=“polulu_servo_ttl_$attr{serial}”, GROUP=“dialout”

Try this. It will label the endpoints properly as serial and ttl (in dual-port mode), and use the built-in serial number.