add support for the sp78 format

This commit is contained in:
Denis Ahrens
2013-01-31 20:31:11 +01:00
parent afb554fc66
commit b125097a07
2 changed files with 9 additions and 1 deletions

View File

@ -87,6 +87,11 @@ void printUInt(SMCVal_t val)
printf("%u ", (unsigned int) _strtoul(val.bytes, val.dataSize, 10));
}
void printSP78(SMCVal_t val)
{
printf("%u.%02u ", *val.bytes, (*(val.bytes+1)) * 100 / 256);
}
void printBytesHex(SMCVal_t val)
{
int i;
@ -108,6 +113,8 @@ void printVal(SMCVal_t val)
printUInt(val);
else if (strcmp(val.dataType, DATATYPE_FPE2) == 0)
printFPE2(val);
else if (strcmp(val.dataType, DATATYPE_SP78) == 0 && val.dataSize == 2)
printSP78(val);
printBytesHex(val);
}

View File

@ -42,6 +42,7 @@
#define DATATYPE_UINT8 "ui8 "
#define DATATYPE_UINT16 "ui16"
#define DATATYPE_UINT32 "ui32"
#define DATATYPE_SP78 "sp78"
typedef struct {
char major;
@ -65,7 +66,7 @@ typedef struct {
char dataAttributes;
} SMCKeyData_keyInfo_t;
typedef char SMCBytes_t[32];
typedef unsigned char SMCBytes_t[32];
typedef struct {
UInt32 key;