ioHub not recording key presses

Hi all! I am fighting with a very weird issue that I am struggling to even know where to start debugging. For context, I’m running on a Mac M4 with Sequoia 15.5, Python 3.10.18, psychopy 2025.1.1.

I had a script that was running beautifully, when middle of an experiment, it stopped collecting keypresses. We’ve got (admittedly complex) code using an ioHub backend (essentially using like the documentation). The only thing that changed was removing an ethernet connection to a different machine during the experiment (but it didn’t seem like there were any angry output messages when we did this).

Now, even when just running a simple test experiment locally on my laptop, ioHub will not collect keypresses. It doesn’t spit out any errors, the value of keyboard.reporting is consistently True, but it does not record any key presses.

I double checked and I’ve given both PsychoPy and Terminal access to Input Monitoring and Accessibility (in Privacy and Security settings), and a different script that uses the general psychopy.event.getKeys function is able to get keyboard input, so it seems like it’s specific to ioHub and isn’t that I have miraculously broken keyboard input.

If anyone has any ideas what might have gone wrong or even a hint on how I could start debugging, that would be incredibly helpful!

Does this occur with a known working keyboard?
Is there any other devices connected to the computer (aside from a mouse)? I had a similar issue happen when I have my eyetracker connected.
Have you tried changing the keyboard backed to pyglet and seeing if the issue occurs?

Issac

Hi Issac -

To answer a few of your questions in one - we initially had another computer system connected via USB-C (we were testing a real time fMRI experiment). The weirdest thing was that it was working perfectly until we unplugged the USB-C briefly (to avoid getting triggers from the pre-scan) and then it stopped getting any keyboard input from the code. Tried restarting the computer and no luck.

I tried changing the backend to the general psychopy.event.getKeys and it works perfectly again, so it does seem to be specific to the ioHub backend.

Changing the backend was a decent solution in this case, but I don’t love not knowing what happened and why it broke, since no settings seem to have changed and it’s clearly not a keyboard issue in general (since the other backend works).

Catherine

Ya, I was also frustrated by not fully understanding why the iOhub backend has issues with regarding multiple non-mouse/keyboard devices.

After extensive testing, the best reasoning I could come up with is an issue with how the USB ports/hubs are labelled (also what devices and kind of devices are connected), AND what type of USB port it is (1.0,2.0,3.0,3.x, C). For non-standard devices (eye-trackers, TMS, fMRI, other systems for timing) there seems to some confusion as to what is the keyboard, and then psychopy kind of just gives up. This is probably an artifact from when triggers and devices would usually be sent/received via serial port on the motherboard rather than usb.
One other solution is to make sure each device is connected to a different USB hub (the usb ports on your computer are grouped into different hubs/controllers) and that MAY provide a solution if you need to go back to iohub for whatever reason.
When you disconnected the USB-C, some of the naming/identification got messed up. A possible fix to this is to connect all the devices, then in your device manager window (I’m not sure what the iOS equivalent is) remove/forget the drivers for the usb devices. Then unplug and plug back in and reinstall the device drivers. Although I would caution trying this unless you are familiar with what drivers are needed and how to properly reinstall them.
Pic for reference of the device window I am referring to (Windows)

Issac