Fix gamepad code to match latest spec

I tested that this works in latest Firefox Nightly, Chrome Release and Chrome Canary. Non-standard gamepad mapping is still a problem, but that's a separate issue.