×

INDI Library v2.0.7 is Released (01 Apr 2024)

Bi-monthly release with minor bug fixes and improvements

Request: Automatic mount diconnect/connect on USB error

  • Posts: 62
  • Thank you received: 1
Hi,

Thanks for all the great work!

It would be major robustness improvement if the USB connection with the mount would automatically try to reconnect istead of continously log this error:

"[ERROR] Write Command Error: Write Error: Input/output error "

I own an iOptron CEM40 that almost every night loses the USB connection.
For some reason it usually happens after a "big" slew, e.g. a meridian flip or when parking the mount.
I've for 3 years asked iOptron support for help but they continously push it back to me, asking me to replace cables, hubs, power supplies etc with no luck.

The mount is not dead when this happens, because I can move it with the hand controller, so it seems USB interface related.
I can also manually diconnect/connect from the INDI Control Panel and then it works again.

What normally happens is that when I wake up in the morning there are no photos after a meridian flip.
Instead of received a lot of images, the UI is really sluggy, probably due to filling up the memory with thousands of log statements?

So an automatic diconnect/connect would really, really help! :-)

Cheers,
// Åke
1 month 3 weeks ago #99616

Please Log in or Create an account to join the conversation.

  • Posts: 9
  • Thank you received: 3
hello Åke
I've had the same issue since i bought my mount, a Ioptron GEM28. Since it helps to just disconnect and connect again, I made a script which looks for error messages in the logs, disconnects the mount, connects again and then continues to look for errors.

However, since I finished the script about 2 months ago I have not had one of these errors so this remains untested. I paste the script at the bottom of this message. change your user name and name of mount (by writing indi_getprop in terminal). Then save the script somewhere, for example ioptron_disconnect.sh, and let it run in terminal when you image. I am using Ubuntu. Beware it is not actually tested at this point, but maybe this can be of help to you.

Another thing I did was to buy a usb-cable marketed for music instruments since I figured that musicians dont like equipment disconnecting either. It is possible that this is what finally helped for me, but I am not sure. I feel like really cold temperatures (-15C) play a part in these issues.

Cheers
Hnastro

//

link to cable:

www.gear4music.no/no/G4M/UDG-Cable-USB-2...utm_content=ord-line

the script:

tail -F -n 1 /home/USER/.local/share/kstars/logs/*/* |
grep --line-buffered 'Input/output error' |
while read ; do echo 'connection error, disconnecting in 5';
sleep 5; indi_setprop 'iOptron GEM28.CONNECTION.DISCONNECT=On' ;
echo 'disconnected, reconnecting again in 5' ;
sleep 5; indi_setprop 'iOptron GEM28.CONNECTION.CONNECT=On' ;
echo 'connected again, monitoring for more errors'; done
The following user(s) said Thank You: Åke Liljenberg
1 month 3 weeks ago #99649

Please Log in or Create an account to join the conversation.

  • Posts: 62
  • Thank you received: 1
Thanks a lot Hnastro for sharing this script, I will definitely try it out.
One question; If there in an error statement in the log, will it not continue to call "indi_setprop" for infinity since the text is still in the log after the disconnect(reconnect?

Cheers,
// Åke
1 month 3 weeks ago #99650

Please Log in or Create an account to join the conversation.

  • Posts: 9
  • Thank you received: 3
yes, that can happen, and then you must ctrl-c-it. Its not very elegant. The script checks the last line (i think) of every log file in your kstars log dir. So if you get a loop maybe easiest to remove all old log files. I think its unlikely that log files end with this error though. There is probably a way to get tail to only check the newest log file. Also I noticed the error could be slightly different so I just made it look for those words. Of course if some other indi device starts sending the an error with "input/outpu error" that might be a problem too.
1 month 3 weeks ago #99656

Please Log in or Create an account to join the conversation.

  • Posts: 62
  • Thank you received: 1
Thanks for your response.
I tried this:
#!/bin/bash
HOME_DIR=/home/stellarmate
MOUNT_NAME="iOptron CEM40"
LOG_DIR=$HOME_DIR/.local/share/kstars/logs
 
tail -F -n 1 $LOG_DIR/*/* |
grep --line-buffered 'Input/output error' |
while read ; do echo 'connection error, disconnecting in 5';
sleep 5; indi_setprop "$MOUNT_NAME.CONNECTION.DISCONNECT=On" ;
echo 'disconnected, reconnecting again in 5' ;
###rm -Rf $LOG_DIR/*
sleep 5; indi_setprop "$MOUNT_NAME.CONNECTION.CONNECT=On" ;
echo 'connected again, monitoring for more errors'; done

