My photons all have some debugging/diag code that logs hints and info to a connected terminal. I wrote a nodeJs debugging tool that auto-connects to my usb serial port and receives event notifications and can ask for status updates to find out things like ram usage and internal system and variable states.
Telling the Photon that the debugger is present is easy–once the debugger connects it just sends a command. But is there a simple, low-level way for the Photon to tell if the debugger serial connection went away (other than asking it repeatedly or timing out if it doesn’t ping–i’m looking for a socket level status). On the linux or mac end I can easily see if the chip closes the connection, but on the chip, is there a system call to tell me if the connection closed?
But you do not need a further signal to do this? Like the DTR control signal in the RS-232 standard. In my opinion the photon can not handle directly this scenario. Some time ago I solved the problem by using the commands on the serial. (photon - host/pc).
You are correct. This is a bit broken on 0.5.2. There was a major rewrite of USB subsystem for 0.6.0 and the SET_CONTROL_LINE_STATE (DTR/RTS) support is only correctly implemented in there. On 0.5.2, the state only changes when the device attempts to send something over Serial: