Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# hidtest.py - Basic test of PsychHID for Python
# Also tests WaitSecs, as it is utilized here.
#
# The test will be subject to change without notice, it is throwaway wip code.
#
# (c) 2019 Jon Peirce - Licensed under MIT license.
# (c) 2018 Mario Kleiner - Licensed under MIT license.
from psychtoolbox import hid
import psychtoolbox as ptb
print("Devices:")
for dev in hid.devices():
print(" %(index)s: %(product)s "
"usagePageValue=%(usagePageValue)s, usageValue=%(usageValue)s"
% dev)
print("Keyboards:")
kbIDs, kbNames, kbDevices = hid.get_keyboard_indices()
for dev in kbDevices:
print(" %(index)s: %(product)s" % dev)
def run():
dev = kbDevices[0]
# KbQueueTest
ptb.WaitSecs('YieldSecs', 1)
keyboard = hid.Keyboard(dev['index'])