And it works fine detecting the error and re-connect :-)
But then it seems it still finds the same error in infinity (see log below).
I also tried to delete the log in the script but that doesn't help either.
Is there maybe a way to poll the mount's status with some indi_getprop command instead?
stellarmate@stellarmate:~ $ ./test.sh
connection error, disconnecting in 5
disconnected, reconnecting again in 5
connected again, monitoring for more errors
connection error, disconnecting in 5
disconnected, reconnecting again in 5
connected again, monitoring for more errors
connection error, disconnecting in 5
disconnected, reconnecting again in 5
^C
1 month 3 weeks ago #99658

Please Log in or Create an account to join the conversation.

  • Posts: 62
  • Thank you received: 1
I think I got it to work by checking if the RA coordinates changes.
I did like this:
#!/bin/bash
MOUNT_NAME="iOptron CEM40"
 
while true
do
  result=$(indi_getprop "$MOUNT_NAME.EQUATORIAL_EOD_COORD.RA")
  if [ "$result" = "$previous_result" ]; then
      echo "Lost connection - reconnect..."
      indi_setprop "$MOUNT_NAME.CONNECTION.DISCONNECT=On"
      indi_setprop "$MOUNT_NAME.CONNECTION.CONNECT=On"
  else
      echo "All OK"
  fi
  previous_result=$result
  sleep 2;
done
And the output when I run it:
stellarmate@stellarmate:~ $ ./test.sh
All OK
All OK
All OK
All OK
Lost connection - reconnect...
All OK
All OK
All OK
All OK
^C
Last edit: 1 month 3 weeks ago by Åke Liljenberg.
1 month 3 weeks ago #99661

Please Log in or Create an account to join the conversation.

  • Posts: 9
  • Thank you received: 3
good that you got it working, and clever to check the Ra changing. My intention was to only check the last line of the log for the error. If all is ok that error will be replaced by something else. But this will not work if there are older log files in there with the error as the last line. And it is possible that my code does not in fact only check the last line.
1 month 3 weeks ago #99662

Please Log in or Create an account to join the conversation.

  • Posts: 62
  • Thank you received: 1
Sorry to say I discovered it only works in parked mode.
I need to find some other parameter that changes during tracking.
1 month 3 weeks ago #99663

Please Log in or Create an account to join the conversation.

  • Posts: 62
  • Thank you received: 1
