mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-03-03 13:16:38 +00:00
st/prober: Allow querying entries and autoprobers
This commit is contained in:
parent
37c96ee7fb
commit
58e68e0a4a
src/xrt
|
@ -42,6 +42,8 @@ struct os_hid_device;
|
|||
*/
|
||||
#define XRT_MAX_DEVICES_PER_PROBE 16
|
||||
|
||||
#define MAX_AUTO_PROBERS 8
|
||||
|
||||
/*!
|
||||
* Entry for a single device.
|
||||
*
|
||||
|
@ -219,6 +221,11 @@ struct xrt_prober
|
|||
|
||||
int (*list_video_devices)(struct xrt_prober *xp, xrt_prober_list_video_cb cb, void *ptr);
|
||||
|
||||
int (*get_entries)(struct xrt_prober *xp,
|
||||
size_t *out_num_entries,
|
||||
struct xrt_prober_entry ***out_entries,
|
||||
struct xrt_auto_prober ***out_auto_probers);
|
||||
|
||||
/*!
|
||||
* Returns a string property on the device of the given type
|
||||
* @p which_string in @p out_buffer.
|
||||
|
@ -365,6 +372,22 @@ xrt_prober_list_video_devices(struct xrt_prober *xp, xrt_prober_list_video_cb cb
|
|||
return xp->list_video_devices(xp, cb, ptr);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @copydoc xrt_prober::get_entries
|
||||
*
|
||||
* Helper function for @ref xrt_prober::get_entries.
|
||||
*
|
||||
* @public @memberof xrt_prober
|
||||
*/
|
||||
static inline int
|
||||
xrt_prober_get_entries(struct xrt_prober *xp,
|
||||
size_t *out_num_entries,
|
||||
struct xrt_prober_entry ***out_entries,
|
||||
struct xrt_auto_prober ***out_auto_probers)
|
||||
{
|
||||
return xp->get_entries(xp, out_num_entries, out_entries, out_auto_probers);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @copydoc xrt_prober::destroy
|
||||
*
|
||||
|
|
|
@ -76,6 +76,13 @@ open_video_device(struct xrt_prober *xp,
|
|||
|
||||
static int
|
||||
list_video_devices(struct xrt_prober *xp, xrt_prober_list_video_cb cb, void *ptr);
|
||||
|
||||
static int
|
||||
get_entries(struct xrt_prober *xp,
|
||||
size_t *out_num_entries,
|
||||
struct xrt_prober_entry ***out_entries,
|
||||
struct xrt_auto_prober ***out_auto_probers);
|
||||
|
||||
static int
|
||||
get_string_descriptor(struct xrt_prober *xp,
|
||||
struct xrt_prober_device *xpdev,
|
||||
|
@ -308,6 +315,7 @@ initialize(struct prober *p, struct xrt_prober_entry_lists *lists)
|
|||
p->base.open_hid_interface = open_hid_interface;
|
||||
p->base.open_video_device = open_video_device;
|
||||
p->base.list_video_devices = list_video_devices;
|
||||
p->base.get_entries = get_entries;
|
||||
p->base.get_string_descriptor = get_string_descriptor;
|
||||
p->base.can_open = can_open;
|
||||
p->base.destroy = destroy;
|
||||
|
@ -819,6 +827,19 @@ list_video_devices(struct xrt_prober *xp, xrt_prober_list_video_cb cb, void *ptr
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
get_entries(struct xrt_prober *xp,
|
||||
size_t *out_num_entries,
|
||||
struct xrt_prober_entry ***out_entries,
|
||||
struct xrt_auto_prober ***out_auto_probers)
|
||||
{
|
||||
struct prober *p = (struct prober *)xp;
|
||||
*out_num_entries = p->num_entries;
|
||||
*out_entries = p->entries;
|
||||
*out_auto_probers = p->auto_probers;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
get_string_descriptor(struct xrt_prober *xp,
|
||||
struct xrt_prober_device *xpdev,
|
||||
|
|
|
@ -41,8 +41,6 @@
|
|||
#define P_WARN(d, ...) U_LOG_IFL_W(d->ll, __VA_ARGS__)
|
||||
#define P_ERROR(d, ...) U_LOG_IFL_E(d->ll, __VA_ARGS__)
|
||||
|
||||
#define MAX_AUTO_PROBERS 8
|
||||
|
||||
/*!
|
||||
* What config is currently active in the config file.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue