For various reasons I won’t get into, I have a program I need to run that uses a USB joystick (actually a USB gamepad but the psychopy joystick functions) on MacOS Mavericks (I don’t think version matters for this). I’ve run into an interesting combination of issues.
The pyglet joystick interface flat doesn’t work on OSX/MacOS, and never has, as far as I can tell. See: https://groups.google.com/forum/#!topic/psychopy-users/GWNE4RvGbRE This was not fixed in the recent updated to pyglet 1.2, as I am using the most recent version of psychopy and get the exact same error if I try to initialize a joystick and a pyglet window and call win.flip(). That error, for reference: AttributeError: ‘PygletDevice’ object has no attribute ‘dispatch_events’
Simple fix, use pygame to control the joystick. Unfortunately you can’t have the window and the joystick control be different (you just don’t get any of the inputs from the joystick if you try this), so it has to be a pygame window as well.
Pygame is doing something ridiculous with refresh rates and I can’t figure out how to force it to run at 60Hz. I’m using a mid-2012 Macbook pro and it’s reporting an ‘actual frame rate’ of 140Hz, and running all of my stimuli at (slightly more than) double speed.
I can make some ugly workarounds that use clock timing rather than frame timing, but this seems like a problem that should be fixable from one of two directions, either by finding a way to get a pyglet window that still works with joystick inputs, or by locking pygame’s refresh rate. Any suggestions?