inputs
inputs copied to clipboard
Max CPU usage on gamepad.read()
from inputs import devices
gamepad = devices.gamepads[0]
while True:
print(gamepad.read())
^ with a 360 controller plugged in that uses 100% of 1 core.
And I found the offending line: https://github.com/zeth/inputs/blob/master/inputs.py#L2191
I don't know enough about how device input is handled to fix it beyond here, but I think it shouldn't loop forever and continually check state.
Man I cannot believe this is not higher up. That method was wrecking my CPU usage and all it needed was a single time.sleep(0.01)