Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion smc-command/smc.c
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,7 @@ void usage(char* prog)
printf(" -k <key> : key to manipulate\n");
printf(" -l : list all keys and values\n");
printf(" -r : read the value of a key\n");
printf(" -p <value> : write the specified integer value to a floating point key\n");
printf(" -w <value> : write the specified value to a key\n");
printf(" -v : version\n");
printf("\n");
Expand Down Expand Up @@ -684,7 +685,7 @@ int main(int argc, char *argv[])
UInt32Char_t key = { 0 };
SMCVal_t val;

while ((c = getopt(argc, argv, "fthk:lrw:v")) != -1)
while ((c = getopt(argc, argv, "fthk:lp:rw:v")) != -1)
{
switch(c)
{
Expand All @@ -708,6 +709,17 @@ int main(int argc, char *argv[])
printf("%s\n", VERSION);
return 0;
break;
case 'p':
op = OP_WRITE;
{
float fval;
fval = strtof(optarg, NULL);

val.dataSize = 4;
memcpy(val.bytes, &fval, sizeof(fval));
memcpy(val.dataType, DATATYPE_FLT, sizeof(val.dataType));
}
break;
case 'w':
op = OP_WRITE;
{
Expand Down