Commit 5ad6fd57 authored by Alessandro Rubini's avatar Alessandro Rubini

diag: use pp_error in a few places; fix %09i

Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 543959a7
......@@ -55,12 +55,12 @@ static int posix_recv_msg(int fd, void *pkt, int len, TimeInternal *t)
return ret;
}
if (msg.msg_flags & MSG_TRUNC) {
PP_PRINTF("Error: received truncated message\n");
pp_error("%s: truncated message\n", __func__);
return 0;
}
/* get time stamp of packet */
if (msg.msg_flags & MSG_CTRUNC) {
PP_PRINTF("Error: received truncated ancillary data\n");
pp_error("%s: truncated ancillary data\n", __func__);
return 0;
}
......@@ -75,8 +75,9 @@ static int posix_recv_msg(int fd, void *pkt, int len, TimeInternal *t)
if (tv) {
t->seconds = tv->tv_sec;
t->nanoseconds = tv->tv_usec * 1000;
PP_VPRINTF("kernel recv time stamp %us %dns\n",
t->seconds, t->nanoseconds);
if (pp_verbose_time)
pp_printf("%s: %9li.%06li\n", __func__, tv->tv_sec,
tv->tv_usec);
} else {
/*
* get the recording time here, even though it may put a big
......
......@@ -19,7 +19,7 @@ int pp_state_machine(struct pp_instance *ppi, uint8_t *packet, int plen)
int state, err;
if (plen > 0)
PP_VPRINTF("RECV %02d %d.%d %s\n", plen,
PP_VPRINTF("RECV %02d %d.%09d %s\n", plen,
(int)ppi->last_rcv_time.seconds,
(int)ppi->last_rcv_time.nanoseconds,
pp_msg_names[packet[0] & 0x0f]);
......
......@@ -259,7 +259,7 @@ int wr_servo_update(struct pp_instance *ppi)
if(!s->t1.correct || !s->t2.correct ||
!s->t3.correct || !s->t4.correct) {
PP_VPRINTF( "servo: TimestampsIncorrect: %d %d %d %d\n",
pp_error("%s: TimestampsIncorrect: %d %d %d %d\n", __func__,
s->t1.correct, s->t2.correct,
s->t3.correct, s->t4.correct);
return 0;
......@@ -269,7 +269,7 @@ int wr_servo_update(struct pp_instance *ppi)
got_sync = 0;
if (0) { /* enable for debugging */
if (pp_verbose_servo) {
dump_timestamp("servo:t1", s->t1);
dump_timestamp("servo:t2", s->t2);
dump_timestamp("servo:t3", s->t3);
......
......@@ -256,17 +256,20 @@ int st_com_slave_handle_followup(struct pp_instance *ppi, unsigned char *buf,
return -1;
if (!ppi->is_from_cur_par) {
PP_VPRINTF("SequenceID doesn't match last Sync message\n");
pp_error("%s: SequenceID doesn't match last Sync message\n",
__func__);
return 0;
}
if (!ppi->waiting_for_follow) {
PP_VPRINTF("Slave was not waiting a follow up message\n");
pp_error("%s: Slave was not waiting a follow up message\n",
__func__);
return 0;
}
if (ppi->recv_sync_sequence_id != hdr->sequenceId) {
PP_VPRINTF("Follow up message is not from current parent\n");
pp_error("%s: Follow up message is not from current parent\n",
__func__);
return 0;
}
......
......@@ -48,7 +48,7 @@ int st_com_handle_pdelay_req(struct pp_instance *ppi, unsigned char *buf,
return -1; \
} \
if (pp_verbose_frames) \
PP_VPRINTF("SENT %02d %d.%d %s\n", w, \
PP_VPRINTF("SENT %02d %d.%09d %s\n", w, \
ppi->last_snt_time.seconds, \
ppi->last_snt_time.nanoseconds, \
pp_msg_names[PPM_##x]); \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment