Thank you for the pointer. It seems that if the device is unplugged and replugged, it gets a new port name in dmesg (eg ttyACM1) but in reality
open cpn is using the original port (eg ttyACM0). By assigning the port according to what dmesg has been telling me, I was actually assigning it to the wrong tty. Does that make sense? Unfortunately I cant test the AIS right now as the seas here are empty. Below is an extract from terminal (the ACM device is the marinegadgets AIS reader);
#end of dmesg response
[96132.652077] usb 2-2: new full speed USB device using uhci_hcd and address 8
[96132.846794] cdc_acm 2-2:1.0: This device cannot do calls on its own. It is not a
modem.
[96132.846853] cdc_acm 2-2:1.0: ttyACM1: USB ACM device
[96333.040100] usb 2-2: USB disconnect, address 8
[96420.329062] usb 2-2: new full speed USB device using uhci_hcd and address 9
[96420.524154] cdc_acm 2-2:1.0: This device cannot do calls on its own. It is not a
modem.
[96420.524213] cdc_acm 2-2:1.0: ttyACM1: USB ACM device
netbook@netbook ~ $ sudo lsof /dev/ttyACM1
lsof: WARNING: can't stat() fuse.gvfs-fuse-daemon file system /home/netbook/.gvfs
Output information may be incomplete.
netbook@netbook ~ $ sudo lsof /dev/ttyACM0
lsof: WARNING: can't stat() fuse.gvfs-fuse-daemon file system /home/netbook/.gvfs
Output information may be incomplete.
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
opencpn 10195 netbook 8w CHR 166,0 0t0 37567 /dev/ttyACM0
Is my interpretation correct? and if so whats the best way to deal with it?
Thanks so much for the help.