d/ohmd: Add variable tracking

This commit is contained in:
Jakob Borncrantz 2019-10-15 20:52:39 +02:00
parent 0bc91ab1cd
commit d245fc33c9

View file

@ -19,6 +19,7 @@
#include "math/m_api.h" #include "math/m_api.h"
#include "xrt/xrt_device.h" #include "xrt/xrt_device.h"
#include "util/u_var.h"
#include "util/u_misc.h" #include "util/u_misc.h"
#include "util/u_debug.h" #include "util/u_debug.h"
#include "util/u_device.h" #include "util/u_device.h"
@ -38,6 +39,9 @@ oh_device_destroy(struct xrt_device *xdev)
{ {
struct oh_device *ohd = oh_device(xdev); struct oh_device *ohd = oh_device(xdev);
// Remove the variable tracking.
u_var_remove_root(ohd);
if (ohd->dev != NULL) { if (ohd->dev != NULL) {
ohmd_close_device(ohd->dev); ohmd_close_device(ohd->dev);
ohd->dev = NULL; ohd->dev = NULL;
@ -550,5 +554,8 @@ oh_device_create(ohmd_context *ctx,
u_device_dump_config(&ohd->base, __func__, prod); u_device_dump_config(&ohd->base, __func__, prod);
} }
u_var_add_root(ohd, "OpenHMD Wrapper", true);
u_var_add_ro_text(ohd, ohd->base.str, "Card");
return ohd; return ohd;
} }