It seems none of these mount parameters changes during tracking, so I'm back on square one... :-(
Wonder if there is any other parameter in the system that changes?
iOptron CEM40.CONNECTION.CONNECT=On
iOptron CEM40.CONNECTION.DISCONNECT=Off
iOptron CEM40.DRIVER_INFO.DRIVER_NAME=iOptronV3
iOptron CEM40.DRIVER_INFO.DRIVER_EXEC=indi_ioptronv3_telescope
iOptron CEM40.DRIVER_INFO.DRIVER_VERSION=1.7
iOptron CEM40.DRIVER_INFO.DRIVER_INTERFACE=5
iOptron CEM40.POLLING_PERIOD.PERIOD_MS=1000
iOptron CEM40.DEBUG.ENABLE=Off
iOptron CEM40.DEBUG.DISABLE=On
iOptron CEM40.SIMULATION.ENABLE=Off
iOptron CEM40.SIMULATION.DISABLE=On
iOptron CEM40.CONFIG_PROCESS.CONFIG_LOAD=Off
iOptron CEM40.CONFIG_PROCESS.CONFIG_SAVE=Off
iOptron CEM40.CONFIG_PROCESS.CONFIG_DEFAULT=Off
iOptron CEM40.CONFIG_PROCESS.CONFIG_PURGE=Off
iOptron CEM40.CONNECTION_MODE.CONNECTION_SERIAL=On
iOptron CEM40.CONNECTION_MODE.CONNECTION_TCP=Off
iOptron CEM40.SYSTEM_PORTS.Pegasus_Astro_PPB_revE_PPB5A5OTE=Off
iOptron CEM40.SYSTEM_PORTS.Pegasus_Astro_FocusCube_2_PA5EJ6BM=Off
iOptron CEM40.SYSTEM_PORTS.FTDI_FT230X_Basic_UART_D309DKAF=Off
iOptron CEM40.DEVICE_PORT.PORT=/dev/mount
iOptron CEM40.DEVICE_BAUD_RATE.9600=Off
iOptron CEM40.DEVICE_BAUD_RATE.19200=Off
iOptron CEM40.DEVICE_BAUD_RATE.38400=Off
iOptron CEM40.DEVICE_BAUD_RATE.57600=Off
iOptron CEM40.DEVICE_BAUD_RATE.115200=On
iOptron CEM40.DEVICE_BAUD_RATE.230400=Off
iOptron CEM40.DEVICE_AUTO_SEARCH.INDI_ENABLED=Off
iOptron CEM40.DEVICE_AUTO_SEARCH.INDI_DISABLED=On
iOptron CEM40.DEVICE_PORT_SCAN.Scan Ports=Off
iOptron CEM40.ACTIVE_DEVICES.ACTIVE_GPS=GPS Simulator
iOptron CEM40.ACTIVE_DEVICES.ACTIVE_DOME=Dome Simulator
iOptron CEM40.DOME_POLICY.DOME_IGNORED=On
iOptron CEM40.DOME_POLICY.DOME_LOCKS=Off
iOptron CEM40.TELESCOPE_INFO.TELESCOPE_APERTURE=0
iOptron CEM40.TELESCOPE_INFO.TELESCOPE_FOCAL_LENGTH=0
iOptron CEM40.TELESCOPE_INFO.GUIDER_APERTURE=0
iOptron CEM40.TELESCOPE_INFO.GUIDER_FOCAL_LENGTH=0
iOptron CEM40.SCOPE_CONFIG_NAME.SCOPE_CONFIG_NAME=
iOptron CEM40.ON_COORD_SET.TRACK=On
iOptron CEM40.ON_COORD_SET.SLEW=Off
iOptron CEM40.ON_COORD_SET.SYNC=Off
iOptron CEM40.EQUATORIAL_EOD_COORD.RA=14.220802777777777237
iOptron CEM40.EQUATORIAL_EOD_COORD.DEC=32.298066666666663593
iOptron CEM40.TELESCOPE_ABORT_MOTION.ABORT=Off
iOptron CEM40.TELESCOPE_TRACK_MODE.TRACK_SIDEREAL=On
iOptron CEM40.TELESCOPE_TRACK_MODE.TRACK_LUNAR=Off
iOptron CEM40.TELESCOPE_TRACK_MODE.TRACK_SOLAR=Off
iOptron CEM40.TELESCOPE_TRACK_MODE.TRACK_KING=Off
iOptron CEM40.TELESCOPE_TRACK_MODE.TRACK_CUSTOM=Off
iOptron CEM40.TELESCOPE_TRACK_STATE.TRACK_ON=On
iOptron CEM40.TELESCOPE_TRACK_STATE.TRACK_OFF=Off
iOptron CEM40.TELESCOPE_TRACK_RATE.TRACK_RATE_RA=15.04106717867020393
iOptron CEM40.TELESCOPE_TRACK_RATE.TRACK_RATE_DE=0
iOptron CEM40.TELESCOPE_MOTION_NS.MOTION_NORTH=Off
iOptron CEM40.TELESCOPE_MOTION_NS.MOTION_SOUTH=Off
iOptron CEM40.TELESCOPE_MOTION_WE.MOTION_WEST=Off
iOptron CEM40.TELESCOPE_MOTION_WE.MOTION_EAST=Off
iOptron CEM40.TELESCOPE_REVERSE_MOTION.REVERSE_NS=Off
iOptron CEM40.TELESCOPE_REVERSE_MOTION.REVERSE_WE=Off
iOptron CEM40.TELESCOPE_SLEW_RATE.1x=Off
iOptron CEM40.TELESCOPE_SLEW_RATE.2x=Off
iOptron CEM40.TELESCOPE_SLEW_RATE.3x=Off
iOptron CEM40.TELESCOPE_SLEW_RATE.4x=Off
iOptron CEM40.TELESCOPE_SLEW_RATE.5x=Off
iOptron CEM40.TELESCOPE_SLEW_RATE.6x=Off
iOptron CEM40.TELESCOPE_SLEW_RATE.7x=Off
iOptron CEM40.TELESCOPE_SLEW_RATE.8x=Off
iOptron CEM40.TELESCOPE_SLEW_RATE.9x=On
iOptron CEM40.TARGET_EOD_COORD.RA=0
iOptron CEM40.TARGET_EOD_COORD.DEC=0
iOptron CEM40.TIME_UTC.UTC=2024-03-10T14:08:05
iOptron CEM40.TIME_UTC.OFFSET=1
iOptron CEM40.GEOGRAPHIC_COORD.LAT=57.70216666666667038
iOptron CEM40.GEOGRAPHIC_COORD.LONG=11.770833333333333925
iOptron CEM40.GEOGRAPHIC_COORD.ELEV=-10
iOptron CEM40.TELESCOPE_PARK.PARK=Off
iOptron CEM40.TELESCOPE_PARK.UNPARK=On
iOptron CEM40.TELESCOPE_PARK_POSITION.PARK_AZ=0
iOptron CEM40.TELESCOPE_PARK_POSITION.PARK_ALT=57.701943999999997459
iOptron CEM40.TELESCOPE_PARK_OPTION.PARK_CURRENT=Off
iOptron CEM40.TELESCOPE_PARK_OPTION.PARK_DEFAULT=Off
iOptron CEM40.TELESCOPE_PARK_OPTION.PARK_WRITE_DATA=Off
iOptron CEM40.TELESCOPE_PARK_OPTION.PARK_PURGE_DATA=Off
iOptron CEM40.TELESCOPE_PIER_SIDE.PIER_WEST=On
iOptron CEM40.TELESCOPE_PIER_SIDE.PIER_EAST=Off
iOptron CEM40.PEC.PEC OFF=On
iOptron CEM40.PEC.PEC ON=Off
iOptron CEM40.APPLY_SCOPE_CONFIG.SCOPE_CONFIG1=On
iOptron CEM40.APPLY_SCOPE_CONFIG.SCOPE_CONFIG2=Off
iOptron CEM40.APPLY_SCOPE_CONFIG.SCOPE_CONFIG3=Off
iOptron CEM40.APPLY_SCOPE_CONFIG.SCOPE_CONFIG4=Off
iOptron CEM40.APPLY_SCOPE_CONFIG.SCOPE_CONFIG5=Off
iOptron CEM40.APPLY_SCOPE_CONFIG.SCOPE_CONFIG6=Off
iOptron CEM40.USEJOYSTICK.ENABLE=Off
iOptron CEM40.USEJOYSTICK.DISABLE=On
iOptron CEM40.SNOOP_JOYSTICK.SNOOP_JOYSTICK_DEVICE=Joystick
iOptron CEM40.HOME.FindHome=Off
iOptron CEM40.HOME.SetCurrentAsHome=Off
iOptron CEM40.HOME.GoToHome=Off
iOptron CEM40.PEC_TRAINING.PEC_Recording=Off
iOptron CEM40.PEC_TRAINING.PEC_Status=Off
iOptron CEM40.PEC_INFOS.PEC_INFO=None
iOptron CEM40.TELESCOPE_TIMED_GUIDE_NS.TIMED_GUIDE_N=0
iOptron CEM40.TELESCOPE_TIMED_GUIDE_NS.TIMED_GUIDE_S=0
iOptron CEM40.TELESCOPE_TIMED_GUIDE_WE.TIMED_GUIDE_W=0
iOptron CEM40.TELESCOPE_TIMED_GUIDE_WE.TIMED_GUIDE_E=0
iOptron CEM40.GUIDE_RATE.RA_GUIDE_RATE=0.5
iOptron CEM40.GUIDE_RATE.DE_GUIDE_RATE=0.5
iOptron CEM40.Firmware Info.Model=CEM40
iOptron CEM40.Firmware Info.Board=210605
iOptron CEM40.Firmware Info.Controller=xxxxxx
iOptron CEM40.Firmware Info.RA=210420
iOptron CEM40.Firmware Info.DEC=210420
iOptron CEM40.GPS_STATUS.Off=On
iOptron CEM40.GPS_STATUS.On=Off
iOptron CEM40.GPS_STATUS.Data OK=Off
iOptron CEM40.TIME_SOURCE.RS232=Off
iOptron CEM40.TIME_SOURCE.Controller=On
iOptron CEM40.TIME_SOURCE.GPS=Off
iOptron CEM40.HEMISPHERE.South=Off
iOptron CEM40.HEMISPHERE.North=On
iOptron CEM40.Slew Type.Counterweight UP=Off
iOptron CEM40.Slew Type.Normal=On
iOptron CEM40.DaylightSaving.ON=Off
iOptron CEM40.DaylightSaving.OFF=On
iOptron CEM40.CWState.Up=Off
iOptron CEM40.CWState.Normal=On
iOptron CEM40.MERIDIAN_ACTION.IOP_MB_STOP=On
iOptron CEM40.MERIDIAN_ACTION.IOP_MB_FLIP=Off
iOptron CEM40.MERIDIAN_LIMIT.VALUE=4
iOptron CEM40.ACTIVE_DEVICES.ACTIVE_GPS=GPS Simulator
iOptron CEM40.ACTIVE_DEVICES.ACTIVE_DOME=Dome Simulator
iOptron CEM40.DOME_POLICY.DOME_IGNORED=On
iOptron CEM40.DOME_POLICY.DOME_LOCKS=Off
iOptron CEM40.TELESCOPE_INFO.TELESCOPE_APERTURE=0
iOptron CEM40.TELESCOPE_INFO.TELESCOPE_FOCAL_LENGTH=0
iOptron CEM40.TELESCOPE_INFO.GUIDER_APERTURE=0
iOptron CEM40.TELESCOPE_INFO.GUIDER_FOCAL_LENGTH=0
iOptron CEM40.SCOPE_CONFIG_NAME.SCOPE_CONFIG_NAME=
iOptron CEM40.USEJOYSTICK.ENABLE=Off
iOptron CEM40.USEJOYSTICK.DISABLE=On
iOptron CEM40.SNOOP_JOYSTICK.SNOOP_JOYSTICK_DEVICE=Joystick
1 month 3 weeks ago #99664

