From dd63c6565570f51d5bc5693ba0e007ef9a779d07 Mon Sep 17 00:00:00 2001 From: Denis Ahrens Date: Sat, 2 Feb 2013 16:33:23 +0100 Subject: [PATCH] add support for SI8 signed integer type --- smc-command/smc.c | 7 +++++++ smc-command/smc.h | 1 + 2 files changed, 8 insertions(+) diff --git a/smc-command/smc.c b/smc-command/smc.c index 693d8c1..8a3a780 100644 --- a/smc-command/smc.c +++ b/smc-command/smc.c @@ -92,6 +92,11 @@ void printSP78(SMCVal_t val) printf("%u.%02u ", *val.bytes, (*(val.bytes+1)) * 100 / 256); } +void printSI8(SMCVal_t val) +{ + printf("%d ", (signed char)*val.bytes); +} + void printBytesHex(SMCVal_t val) { int i; @@ -115,6 +120,8 @@ void printVal(SMCVal_t val) printFPE2(val); else if (strcmp(val.dataType, DATATYPE_SP78) == 0 && val.dataSize == 2) printSP78(val); + else if (strcmp(val.dataType, DATATYPE_SI8) == 0 && val.dataSize == 1) + printSI8(val); printBytesHex(val); } diff --git a/smc-command/smc.h b/smc-command/smc.h index 3a31b8f..8f4312d 100644 --- a/smc-command/smc.h +++ b/smc-command/smc.h @@ -43,6 +43,7 @@ #define DATATYPE_UINT16 "ui16" #define DATATYPE_UINT32 "ui32" #define DATATYPE_SP78 "sp78" +#define DATATYPE_SI8 "si8 " typedef struct { char major;