<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Aug 13, 2008, at 10:14 AM, Jon Bougher wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; ">send_cmd(msg_len=2, type='B')<br>send_cmd: sending  3a 42 bd 0d 00 00 00 00 '.B......'<br>send_cmd: received 53 31 34 30 31 00 30 0d 'S1401.0.' (bad)<br>send_cmd: send_try = 3, recv_try = 10<br><br>Error reading B value: Device detached? (error 0: No error)</span></blockquote></div><div><br></div><div>What if you increase MAX_SEND_TRIES? Under normal operation, this should not slow things down, but increasing it to 5, 10 or 20 might help if the UPS is busy and can't respond immediately.</div><div><br></div><div>I think remember where the "error 0" part came from. The USB-to-serial converter always returns 8 bytes if it can, but those bytes may be stale (see above - we sent the 'B' command, but got the leftover 'S' status result).</div><div><br></div><div>Arjen had some suggestions about how to rework the reconnection scheme, and based on the error above, it's not going to be simple.</div><br><div> <span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div>-- </div><div>Charles Lepple</div><div>clepple@gmail</div><div><br class="webkit-block-placeholder"></div></span><br class="Apple-interchange-newline"> </div><br></body></html>