The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

d/survive: implement battery status query

Co-authored-by: Gabriele Musco <gabmus@disroot.org>
Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2292>

authored by

Torge Matthies
Gabriele Musco
and committed by
Marge Bot
0f57657b 59d9d832

+22
+1
doc/changes/drivers/mr.2292.md
··· 1 + survive: Implement battery status query.
+21
src/xrt/drivers/survive/survive_driver.c
··· 359 359 p->position.z, p->orientation.x, p->orientation.y, p->orientation.z, p->orientation.w); 360 360 } 361 361 362 + static xrt_result_t 363 + survive_device_get_battery_status(struct xrt_device *xdev, bool *out_present, bool *out_charging, float *out_charge) 364 + { 365 + struct survive_device *survive = (struct survive_device *)xdev; 366 + if (!survive->survive_obj) { 367 + // U_LOG_D("Obj not set for %p", (void*)survive); 368 + *out_present = false; 369 + return XRT_SUCCESS; 370 + } 371 + 372 + *out_present = true; 373 + *out_charging = survive_simple_object_charging(survive->survive_obj); 374 + *out_charge = survive_simple_object_charge_percet(survive->survive_obj) * 0.01F; 375 + SURVIVE_TRACE(survive, "Charging: %s, charge: %f", *out_charging ? "true" : "false", *out_charge); 376 + return XRT_SUCCESS; 377 + } 378 + 362 379 static int 363 380 survive_controller_haptic_pulse(struct survive_device *survive, const union xrt_output_value *value) 364 381 { ··· 966 983 survive->base.hmd->distortion.models = XRT_DISTORTION_MODEL_COMPUTE; 967 984 survive->base.hmd->distortion.preferred = XRT_DISTORTION_MODEL_COMPUTE; 968 985 survive->base.compute_distortion = compute_distortion; 986 + survive->base.get_battery_status = survive_device_get_battery_status; 969 987 970 988 survive->base.orientation_tracking_supported = true; 971 989 survive->base.position_tracking_supported = true; 972 990 survive->base.device_type = XRT_DEVICE_TYPE_HMD; 991 + survive->base.battery_status_supported = true; 973 992 974 993 survive->base.inputs[0].name = XRT_INPUT_GENERIC_HEAD_POSE; 975 994 ··· 1075 1094 survive->base.update_inputs = survive_device_update_inputs; 1076 1095 survive->base.get_tracked_pose = survive_device_get_tracked_pose; 1077 1096 survive->base.set_output = survive_controller_device_set_output; 1097 + survive->base.get_battery_status = survive_device_get_battery_status; 1078 1098 snprintf(survive->base.serial, XRT_DEVICE_NAME_LEN, "%s", survive->ctrl.config.firmware.device_serial_number); 1079 1099 1080 1100 if (variant == CONTROLLER_INDEX_LEFT || variant == CONTROLLER_INDEX_RIGHT) { ··· 1168 1188 1169 1189 survive->base.orientation_tracking_supported = true; 1170 1190 survive->base.position_tracking_supported = true; 1191 + survive->base.battery_status_supported = true; 1171 1192 1172 1193 survive->last_inputs = U_TYPED_ARRAY_CALLOC(struct xrt_input, survive->base.input_count); 1173 1194 survive->num_last_inputs = survive->base.input_count;