t/cli: Use new prober function helpers

This commit is contained in:
Jakob Bornecrantz 2019-06-30 14:30:10 +01:00
parent b7defdb0ae
commit e336590153
2 changed files with 8 additions and 11 deletions

View file

@ -36,7 +36,7 @@ init(struct program *p)
} }
// Need to prime the prober before listing devices. // Need to prime the prober before listing devices.
ret = p->xp->probe(p->xp); ret = xrt_prober_probe(p->xp);
if (ret != 0) { if (ret != 0) {
fprintf(stderr, "Failed to probe for devices.\n"); fprintf(stderr, "Failed to probe for devices.\n");
return ret; return ret;
@ -71,7 +71,7 @@ print_cameras(struct program *p)
int ret; int ret;
p->index = 0; p->index = 0;
ret = p->xp->list_video_devices(p->xp, list_cb, p); ret = xrt_prober_list_video_devices(p->xp, list_cb, p);
if (ret != 0) { if (ret != 0) {
return ret; return ret;
} }
@ -99,7 +99,7 @@ print_cameras(struct program *p)
p->index = 0; p->index = 0;
p->selected = selected; p->selected = selected;
ret = p->xp->list_video_devices(p->xp, list_cb, p); ret = xrt_prober_list_video_devices(p->xp, list_cb, p);
if (ret != 0) { if (ret != 0) {
return ret; return ret;
} }
@ -112,7 +112,7 @@ static int
do_exit(struct program *p, int ret) do_exit(struct program *p, int ret)
{ {
if (p->xp != NULL) { if (p->xp != NULL) {
p->xp->destroy(&p->xp); xrt_prober_destroy(&p->xp);
} }
printf(" :: Exiting '%i'\n", ret); printf(" :: Exiting '%i'\n", ret);

View file

@ -16,10 +16,7 @@
static int static int
do_exit(struct xrt_prober **xp_ptr, int ret) do_exit(struct xrt_prober **xp_ptr, int ret)
{ {
if (*xp_ptr != NULL) { xrt_prober_destroy(xp_ptr);
(*xp_ptr)->destroy(xp_ptr);
*xp_ptr = NULL;
}
printf(" :: Exiting '%i'\n", ret); printf(" :: Exiting '%i'\n", ret);
@ -46,7 +43,7 @@ cli_cmd_test(int argc, const char **argv)
// Need to prime the prober with devices before dumping and listing. // Need to prime the prober with devices before dumping and listing.
printf(" :: Probing!\n"); printf(" :: Probing!\n");
ret = xp->probe(xp); ret = xrt_prober_probe(xp);
if (ret != 0) { if (ret != 0) {
return do_exit(&xp, ret); return do_exit(&xp, ret);
} }
@ -54,7 +51,7 @@ cli_cmd_test(int argc, const char **argv)
// So the user can see what we found. // So the user can see what we found.
printf(" :: Dumping!\n"); printf(" :: Dumping!\n");
ret = xp->dump(xp); ret = xrt_prober_dump(xp);
if (ret != 0) { if (ret != 0) {
do_exit(&xp, ret); do_exit(&xp, ret);
} }
@ -62,7 +59,7 @@ cli_cmd_test(int argc, const char **argv)
// Multiple devices can be found. // Multiple devices can be found.
printf(" :: Selecting devices!\n"); printf(" :: Selecting devices!\n");
ret = xp->select(xp, xdevs, NUM_XDEVS); ret = xrt_prober_select(xp, xdevs, NUM_XDEVS);
if (ret != 0) { if (ret != 0) {
do_exit(&xp, ret); do_exit(&xp, ret);
} }