It happened once again so I dag into it a bit more deeply. Indi actually works well, I could find no bugs but maybe others are interested so I share my findings and how I resolved the issues.

It is not specific to iOptron but it can affect anyone using a USB to serial device. It may also worth a FAQ item. I never saw this happening on Fedora22 but it happened on OpenSuse Tumbleweed.

The issue lies with ModemManager. Anyone not using a 3/4G connection on their Linux box controlling a telescope with Indi over USB-serial should disable/uninstall ModemManager. ModemManager is monitoring the hotplug of devices which can act as a 3G modem. These seem to include USB-serail devices. One can confirm this by running

sudo journalctl -f

and watching the output upon connecting the USB-serial converter. Normally ModemManager just fails on the device and it will become available for Indi but this does not always happen. What I found is that ModemManager sometimes misconfigures the serial port. It sets flags on it that will actually prevent serial port's normal use. I was unable to find out which flags ruin the port after spending 10+ minutes but one could try. Here's my working setup:

phd@mercury:~> stty -F /dev/ttyUSB0 -a
speed 9600 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff -iuclc -ixany -imaxbel -iutf8
-opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
-isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop -echoprt -echoctl -echoke -flusho -extproc

Quite a few flags. If set wrong it is not a human task to find out what to change to get it working. I was in luck as I happened to have another USB-serial converter on an other machine from where I could copy the settings. stty has a flag to do it easily. This is:

phd@mercury:~> stty -F /dev/ttyUSB0 -g
0:0:8bd:0:3:1c:7f:15:4:0:1:0:11:13:1a:0:12:f:17:16:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0

and there is a way to restore it easily by issuing:
/usr/bin/stty -F /dev/ttyUSB0 0:0:8bd:0:3:1c:7f:15:4:0:1:0:11:13:1a:0:12:f:17:16:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0

So by now we just need a way to automate things. I made two things:
1. Tell ModemManager to ignore my USB-serial device
2. Set the serial port to the settings known to work upon plugin

I used udev to achieve this. First you need to find the vendor:device IDs of your device:

phd@mercury:~> lsusb
Bus 008 Device 002: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

In my case it is the Profilic port with IDs 067b:2303. I created an udev rule file as follows:

phd@mercury:~> cat /etc/udev/rules.d/99-ttyUSB0.rules
ATTRS{idVendor}=="067b" ATTRS{idProduct}=="2303", ENV{ID_MM_DEVICE_IGNORE}="1"
ATTRS{idVendor}=="067b" ATTRS{idProduct}=="2303", RUN+="/usr/local/bin/setttyUSB0"

The first rule tells ModemManager to ignore the device and the second one launches a script that set the required serial parameters.

phd@mercury:~> cat /usr/local/bin/setttyUSB0
#!/bin/bash
/usr/bin/stty -F /dev/ttyUSB0 0:0:8bd:0:3:1c:7f:15:4:0:1:0:11:13:1a:0:12:f:17:16:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0

After setting these up, I never had the problem of connecting the mount from Indi. Hope that this helps others to resolve such issues.

Read More...