}
void die_vprintf_hook(const char *fmt, va_list al) {
- if (events) { events=0; ovprintf(UPO, fmt, al); }
+ static int recursing;
+ if (!recursing++)
+ ovprintf(UPO, fmt, al);
+ recursing--;
}
void die_hook(void) {
if (sta_state == Sta_Manual)
return;
- if (objnum != pong_seq)
- die("PIC sent wrong ping response (0x%x, wanted 0x%x)", objnum, pong_seq);
+ if (objnum != pong_seq) {
+ if (objnum == (pong_seq^PING_PONG_PATTERN))
+ die("PIC connection is looped back (ping %#05x bounced)", objnum);
+ die("PIC sent wrong ping response (%#05x, wanted %#05x)", objnum, pong_seq);
+ }
ping_toev.duration= 1000;
ping_toev.callback= timefor_ping;