xrt: Do not depend on util

This commit is contained in:
Jakob Bornecrantz 2022-05-22 13:19:20 +01:00 committed by Ryan Pavlik
parent 037872e2b8
commit 38eac9dddc
6 changed files with 10 additions and 11 deletions

View file

@ -130,7 +130,7 @@ qwerty_set_output(struct xrt_device *xd, enum xrt_output_name name, union xrt_ou
struct qwerty_device *qd = qwerty_device(xd); struct qwerty_device *qd = qwerty_device(xd);
float frequency = value->vibration.frequency; float frequency = value->vibration.frequency;
float amplitude = value->vibration.amplitude; float amplitude = value->vibration.amplitude;
time_duration_ns duration = value->vibration.duration; time_duration_ns duration = value->vibration.duration_ns;
if (amplitude || duration || frequency) { if (amplitude || duration || frequency) {
QWERTY_INFO(qd, QWERTY_INFO(qd,
"[%s] Haptic output: \n" "[%s] Haptic output: \n"

View file

@ -349,11 +349,11 @@ static int
survive_controller_haptic_pulse(struct survive_device *survive, union xrt_output_value *value) survive_controller_haptic_pulse(struct survive_device *survive, union xrt_output_value *value)
{ {
float duration_seconds; float duration_seconds;
if (value->vibration.duration == XRT_MIN_HAPTIC_DURATION) { if (value->vibration.duration_ns == XRT_MIN_HAPTIC_DURATION) {
SURVIVE_TRACE(survive, "Haptic pulse duration: using %f minimum", MIN_HAPTIC_DURATION); SURVIVE_TRACE(survive, "Haptic pulse duration: using %f minimum", MIN_HAPTIC_DURATION);
duration_seconds = MIN_HAPTIC_DURATION; duration_seconds = MIN_HAPTIC_DURATION;
} else { } else {
duration_seconds = time_ns_to_s(value->vibration.duration); duration_seconds = time_ns_to_s(value->vibration.duration_ns);
} }
float frequency = value->vibration.frequency; float frequency = value->vibration.frequency;
@ -366,7 +366,7 @@ survive_controller_haptic_pulse(struct survive_device *survive, union xrt_output
float amplitude = value->vibration.amplitude; float amplitude = value->vibration.amplitude;
SURVIVE_TRACE(survive, "Got Haptic pulse amp %f, %fHz, %" PRId64 "ns", value->vibration.amplitude, SURVIVE_TRACE(survive, "Got Haptic pulse amp %f, %fHz, %" PRId64 "ns", value->vibration.amplitude,
value->vibration.frequency, value->vibration.duration); value->vibration.frequency, value->vibration.duration_ns);
SURVIVE_TRACE(survive, "Doing Haptic pulse amp %f, %fHz, %fs", amplitude, frequency, duration_seconds); SURVIVE_TRACE(survive, "Doing Haptic pulse amp %f, %fHz, %fs", amplitude, frequency, duration_seconds);
return survive_simple_object_haptic((struct SurviveSimpleObject *)survive->survive_obj, frequency, amplitude, return survive_simple_object_haptic((struct SurviveSimpleObject *)survive->survive_obj, frequency, amplitude,

View file

@ -421,11 +421,11 @@ static int
vive_controller_haptic_pulse(struct vive_controller_device *d, union xrt_output_value *value) vive_controller_haptic_pulse(struct vive_controller_device *d, union xrt_output_value *value)
{ {
float duration_seconds; float duration_seconds;
if (value->vibration.duration == XRT_MIN_HAPTIC_DURATION) { if (value->vibration.duration_ns == XRT_MIN_HAPTIC_DURATION) {
VIVE_TRACE(d, "Haptic pulse duration: using %f minimum", MIN_HAPTIC_DURATION); VIVE_TRACE(d, "Haptic pulse duration: using %f minimum", MIN_HAPTIC_DURATION);
duration_seconds = MIN_HAPTIC_DURATION; duration_seconds = MIN_HAPTIC_DURATION;
} else { } else {
duration_seconds = time_ns_to_s(value->vibration.duration); duration_seconds = time_ns_to_s(value->vibration.duration_ns);
} }
VIVE_TRACE(d, "Haptic pulse amp %f, %fHz, %fs", value->vibration.amplitude, value->vibration.frequency, VIVE_TRACE(d, "Haptic pulse amp %f, %fHz, %fs", value->vibration.amplitude, value->vibration.frequency,

View file

@ -12,7 +12,6 @@
#pragma once #pragma once
#include "xrt/xrt_compiler.h" #include "xrt/xrt_compiler.h"
#include "util/u_time.h"
#include "xrt/xrt_results.h" #include "xrt/xrt_results.h"
@ -1052,7 +1051,7 @@ union xrt_output_value {
{ {
float frequency; float frequency;
float amplitude; float amplitude;
time_duration_ns duration; int64_t duration_ns;
} vibration; } vibration;
}; };

View file

@ -1774,7 +1774,7 @@ set_action_output_vibration(struct oxr_session *sess,
union xrt_output_value value = {0}; union xrt_output_value value = {0};
value.vibration.frequency = data->frequency; value.vibration.frequency = data->frequency;
value.vibration.amplitude = data->amplitude; value.vibration.amplitude = data->amplitude;
value.vibration.duration = data->duration; value.vibration.duration_ns = data->duration;
for (uint32_t i = 0; i < cache->output_count; i++) { for (uint32_t i = 0; i < cache->output_count; i++) {
struct oxr_action_output *output = &cache->outputs[i]; struct oxr_action_output *output = &cache->outputs[i];

View file

@ -1237,9 +1237,9 @@ CServerDriver_Monado::HandleHapticEvent(vr::VREvent_t *event)
union xrt_output_value out; union xrt_output_value out;
out.vibration.amplitude = amp; out.vibration.amplitude = amp;
if (duration > 0.00001) { if (duration > 0.00001) {
out.vibration.duration = (time_duration_ns)(duration * 1000.f * 1000.f * 1000.f); out.vibration.duration_ns = (time_duration_ns)(duration * 1000.f * 1000.f * 1000.f);
} else { } else {
out.vibration.duration = XRT_MIN_HAPTIC_DURATION; out.vibration.duration_ns = XRT_MIN_HAPTIC_DURATION;
} }
out.vibration.frequency = freq; out.vibration.frequency = freq;