mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-02-15 02:00:22 +00:00
d/wmr: Remove legacy found functions
This commit is contained in:
parent
2ddf868735
commit
e9c43a7ca6
src/xrt
|
@ -150,40 +150,6 @@ wmr_create_bt_controller(struct xrt_prober *xp,
|
|||
struct xrt_device **out_xdev);
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* Found functions.
|
||||
*
|
||||
*/
|
||||
|
||||
/*!
|
||||
* Probing function for Windows Mixed Reality devices.
|
||||
*
|
||||
* @ingroup drv_wmr
|
||||
* @see xrt_prober_found_func_t
|
||||
*/
|
||||
int
|
||||
wmr_found(struct xrt_prober *xp,
|
||||
struct xrt_prober_device **devices,
|
||||
size_t device_count,
|
||||
size_t index,
|
||||
cJSON *attached_data,
|
||||
struct xrt_device **out_xdev);
|
||||
|
||||
/*!
|
||||
* Probing function for Bluetooth WMR motion controllers.
|
||||
*
|
||||
* @ingroup drv_wmr
|
||||
*/
|
||||
int
|
||||
wmr_bt_controller_found(struct xrt_prober *xp,
|
||||
struct xrt_prober_device **devices,
|
||||
size_t device_count,
|
||||
size_t index,
|
||||
cJSON *attached_data,
|
||||
struct xrt_device **out_xdev);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -35,14 +35,6 @@
|
|||
#include "../ht_ctrl_emu/ht_ctrl_emu_interface.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
*
|
||||
* Defines & structs.
|
||||
*
|
||||
*/
|
||||
|
||||
DEBUG_GET_ONCE_LOG_OPTION(wmr_log, "WMR_LOG", U_LOGGING_INFO)
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
|
@ -435,151 +427,3 @@ wmr_create_bt_controller(struct xrt_prober *xp,
|
|||
|
||||
return XRT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* 'Exported' found functions.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
wmr_found(struct xrt_prober *xp,
|
||||
struct xrt_prober_device **devices,
|
||||
size_t device_count,
|
||||
size_t index,
|
||||
cJSON *attached_data,
|
||||
struct xrt_device **out_xdev)
|
||||
{
|
||||
DRV_TRACE_MARKER();
|
||||
|
||||
enum u_logging_level log_level = debug_get_log_option_wmr_log();
|
||||
|
||||
struct xrt_prober_device *dev_holo = devices[index];
|
||||
struct xrt_prober_device *dev_companion = NULL;
|
||||
enum wmr_headset_type hmd_type = WMR_HEADSET_GENERIC;
|
||||
const int interface_holo = 2;
|
||||
const int interface_companion = 0;
|
||||
|
||||
unsigned char buf[256] = {0};
|
||||
int result = xrt_prober_get_string_descriptor(xp, dev_holo, XRT_PROBER_STRING_PRODUCT, buf, sizeof(buf));
|
||||
|
||||
if (!u_prober_match_string(xp, dev_holo, XRT_PROBER_STRING_MANUFACTURER, MS_HOLOLENS_MANUFACTURER_STRING) ||
|
||||
!u_prober_match_string(xp, dev_holo, XRT_PROBER_STRING_PRODUCT, MS_HOLOLENS_PRODUCT_STRING)) {
|
||||
U_LOG_IFL_E(log_level, "HoloLens Sensors manufacturer or product strings did not match");
|
||||
return -1;
|
||||
}
|
||||
|
||||
U_LOG_IFL_D(log_level, "Found HoloLens Sensors HMD device '%s' '%s' (vid %04X, pid %04X)",
|
||||
MS_HOLOLENS_MANUFACTURER_STRING, MS_HOLOLENS_PRODUCT_STRING, dev_holo->vendor_id,
|
||||
dev_holo->product_id);
|
||||
|
||||
if (!find_companion_device(xp, devices, device_count, log_level, &hmd_type, &dev_companion)) {
|
||||
U_LOG_IFL_E(log_level, "Did not find HoloLens Sensors' companion device");
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct os_hid_device *hid_holo = NULL;
|
||||
result = xrt_prober_open_hid_interface(xp, dev_holo, interface_holo, &hid_holo);
|
||||
if (result != 0) {
|
||||
U_LOG_IFL_E(log_level, "Failed to open HoloLens Sensors HID interface");
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct os_hid_device *hid_companion = NULL;
|
||||
result = xrt_prober_open_hid_interface(xp, dev_companion, interface_companion, &hid_companion);
|
||||
if (result != 0) {
|
||||
U_LOG_IFL_E(log_level, "Failed to open HoloLens Sensors' companion HID interface.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
int out_idx = 0;
|
||||
struct xrt_device *hmd = NULL;
|
||||
struct xrt_device *ht = NULL;
|
||||
wmr_hmd_create(hmd_type, hid_holo, hid_companion, dev_holo, log_level, &hmd, &ht);
|
||||
|
||||
if (hmd == NULL) {
|
||||
U_LOG_IFL_E(log_level, "Failed to create WMR HMD device.");
|
||||
return -1;
|
||||
}
|
||||
out_xdev[out_idx++] = hmd;
|
||||
|
||||
#ifdef XRT_BUILD_DRIVER_HANDTRACKING
|
||||
if (ht != NULL) { // Create hand-tracked controllers
|
||||
struct xrt_device *two_hands[2];
|
||||
cemu_devices_create(hmd, ht, two_hands);
|
||||
|
||||
out_xdev[out_idx++] = two_hands[0];
|
||||
out_xdev[out_idx++] = two_hands[1];
|
||||
}
|
||||
#endif
|
||||
|
||||
return out_idx;
|
||||
}
|
||||
|
||||
int
|
||||
wmr_bt_controller_found(struct xrt_prober *xp,
|
||||
struct xrt_prober_device **devices,
|
||||
size_t num_devices,
|
||||
size_t index,
|
||||
cJSON *attached_data,
|
||||
struct xrt_device **out_xdev)
|
||||
{
|
||||
DRV_TRACE_MARKER();
|
||||
|
||||
enum u_logging_level log_level = debug_get_log_option_wmr_log();
|
||||
|
||||
struct os_hid_device *hid_controller = NULL;
|
||||
|
||||
// Only handle Bluetooth connected controllers here.
|
||||
if (devices[index]->bus != XRT_BUS_TYPE_BLUETOOTH) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned char product_name[XRT_DEVICE_PRODUCT_NAME_LEN] = {0};
|
||||
int ret = xrt_prober_get_string_descriptor(xp, devices[index], XRT_PROBER_STRING_PRODUCT, product_name,
|
||||
sizeof(product_name));
|
||||
|
||||
enum xrt_device_type controller_type = XRT_DEVICE_TYPE_UNKNOWN;
|
||||
int interface_controller = -1;
|
||||
|
||||
switch (devices[index]->product_id) {
|
||||
case WMR_CONTROLLER_PID:
|
||||
case ODYSSEY_CONTROLLER_PID:
|
||||
case REVERB_G2_CONTROLLER_PID:
|
||||
if (strncmp((char *)product_name, WMR_CONTROLLER_LEFT_PRODUCT_STRING, sizeof(product_name)) == 0) {
|
||||
controller_type = XRT_DEVICE_TYPE_LEFT_HAND_CONTROLLER;
|
||||
interface_controller = 0;
|
||||
break;
|
||||
} else if (strncmp((char *)product_name, WMR_CONTROLLER_RIGHT_PRODUCT_STRING, sizeof(product_name)) ==
|
||||
0) {
|
||||
controller_type = XRT_DEVICE_TYPE_RIGHT_HAND_CONTROLLER;
|
||||
interface_controller = 0;
|
||||
break;
|
||||
}
|
||||
// else fall through
|
||||
default:
|
||||
U_LOG_IFL_D(log_level,
|
||||
"Unsupported controller device (Bluetooth): vid: 0x%04X, pid: 0x%04X, Product Name: '%s'",
|
||||
devices[index]->vendor_id, devices[index]->product_id, product_name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
ret = xrt_prober_open_hid_interface(xp, devices[index], interface_controller, &hid_controller);
|
||||
if (ret != 0) {
|
||||
U_LOG_IFL_E(log_level, "Failed to open WMR Bluetooth controller's HID interface");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
struct xrt_device *p = wmr_bt_controller_create(hid_controller, controller_type, log_level);
|
||||
if (!p) {
|
||||
U_LOG_IFL_E(log_level, "Failed to create WMR controller (Bluetooth)");
|
||||
return -1;
|
||||
}
|
||||
|
||||
*out_xdev = p;
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -172,14 +172,6 @@ struct xrt_prober_entry target_entry_list[] = {
|
|||
{HDK_VID, HDK_PID, hdk_found, "OSVR HDK", "osvr"},
|
||||
#endif // XRT_BUILD_DRIVER_HDK
|
||||
|
||||
#ifdef XRT_BUILD_DRIVER_WMR
|
||||
{MICROSOFT_VID, HOLOLENS_SENSORS_PID, wmr_found, "Microsoft HoloLens Sensors", "wmr"},
|
||||
{MICROSOFT_VID, WMR_CONTROLLER_PID, wmr_bt_controller_found, "WMR Bluetooth controller", "wmr"},
|
||||
{MICROSOFT_VID, REVERB_G2_CONTROLLER_PID, wmr_bt_controller_found, "HP Reverb G2 Bluetooth controller", "wmr"},
|
||||
{MICROSOFT_VID, ODYSSEY_CONTROLLER_PID, wmr_bt_controller_found, "Odyssey Bluetooth controller", "wmr"},
|
||||
|
||||
#endif // XRT_BUILD_DRIVER_WMR
|
||||
|
||||
{0x0000, 0x0000, NULL, NULL, NULL}, // Terminate
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue