mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-01 12:46:12 +00:00
[a|d]/[sur]vive: Implement 3.0/Tundra tracker support
Co-authored-by: BabbleBones <BabbleBones@protonmail.com>
This commit is contained in:
parent
2b2a944507
commit
dc5b398405
|
@ -608,6 +608,12 @@ vive_config_parse_controller(struct vive_controller_config *d, char *json_string
|
||||||
} else if (strcmp(d->firmware.model_number, "VIVE Tracker Pro MV") == 0) {
|
} else if (strcmp(d->firmware.model_number, "VIVE Tracker Pro MV") == 0) {
|
||||||
d->variant = CONTROLLER_TRACKER_GEN2;
|
d->variant = CONTROLLER_TRACKER_GEN2;
|
||||||
VIVE_DEBUG(d, "Found Gen 2 tracker.");
|
VIVE_DEBUG(d, "Found Gen 2 tracker.");
|
||||||
|
} else if (strcmp(d->firmware.model_number, "VIVE Tracker 3.0 MV") == 0) {
|
||||||
|
d->variant = CONTROLLER_TRACKER_GEN3;
|
||||||
|
VIVE_DEBUG(d, "Found Gen 3 tracker.");
|
||||||
|
} else if (strcmp(d->firmware.model_number, "Tundra Tracker") == 0) {
|
||||||
|
d->variant = CONTROLLER_TRACKER_TUNDRA;
|
||||||
|
VIVE_DEBUG(d, "Found Tundra tracker.");
|
||||||
} else {
|
} else {
|
||||||
VIVE_ERROR(d, "Failed to parse controller variant!\n\tfirmware.model_[number|name]: '%s'",
|
VIVE_ERROR(d, "Failed to parse controller variant!\n\tfirmware.model_[number|name]: '%s'",
|
||||||
d->firmware.model_number);
|
d->firmware.model_number);
|
||||||
|
@ -624,7 +630,9 @@ vive_config_parse_controller(struct vive_controller_config *d, char *json_string
|
||||||
} break;
|
} break;
|
||||||
case CONTROLLER_INDEX_LEFT:
|
case CONTROLLER_INDEX_LEFT:
|
||||||
case CONTROLLER_INDEX_RIGHT:
|
case CONTROLLER_INDEX_RIGHT:
|
||||||
case CONTROLLER_TRACKER_GEN2: {
|
case CONTROLLER_TRACKER_GEN2:
|
||||||
|
case CONTROLLER_TRACKER_GEN3:
|
||||||
|
case CONTROLLER_TRACKER_TUNDRA: {
|
||||||
const cJSON *imu = u_json_get(json, "imu");
|
const cJSON *imu = u_json_get(json, "imu");
|
||||||
_get_pose_from_pos_x_z(imu, &d->imu.trackref);
|
_get_pose_from_pos_x_z(imu, &d->imu.trackref);
|
||||||
|
|
||||||
|
@ -632,7 +640,8 @@ vive_config_parse_controller(struct vive_controller_config *d, char *json_string
|
||||||
JSON_VEC3(imu, "acc_scale", &d->imu.acc_scale);
|
JSON_VEC3(imu, "acc_scale", &d->imu.acc_scale);
|
||||||
JSON_VEC3(imu, "gyro_bias", &d->imu.gyro_bias);
|
JSON_VEC3(imu, "gyro_bias", &d->imu.gyro_bias);
|
||||||
|
|
||||||
if (d->variant == CONTROLLER_TRACKER_GEN2)
|
if (d->variant == CONTROLLER_TRACKER_GEN2 || d->variant == CONTROLLER_TRACKER_GEN3 ||
|
||||||
|
d->variant == CONTROLLER_TRACKER_TUNDRA)
|
||||||
JSON_VEC3(imu, "gyro_scale", &d->imu.gyro_scale);
|
JSON_VEC3(imu, "gyro_scale", &d->imu.gyro_scale);
|
||||||
} break;
|
} break;
|
||||||
default: VIVE_ERROR(d, "Unknown Vive watchman variant."); return false;
|
default: VIVE_ERROR(d, "Unknown Vive watchman variant."); return false;
|
||||||
|
|
|
@ -63,6 +63,8 @@ enum VIVE_CONTROLLER_VARIANT
|
||||||
CONTROLLER_INDEX_RIGHT,
|
CONTROLLER_INDEX_RIGHT,
|
||||||
CONTROLLER_TRACKER_GEN1,
|
CONTROLLER_TRACKER_GEN1,
|
||||||
CONTROLLER_TRACKER_GEN2,
|
CONTROLLER_TRACKER_GEN2,
|
||||||
|
CONTROLLER_TRACKER_GEN3,
|
||||||
|
CONTROLLER_TRACKER_TUNDRA,
|
||||||
CONTROLLER_UNKNOWN
|
CONTROLLER_UNKNOWN
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1025,7 +1025,8 @@ _create_controller_device(struct survive_system *sys,
|
||||||
U_LOG_IFL_E(sys->log_level, "Only creating 1 right controller!");
|
U_LOG_IFL_E(sys->log_level, "Only creating 1 right controller!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (variant == CONTROLLER_TRACKER_GEN1 || variant == CONTROLLER_TRACKER_GEN2) {
|
} else if (variant == CONTROLLER_TRACKER_GEN1 || variant == CONTROLLER_TRACKER_GEN2 ||
|
||||||
|
variant == CONTROLLER_TRACKER_GEN3 || variant == CONTROLLER_TRACKER_TUNDRA) {
|
||||||
for (int i = SURVIVE_NON_CONTROLLER_START; i < MAX_TRACKED_DEVICE_COUNT; i++) {
|
for (int i = SURVIVE_NON_CONTROLLER_START; i < MAX_TRACKED_DEVICE_COUNT; i++) {
|
||||||
if (sys->controllers[i] == NULL) {
|
if (sys->controllers[i] == NULL) {
|
||||||
idx = i;
|
idx = i;
|
||||||
|
@ -1128,13 +1129,21 @@ _create_controller_device(struct survive_system *sys,
|
||||||
|
|
||||||
survive->base.device_type = XRT_DEVICE_TYPE_ANY_HAND_CONTROLLER;
|
survive->base.device_type = XRT_DEVICE_TYPE_ANY_HAND_CONTROLLER;
|
||||||
} else if (survive->ctrl.config.variant == CONTROLLER_TRACKER_GEN1 ||
|
} else if (survive->ctrl.config.variant == CONTROLLER_TRACKER_GEN1 ||
|
||||||
survive->ctrl.config.variant == CONTROLLER_TRACKER_GEN2) {
|
survive->ctrl.config.variant == CONTROLLER_TRACKER_GEN2 ||
|
||||||
|
survive->ctrl.config.variant == CONTROLLER_TRACKER_GEN3 ||
|
||||||
|
survive->ctrl.config.variant == CONTROLLER_TRACKER_TUNDRA) {
|
||||||
if (survive->ctrl.config.variant == CONTROLLER_TRACKER_GEN1) {
|
if (survive->ctrl.config.variant == CONTROLLER_TRACKER_GEN1) {
|
||||||
survive->base.name = XRT_DEVICE_VIVE_TRACKER_GEN1;
|
survive->base.name = XRT_DEVICE_VIVE_TRACKER_GEN1;
|
||||||
snprintf(survive->base.str, XRT_DEVICE_NAME_LEN, "Vive Tracker Gen1 (libsurvive)");
|
snprintf(survive->base.str, XRT_DEVICE_NAME_LEN, "Vive Tracker Gen1 (libsurvive)");
|
||||||
} else if (survive->ctrl.config.variant == CONTROLLER_TRACKER_GEN2) {
|
} else if (survive->ctrl.config.variant == CONTROLLER_TRACKER_GEN2) {
|
||||||
survive->base.name = XRT_DEVICE_VIVE_TRACKER_GEN2;
|
survive->base.name = XRT_DEVICE_VIVE_TRACKER_GEN2;
|
||||||
snprintf(survive->base.str, XRT_DEVICE_NAME_LEN, "Vive Tracker Gen2 (libsurvive)");
|
snprintf(survive->base.str, XRT_DEVICE_NAME_LEN, "Vive Tracker Gen2 (libsurvive)");
|
||||||
|
} else if (survive->ctrl.config.variant == CONTROLLER_TRACKER_GEN3) {
|
||||||
|
survive->base.name = XRT_DEVICE_VIVE_TRACKER_GEN3;
|
||||||
|
snprintf(survive->base.str, XRT_DEVICE_NAME_LEN, "Vive Tracker Gen3 (libsurvive)");
|
||||||
|
} else if (survive->ctrl.config.variant == CONTROLLER_TRACKER_TUNDRA) {
|
||||||
|
survive->base.name = XRT_DEVICE_VIVE_TRACKER_TUNDRA;
|
||||||
|
snprintf(survive->base.str, XRT_DEVICE_NAME_LEN, "Tundra Tracker Gen3 (libsurvive)");
|
||||||
}
|
}
|
||||||
|
|
||||||
survive->base.device_type = XRT_DEVICE_TYPE_GENERIC_TRACKER;
|
survive->base.device_type = XRT_DEVICE_TYPE_GENERIC_TRACKER;
|
||||||
|
@ -1186,6 +1195,8 @@ add_device(struct survive_system *ss, const struct SurviveSimpleConfigEvent *e)
|
||||||
case CONTROLLER_INDEX_RIGHT:
|
case CONTROLLER_INDEX_RIGHT:
|
||||||
case CONTROLLER_TRACKER_GEN1:
|
case CONTROLLER_TRACKER_GEN1:
|
||||||
case CONTROLLER_TRACKER_GEN2:
|
case CONTROLLER_TRACKER_GEN2:
|
||||||
|
case CONTROLLER_TRACKER_GEN3:
|
||||||
|
case CONTROLLER_TRACKER_TUNDRA:
|
||||||
U_LOG_IFL_D(ss->log_level, "Adding controller: %s.", config.firmware.model_number);
|
U_LOG_IFL_D(ss->log_level, "Adding controller: %s.", config.firmware.model_number);
|
||||||
_create_controller_device(ss, sso, &config);
|
_create_controller_device(ss, sso, &config);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1200,6 +1200,16 @@ vive_controller_create(struct os_hid_device *controller_hid, enum watchman_gen w
|
||||||
d->base.update_inputs = _update_tracker_inputs;
|
d->base.update_inputs = _update_tracker_inputs;
|
||||||
d->base.device_type = XRT_DEVICE_TYPE_GENERIC_TRACKER;
|
d->base.device_type = XRT_DEVICE_TYPE_GENERIC_TRACKER;
|
||||||
snprintf(d->base.str, XRT_DEVICE_NAME_LEN, "Vive Tracker Gen2 (vive)");
|
snprintf(d->base.str, XRT_DEVICE_NAME_LEN, "Vive Tracker Gen2 (vive)");
|
||||||
|
} else if (d->config.variant == CONTROLLER_TRACKER_GEN3) {
|
||||||
|
d->base.name = XRT_DEVICE_VIVE_TRACKER_GEN3;
|
||||||
|
d->base.update_inputs = _update_tracker_inputs;
|
||||||
|
d->base.device_type = XRT_DEVICE_TYPE_GENERIC_TRACKER;
|
||||||
|
snprintf(d->base.str, XRT_DEVICE_NAME_LEN, "Vive Tracker Gen3 (vive)");
|
||||||
|
} else if (d->config.variant == CONTROLLER_TRACKER_TUNDRA) {
|
||||||
|
d->base.name = CONTROLLER_TRACKER_TUNDRA;
|
||||||
|
d->base.update_inputs = _update_tracker_inputs;
|
||||||
|
d->base.device_type = XRT_DEVICE_TYPE_GENERIC_TRACKER;
|
||||||
|
snprintf(d->base.str, XRT_DEVICE_NAME_LEN, "Tundra Tracker Gen3 (vive)");
|
||||||
} else {
|
} else {
|
||||||
d->base.name = XRT_DEVICE_GENERIC_HMD;
|
d->base.name = XRT_DEVICE_GENERIC_HMD;
|
||||||
d->base.device_type = XRT_DEVICE_TYPE_GENERIC_TRACKER;
|
d->base.device_type = XRT_DEVICE_TYPE_GENERIC_TRACKER;
|
||||||
|
|
Loading…
Reference in a new issue