How could i get the information of KeyUp?

I wanna the participant to press a key to start the trial,and continue pressing the key until the participant see a signal. It is just like the oddball task, but change the reaction ‘press a key’ by ‘release a key’.

So i need to get the KeyUp information as well as KeyDown.

How could i get those information in Psychopy function?
Ps: I am considing using joystick, so the same question of the button of joystick.

Look for demos and documentation for iohub . It provides keyup messages.

It works, thinks very much.