question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

EVRButtonId is always 0(k_EButton_System)

See original GitHub issue

While I keep runningpollNextEvent(event), event.data.controller.button or EVRButtonId is always zero even though I press different buttons. Am I missing something?

Regarding EVREventType, event.eventType shows 200 or VREvent_ButtonPress, which seems fine.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
tomgoddardcommented, Oct 26, 2018

Here is a patch to openvr/init.py (version 1.0.1301) to add pack = 4 to VREvent_t on Linux so that VR controller button press events have correct values for event.data.controller.button that identify which button is pressed. The patch is the same as was done for VRControllerState_t in pyopenvr 1.0.1301. I’ve tested this on CentOS 7 and Ubuntu 18.0.4. I attach the patch as a zip file because GitHub will not accept attachments with suffix .patch.

openvr_linux_button.patch.zip

1reaction
daniel5ghcommented, Jul 7, 2017

That’s good to hear!

For a permanent solution we may need to add _pack_ = 4 to the relevant structs when Linux or OSX. As opposed to the C# here in Python we can just to that and runtime when Linux or OSX, so we don’t need such an elaborate solution using the union like in C#.

Judging from the “Terrible Hack” comments in https://github.com/ValveSoftware/openvr/blob/bcac1bfbe2be3c1ff37e4f62b8e412fcdf29248e/headers/openvr_api.cs I think these are VRControllerState_t and VREvent_t.

But looking at https://github.com/cmbruns/pyopenvr/blob/1c4fefe/src/translate/openvr_capi.h I see two more structs that are aligned on 4 bytes using pragma pack when Linux or OSX: RenderModel_TextureMap_t and RenderModel_t.

@cmbruns What do you think?

Read more comments on GitHub >

github_iconTop Results From Across the Web

EVRButtonId is always 0(k_EButton_System) #569 - GitHub
While I keep runningPollNextEvent, EVRButtonId (under event's data -> controller -> button) is always zero even though I press different ...
Read more >
Enum EVRButtonId | SteamVR Unity Plugin
Enum EVRButtonId. Namespace: Valve.VR. Assembly: Assembly-CSharp.dll. Syntax. public enum EVRButtonId. Fields. Name, Description. k_EButton_A.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found