The open source OpenXR runtime
0
fork

Configure Feed

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

st/oxr: handle xrt_device_set_output returned result

Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2360>

+31 -8
+27 -7
src/xrt/state_trackers/oxr/oxr_input.c
··· 893 893 struct oxr_action_output *output = &cache->outputs[i]; 894 894 struct xrt_device *xdev = output->xdev; 895 895 896 - xrt_device_set_output(xdev, output->name, &value); 896 + xrt_result_t xret = xrt_device_set_output(xdev, output->name, &value); 897 + if (xret != XRT_SUCCESS) { 898 + struct oxr_sink_logger slog = {0}; 899 + oxr_slog(&slog, "Failed to stop output "); 900 + u_pp_xrt_output_name(oxr_slog_dg(&slog), output->name); 901 + oxr_log_slog(log, &slog); 902 + } 897 903 } 898 904 } 899 905 ··· 2189 2195 */ 2190 2196 2191 2197 static void 2192 - set_action_output_vibration(struct oxr_session *sess, 2198 + set_action_output_vibration(struct oxr_logger *log, 2199 + struct oxr_session *sess, 2193 2200 struct oxr_action_cache *cache, 2194 2201 int64_t stop, 2195 2202 const XrHapticVibration *data) ··· 2206 2213 struct oxr_action_output *output = &cache->outputs[i]; 2207 2214 struct xrt_device *xdev = output->xdev; 2208 2215 2209 - xrt_device_set_output(xdev, output->name, &value); 2216 + xrt_result_t xret = xrt_device_set_output(xdev, output->name, &value); 2217 + if (xret != XRT_SUCCESS) { 2218 + struct oxr_sink_logger slog = {0}; 2219 + oxr_slog(&slog, "Failed to set output vibration "); 2220 + u_pp_xrt_output_name(oxr_slog_dg(&slog), output->name); 2221 + oxr_log_slog(log, &slog); 2222 + } 2210 2223 } 2211 2224 } 2212 2225 2213 2226 XRT_MAYBE_UNUSED static void 2214 - set_action_output_vibration_pcm(struct oxr_session *sess, 2227 + set_action_output_vibration_pcm(struct oxr_logger *log, 2228 + struct oxr_session *sess, 2215 2229 struct oxr_action_cache *cache, 2216 2230 const XrHapticPcmVibrationFB *data) 2217 2231 { ··· 2227 2241 struct oxr_action_output *output = &cache->outputs[i]; 2228 2242 struct xrt_device *xdev = output->xdev; 2229 2243 2230 - xrt_device_set_output(xdev, output->name, &value); 2244 + xrt_result_t xret = xrt_device_set_output(xdev, output->name, &value); 2245 + if (xret != XRT_SUCCESS) { 2246 + struct oxr_sink_logger slog = {0}; 2247 + oxr_slog(&slog, "Failed to set output vibration PCM "); 2248 + u_pp_xrt_output_name(oxr_slog_dg(&slog), output->name); 2249 + oxr_log_slog(log, &slog); 2250 + } 2231 2251 } 2232 2252 } 2233 2253 ··· 2264 2284 2265 2285 #define SET_OUT_VIBRATION(X) \ 2266 2286 if (act_attached->X.current.active && (subaction_paths.X || subaction_paths.any)) { \ 2267 - set_action_output_vibration(sess, &act_attached->X, stop_ns, data); \ 2287 + set_action_output_vibration(log, sess, &act_attached->X, stop_ns, data); \ 2268 2288 } 2269 2289 2270 2290 OXR_FOR_EACH_SUBACTION_PATH(SET_OUT_VIBRATION) ··· 2275 2295 2276 2296 #define SET_OUT_VIBRATION(X) \ 2277 2297 if (act_attached->X.current.active && (subaction_paths.X || subaction_paths.any)) { \ 2278 - set_action_output_vibration_pcm(sess, &act_attached->X, data); \ 2298 + set_action_output_vibration_pcm(log, sess, &act_attached->X, data); \ 2279 2299 } 2280 2300 2281 2301 OXR_FOR_EACH_SUBACTION_PATH(SET_OUT_VIBRATION)
+4 -1
src/xrt/state_trackers/oxr/oxr_session.c
··· 1460 1460 result.force_feedback.force_feedback[i].value = locations->locations[i].value; 1461 1461 } 1462 1462 1463 - xrt_device_set_output(xdev, xr_hand_to_force_feedback_output(hand_tracker->hand), &result); 1463 + xrt_result_t xret = xrt_device_set_output(xdev, xr_hand_to_force_feedback_output(hand_tracker->hand), &result); 1464 + if (xret != XRT_SUCCESS) { 1465 + return oxr_error(log, XR_ERROR_RUNTIME_FAILURE, "xr_device_set_output failed"); 1466 + } 1464 1467 1465 1468 return XR_SUCCESS; 1466 1469 }