-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1ff9067
commit c6b0395
Showing
2 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env gjs | ||
|
||
const GOpenHMD = imports.gi.GOpenHMD; | ||
|
||
|
||
function devs_info(context) { | ||
devs = context.enumerate() | ||
|
||
for (var i = 0; i < devs.length; i++) { | ||
print("Discovered device:" + | ||
` vendor: '${devs[i].vendor}'` + | ||
` product': '${devs[i].product}'`) | ||
} | ||
} | ||
|
||
|
||
function dev_quat_info(context, dev) { | ||
context.update(); | ||
var quat = dev.rotation_quat(); | ||
console.debug(`quat: x=${quat.x}, y=${quat.y}, z=${quat.z}, w=${quat.w}`); | ||
GOpenHMD.sleep(0.01); | ||
} | ||
|
||
|
||
print(`Version: ${GOpenHMD.version().to_string()}`) | ||
|
||
var context = new GOpenHMD.Context(); | ||
|
||
devs_info(context); | ||
|
||
var dev = context.open_device(0, null) | ||
|
||
for(var i = 0; i < 300; i++){ | ||
dev_quat_info(context, dev) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import gi | ||
|
||
gi.require_version('GOpenHMD', '1.0') | ||
from gi.repository import GOpenHMD | ||
|
||
|
||
def devs_info(context): | ||
for dev in context.enumerate(): | ||
print(f"Discovered device: vendor '{dev.get_vendor()}'" | ||
f", product '{dev.get_product()}'" | ||
) | ||
|
||
|
||
def dev_quat_info(context, dev): | ||
context.update() | ||
quat = dev.rotation_quat() | ||
print(f"quat: x={quat.x} y={quat.y} z={quat.z} w={quat.w}") | ||
GOpenHMD.sleep(0.01) | ||
|
||
|
||
print(f"Version: {GOpenHMD.version().to_string()}") | ||
|
||
context = GOpenHMD.Context() | ||
|
||
devs_info(context) | ||
|
||
dev = context.open_device(0) | ||
|
||
for i in range(0, 300): | ||
dev_quat_info(context, dev) |