Commit 9106c798 authored by Jean-Claude BAU's avatar Jean-Claude BAU

Fix FLAGS field displayed in diagnostics

The 2 octets were displayed as as int16 so they can be swapped depending
of the architecture.
parent 7e5ea9a1
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
* Released according to the GNU GPL, version 2 or any later version. * Released according to the GNU GPL, version 2 or any later version.
*/ */
#include <ppsi/constants.h>
/* /*
* I used to have bit fields, but endianness detection failed. Let's be * I used to have bit fields, but endianness detection failed. Let's be
* honest: bit fields must die. I use masks at run time instead * honest: bit fields must die. I use masks at run time instead
...@@ -21,7 +23,7 @@ struct ptp_header { ...@@ -21,7 +23,7 @@ struct ptp_header {
/* 4 */ /* 4 */
uint8_t domainNumber; uint8_t domainNumber;
uint8_t reserved5; uint8_t reserved5;
uint16_t flagField; uint8_t flagField[PP_FLAG_FIELD_LENGTH];
/* 8 */ /* 8 */
uint64_t correctionField; uint64_t correctionField;
/* 16 */ /* 16 */
......
...@@ -330,8 +330,8 @@ static void dump_payload(char *prefix, void *pl, int len) ...@@ -330,8 +330,8 @@ static void dump_payload(char *prefix, void *pl, int len)
printf("%sVERSION: %i (type %i, len %i, domain %i)\n", prefix, printf("%sVERSION: %i (type %i, len %i, domain %i)\n", prefix,
version, messageType, version, messageType,
ntohs(h->messageLength), h->domainNumber); ntohs(h->messageLength), h->domainNumber);
printf("%sFLAGS: 0x%04x (correction 0x%08x:%08x %08u)\n", printf("%sFLAGS: 0x%02x%02x (correction 0x%08x:%08x %08u)\n",
prefix, h->flagField, prefix, (unsigned) h->flagField[0],(unsigned) h->flagField[1],
ntohl(*(int *)cfptr), ntohl(*(int *)cfptr),
ntohl(*(int *)(cfptr + 4)), ntohl(*(int *)(cfptr + 4)),
ntohl(*(int *)(cfptr + 4))); ntohl(*(int *)(cfptr + 4)));
......
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