HID gamepad compatibel with iohub?

Skip to first unread message

Tim Hendrickson

May 8, 2014, 6:14:47 PM5/8/14
to psychop...@googlegroups.com

I am wondering if there is any support for a HID gamepad with iohub?
I have looked at the documentation and based on what I am viewing it appears that just xinput controllers are compatible.
Has this been updated at all?


Sol Simpson

May 9, 2014, 2:43:32 PM5/9/14
to psychop...@googlegroups.com
There is no HID gamepad support in iohub. Adding it would be possible, but I have no idea when if the programming was being done by myself. Sorry.  

Jonathan Peirce

May 10, 2014, 4:36:00 AM5/10/14
to psychop...@googlegroups.com
Tim, PsychoPy includes iolab's implementation of an hid driver in python. You might be able to work out a low-level way to get events from the joystick.
You'll have to work out what device yours is (keyboards and mice will be showing up here too) so try connecting you joystick and checking the existing devices before and after.
Then it looks like these devices have the option to set a function for a callback when new data appear on the device, so create a function to use that. I have no idea what the data back will look like though! The below is untested but should get you going.


from ioLabs import hid
from psychopy import visual, event

win = visual.Window([800,800])
msg = visual.TextStim(win, msg='nothing yet')

def gotNewData(newData):

#you need to work out what your device is
devs = hid.find_hid_devices()
for this Dev in devs:
    print thisDev.vendor, thisDev.product
    if thisDev.vendor == joystickVendorID:
        joy = thisDev

#now set calllback

while len(event.getKeys())==0: #press a key to quit
You received this message because you are subscribed to the Google Groups "psychopy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to psychopy-user...@googlegroups.com.
To post to this group, send email to psychop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/psychopy-users/7bdf0cc2-8a73-4028-bc69-b61b8545cd25%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jonathan Peirce
Nottingham Visual Neuroscience

Reply all
Reply to author
0 new messages