mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-22 05:27:20 +00:00
[c-host] linux: implemented getValues
support for shmDevice option
This commit is contained in:
parent
e22f33a44b
commit
b662128708
@ -141,12 +141,13 @@ static bool shmDeviceValidator(struct Option * opt, const char ** error)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void shmDevicePrintHelp()
|
static StringList shmDeviceGetValues(struct Option * option)
|
||||||
{
|
{
|
||||||
printf("Valid devices are:\n\n");
|
StringList sl = stringlist_new(true);
|
||||||
|
|
||||||
DIR * d = opendir("/sys/class/uio");
|
DIR * d = opendir("/sys/class/uio");
|
||||||
if (!d)
|
if (!d)
|
||||||
return;
|
return sl;
|
||||||
|
|
||||||
struct dirent * dir;
|
struct dirent * dir;
|
||||||
while((dir = readdir(d)) != NULL)
|
while((dir = readdir(d)) != NULL)
|
||||||
@ -159,12 +160,13 @@ static void shmDevicePrintHelp()
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (strcmp(name, "KVMFR") == 0)
|
if (strcmp(name, "KVMFR") == 0)
|
||||||
printf(" * %s\n", dir->d_name);
|
stringlist_push(sl, strdup(dir->d_name));
|
||||||
|
|
||||||
free(name);
|
free(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
closedir(d);
|
closedir(d);
|
||||||
|
return sl;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char * argv[])
|
int main(int argc, char * argv[])
|
||||||
@ -180,7 +182,7 @@ int main(int argc, char * argv[])
|
|||||||
.type = OPTION_TYPE_STRING,
|
.type = OPTION_TYPE_STRING,
|
||||||
.value.x_string = "uio0",
|
.value.x_string = "uio0",
|
||||||
.validator = shmDeviceValidator,
|
.validator = shmDeviceValidator,
|
||||||
.printHelp = shmDevicePrintHelp
|
.getValues = shmDeviceGetValues
|
||||||
},
|
},
|
||||||
{0}
|
{0}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user