diff --git a/wayvr/src/backend/openxr/helpers.rs b/wayvr/src/backend/openxr/helpers.rs index 84e9e9ce..d2c475eb 100644 --- a/wayvr/src/backend/openxr/helpers.rs +++ b/wayvr/src/backend/openxr/helpers.rs @@ -41,6 +41,11 @@ pub(super) fn init_xr() -> Result<(xr::Instance, xr::SystemId), anyhow::Error> { } else { log::warn!("Missing EXT_dpad_binding extension."); } + if available_extensions.ext_samsung_odyssey_controller { + enabled_extensions.ext_samsung_odyssey_controller = true; + } else { + log::warn!("Missing XR_EXT_samsung_odyssey_controller extension."); + } if available_extensions.ext_hp_mixed_reality_controller { enabled_extensions.ext_hp_mixed_reality_controller = true; } else { diff --git a/wayvr/src/backend/openxr/input.rs b/wayvr/src/backend/openxr/input.rs index 5dbd517a..72b67616 100644 --- a/wayvr/src/backend/openxr/input.rs +++ b/wayvr/src/backend/openxr/input.rs @@ -656,7 +656,7 @@ fn suggest_bindings(instance: &xr::Instance, hands: &mut [&mut OpenXrHandSource; let profiles = load_xr_input_profiles(); for profile in profiles { - log::warn!("Loading profile {}", &profile.profile); + log::debug!("Loading profile {}", &profile.profile); let Ok(profile_path) = instance.string_to_path(&profile.profile) else { log::warn!("Profile not supported: {}", profile.profile); @@ -720,8 +720,7 @@ fn suggest_bindings(instance: &xr::Instance, hands: &mut [&mut OpenXrHandSource; .suggest_interaction_profile_bindings(profile_path, &bindings) .is_err() { - log::error!("Bad bindings for {}", &profile.profile[22..]); - log::error!("Verify config: ~/.config/wayvr/openxr_actions.json5"); + log::warn!("Could not apply bindings for {}", &profile.profile[22..]); } else { log::debug!( "Bindings for {} bound successfully.", diff --git a/wlx-common/assets/openxr_actions.json5 b/wlx-common/assets/openxr_actions.json5 index 3b6a17a2..155cfb88 100644 --- a/wlx-common/assets/openxr_actions.json5 +++ b/wlx-common/assets/openxr_actions.json5 @@ -380,11 +380,11 @@ right: "/user/hand/right/input/thumbstick/x" }, show_hide: { - left: "/user/hand/left/input/system/click", + left: "/user/hand/left/input/menu/click", }, space_drag: { double_click: true, - right: "/user/hand/left/input/system/click", + right: "/user/hand/left/input/menu/click", }, move_mouse: { left: "/user/hand/left/input/trigger/value", diff --git a/wlx-common/src/openxr_bindings_schema.rs b/wlx-common/src/openxr_bindings_schema.rs index 9c482123..93012080 100644 --- a/wlx-common/src/openxr_bindings_schema.rs +++ b/wlx-common/src/openxr_bindings_schema.rs @@ -106,6 +106,16 @@ pub enum XrInputComponent { #[strum(props(Translation = "APP_SETTINGS.BINDINGS.COMP.Y_AXIS"))] Y, + // thumbstick/trackpad d-pad bindings via EXT_dpad_binding + #[strum(props(Translation = "APP_SETTINGS.BINDINGS.TYPE.DPAD_UP"))] + DpadUp, + #[strum(props(Translation = "APP_SETTINGS.BINDINGS.TYPE.DPAD_DOWN"))] + DpadDown, + #[strum(props(Translation = "APP_SETTINGS.BINDINGS.TYPE.DPAD_LEFT"))] + DpadLeft, + #[strum(props(Translation = "APP_SETTINGS.BINDINGS.TYPE.DPAD_RIGHT"))] + DpadRight, + // below are hidden Pose, } diff --git a/wlx-common/src/openxr_controller_profiles.rs b/wlx-common/src/openxr_controller_profiles.rs index 9c77da11..fa49046a 100644 --- a/wlx-common/src/openxr_controller_profiles.rs +++ b/wlx-common/src/openxr_controller_profiles.rs @@ -61,6 +61,10 @@ const VALVE_INDEX_USER_PATHS: &[XrInputSubpath] = &[ XrInputComponent::Touch, XrInputComponent::X, XrInputComponent::Y, + XrInputComponent::DpadUp, + XrInputComponent::DpadDown, + XrInputComponent::DpadLeft, + XrInputComponent::DpadRight, ], }, XrInputSubpath { @@ -70,6 +74,10 @@ const VALVE_INDEX_USER_PATHS: &[XrInputSubpath] = &[ XrInputComponent::Touch, XrInputComponent::X, XrInputComponent::Y, + XrInputComponent::DpadUp, + XrInputComponent::DpadDown, + XrInputComponent::DpadLeft, + XrInputComponent::DpadRight, ], }, XrInputSubpath { @@ -154,6 +162,10 @@ static VALVE_FRAME_CONTROLLER_VALVE_RIGHT_USER_PATHS: &[XrInputSubpath] = &[ XrInputComponent::Touch, XrInputComponent::X, XrInputComponent::Y, + XrInputComponent::DpadUp, + XrInputComponent::DpadDown, + XrInputComponent::DpadLeft, + XrInputComponent::DpadRight, ], }, XrInputSubpath { @@ -222,6 +234,10 @@ static VALVE_FRAME_CONTROLLER_VALVE_LEFT_USER_PATHS: &[XrInputSubpath] = &[ XrInputComponent::Touch, XrInputComponent::X, XrInputComponent::Y, + XrInputComponent::DpadUp, + XrInputComponent::DpadDown, + XrInputComponent::DpadLeft, + XrInputComponent::DpadRight, ], }, XrInputSubpath { @@ -282,6 +298,10 @@ const OCULUS_TOUCH_LEFT_USER_PATHS: &[XrInputSubpath] = &[ XrInputComponent::Touch, XrInputComponent::X, XrInputComponent::Y, + XrInputComponent::DpadUp, + XrInputComponent::DpadDown, + XrInputComponent::DpadLeft, + XrInputComponent::DpadRight, ], }, XrInputSubpath { @@ -330,6 +350,10 @@ const OCULUS_TOUCH_RIGHT_USER_PATHS: &[XrInputSubpath] = &[ XrInputComponent::Touch, XrInputComponent::X, XrInputComponent::Y, + XrInputComponent::DpadUp, + XrInputComponent::DpadDown, + XrInputComponent::DpadLeft, + XrInputComponent::DpadRight, ], }, XrInputSubpath { @@ -389,7 +413,15 @@ const HP_MIXED_REALITY_LEFT_USER_PATHS: &[XrInputSubpath] = &[ }, XrInputSubpath { kind: XrInputSubpathKind::Thumbstick, - components: &[XrInputComponent::Click, XrInputComponent::X, XrInputComponent::Y], + components: &[ + XrInputComponent::Click, + XrInputComponent::X, + XrInputComponent::Y, + XrInputComponent::DpadUp, + XrInputComponent::DpadDown, + XrInputComponent::DpadLeft, + XrInputComponent::DpadRight, + ], }, XrInputSubpath { kind: XrInputSubpathKind::Grip, @@ -428,7 +460,15 @@ const HP_MIXED_REALITY_RIGHT_USER_PATHS: &[XrInputSubpath] = &[ }, XrInputSubpath { kind: XrInputSubpathKind::Thumbstick, - components: &[XrInputComponent::Click, XrInputComponent::X, XrInputComponent::Y], + components: &[ + XrInputComponent::Click, + XrInputComponent::X, + XrInputComponent::Y, + XrInputComponent::DpadUp, + XrInputComponent::DpadDown, + XrInputComponent::DpadLeft, + XrInputComponent::DpadRight, + ], }, XrInputSubpath { kind: XrInputSubpathKind::Grip, @@ -446,7 +486,7 @@ const HP_MIXED_REALITY_RIGHT_USER_PATHS: &[XrInputSubpath] = &[ pub const SAMSUNG_ODYSSEY_CONTROLLER_PROFILE: XrControllerProfile = XrControllerProfile { display_name: "Samsung Odyssey Controller", - extension: None, + extension: Some("XR_EXT_samsung_odyssey_controller"), profile_id: "/interaction_profiles/samsung/odyssey_controller", user_paths: &[ XrControllerUserPath { @@ -475,7 +515,15 @@ const SAMSUNG_ODYSSEY_USER_PATHS: &[XrInputSubpath] = &[ }, XrInputSubpath { kind: XrInputSubpathKind::Thumbstick, - components: &[XrInputComponent::Click, XrInputComponent::X, XrInputComponent::Y], + components: &[ + XrInputComponent::Click, + XrInputComponent::X, + XrInputComponent::Y, + XrInputComponent::DpadUp, + XrInputComponent::DpadDown, + XrInputComponent::DpadLeft, + XrInputComponent::DpadRight, + ], }, XrInputSubpath { kind: XrInputSubpathKind::Trackpad, @@ -484,6 +532,10 @@ const SAMSUNG_ODYSSEY_USER_PATHS: &[XrInputSubpath] = &[ XrInputComponent::Touch, XrInputComponent::X, XrInputComponent::Y, + XrInputComponent::DpadUp, + XrInputComponent::DpadDown, + XrInputComponent::DpadLeft, + XrInputComponent::DpadRight, ], }, XrInputSubpath { @@ -540,6 +592,10 @@ const HTC_VIVE_USER_PATHS: &[XrInputSubpath] = &[ XrInputComponent::Touch, XrInputComponent::X, XrInputComponent::Y, + XrInputComponent::DpadUp, + XrInputComponent::DpadDown, + XrInputComponent::DpadLeft, + XrInputComponent::DpadRight, ], }, XrInputSubpath { @@ -587,7 +643,15 @@ const MICROSOFT_MOTION_CONTROLLER_USER_PATHS: &[XrInputSubpath] = &[ }, XrInputSubpath { kind: XrInputSubpathKind::Thumbstick, - components: &[XrInputComponent::Click, XrInputComponent::X, XrInputComponent::Y], + components: &[ + XrInputComponent::Click, + XrInputComponent::X, + XrInputComponent::Y, + XrInputComponent::DpadUp, + XrInputComponent::DpadDown, + XrInputComponent::DpadLeft, + XrInputComponent::DpadRight, + ], }, XrInputSubpath { kind: XrInputSubpathKind::Trackpad, @@ -596,6 +660,10 @@ const MICROSOFT_MOTION_CONTROLLER_USER_PATHS: &[XrInputSubpath] = &[ XrInputComponent::Touch, XrInputComponent::X, XrInputComponent::Y, + XrInputComponent::DpadUp, + XrInputComponent::DpadDown, + XrInputComponent::DpadLeft, + XrInputComponent::DpadRight, ], }, XrInputSubpath { @@ -639,7 +707,15 @@ const KHR_GENERIC_CONTROLLER_USER_PATHS: &[XrInputSubpath] = &[ }, XrInputSubpath { kind: XrInputSubpathKind::Thumbstick, - components: &[XrInputComponent::Click, XrInputComponent::X, XrInputComponent::Y], + components: &[ + XrInputComponent::Click, + XrInputComponent::X, + XrInputComponent::Y, + XrInputComponent::DpadUp, + XrInputComponent::DpadDown, + XrInputComponent::DpadLeft, + XrInputComponent::DpadRight, + ], }, XrInputSubpath { kind: XrInputSubpathKind::Squeeze,