sdlog2 strick packing fixed, length bug fixed, "sdlog2_dump.py" debug tool added

This commit is contained in:
Anton Babushkin
2013-05-26 00:14:10 +04:00
parent e211352604
commit 691dc8eefd
3 changed files with 98 additions and 6 deletions
+2
View File
@@ -492,6 +492,7 @@ int sdlog2_thread_main(int argc, char *argv[])
} subs;
/* log message buffer: header + body */
#pragma pack(push, 1)
struct {
LOG_PACKET_HEADER;
union {
@@ -502,6 +503,7 @@ int sdlog2_thread_main(int argc, char *argv[])
} log_msg = {
LOG_PACKET_HEADER_INIT(0)
};
#pragma pack(pop)
memset(&log_msg.body, 0, sizeof(log_msg.body));
/* --- MANAGEMENT - LOGGING COMMAND --- */
+6 -6
View File
@@ -77,7 +77,7 @@ Format characters in the format string for binary log messages
struct log_format_s {
uint8_t type;
uint8_t length;
uint8_t length; // full packet length including header
char name[4];
char format[16];
char labels[64];
@@ -85,13 +85,13 @@ struct log_format_s {
#define LOG_FORMAT(_name, _format, _labels) { \
.type = LOG_##_name##_MSG, \
.length = sizeof(struct log_##_name##_s) + 8, \
.name = #_name, \
.format = _format, \
.labels = _labels \
.length = sizeof(struct log_##_name##_s) + LOG_PACKET_HEADER_LEN, \
.name = #_name, \
.format = _format, \
.labels = _labels \
}
#define LOG_FORMAT_MSG 128
#define LOG_FORMAT_MSG 0x80
#define LOG_PACKET_SIZE(_name) LOG_PACKET_HEADER_LEN + sizeof(log_msg.body.log_##_name)