mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 06:40:54 +07:00
tools: gpio: port gpio-watch to v2 uAPI
Port the gpio-watch tool to the latest GPIO uAPI. Signed-off-by: Kent Gibson <warthog618@gmail.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
This commit is contained in:
parent
3c333c4704
commit
e86a863b33
@ -21,8 +21,8 @@
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct gpioline_info_changed chg;
|
||||
struct gpioline_info req;
|
||||
struct gpio_v2_line_info_changed chg;
|
||||
struct gpio_v2_line_info req;
|
||||
struct pollfd pfd;
|
||||
int fd, i, j, ret;
|
||||
char *event, *end;
|
||||
@ -40,11 +40,11 @@ int main(int argc, char **argv)
|
||||
for (i = 0, j = 2; i < argc - 2; i++, j++) {
|
||||
memset(&req, 0, sizeof(req));
|
||||
|
||||
req.line_offset = strtoul(argv[j], &end, 0);
|
||||
req.offset = strtoul(argv[j], &end, 0);
|
||||
if (*end != '\0')
|
||||
goto err_usage;
|
||||
|
||||
ret = ioctl(fd, GPIO_GET_LINEINFO_WATCH_IOCTL, &req);
|
||||
ret = ioctl(fd, GPIO_V2_GET_LINEINFO_WATCH_IOCTL, &req);
|
||||
if (ret) {
|
||||
perror("unable to set up line watch");
|
||||
return EXIT_FAILURE;
|
||||
@ -71,13 +71,13 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
switch (chg.event_type) {
|
||||
case GPIOLINE_CHANGED_REQUESTED:
|
||||
case GPIO_V2_LINE_CHANGED_REQUESTED:
|
||||
event = "requested";
|
||||
break;
|
||||
case GPIOLINE_CHANGED_RELEASED:
|
||||
case GPIO_V2_LINE_CHANGED_RELEASED:
|
||||
event = "released";
|
||||
break;
|
||||
case GPIOLINE_CHANGED_CONFIG:
|
||||
case GPIO_V2_LINE_CHANGED_CONFIG:
|
||||
event = "config changed";
|
||||
break;
|
||||
default:
|
||||
@ -87,7 +87,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
printf("line %u: %s at %llu\n",
|
||||
chg.info.line_offset, event, chg.timestamp);
|
||||
chg.info.offset, event, chg.timestamp_ns);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user