Please Log in or Create an account to join the conversation.

  • Posts: 62
  • Thank you received: 1
Here's the latest attempt that seems to work (so far ;-)):
#!/bin/bash
HOME_DIR=/home/stellarmate
LOG_DIR=$HOME_DIR/.local/share/kstars/logs
MOUNT_NAME="iOptron CEM40"
 
LATEST_LOG_FILE=$(find $LOG_DIR -type f -exec ls -t1 {} + | head -1)
echo "Latest lof file: $LATEST_LOG_FILE"
while true
do
  latest_log_statement=$(tail -n 1 $LATEST_LOG_FILE)  
  if [[ $latest_log_statement = *'Input/output error'* ]]; then
      echo "Lost connection - reconnect..."
      indi_setprop "$MOUNT_NAME.CONNECTION.CONNECT=Off"
      indi_setprop "$MOUNT_NAME.CONNECTION.DISCONNECT=On"
      sleep 2;
      indi_setprop "$MOUNT_NAME.CONNECTION.DISCONNECT=Off"
      indi_setprop "$MOUNT_NAME.CONNECTION.CONNECT=On"
      sleep 2;
      indi_setprop "$MOUNT_NAME.TELESCOPE_PARK.PARK=Off"
      indi_setprop "$MOUNT_NAME.TELESCOPE_PARK.UNPARK=On"
      sleep 2;
      indi_setprop "$MOUNT_NAME.TELESCOPE_TRACK_STATE.TRACK_OFF=Off"
      indi_setprop "$MOUNT_NAME.TELESCOPE_TRACK_STATE.TRACK_ON=On"
  else
      echo "All OK"
  fi
  sleep 2;
done
The following user(s) said Thank You: hinorthastro
Last edit: 1 month 2 weeks ago by Åke Liljenberg.
1 month 2 weeks ago #99666

Please Log in or Create an account to join the conversation.

Time to create page: 0.938 seconds