Closed Bug 1107801 Opened 11 years ago Closed 11 years ago

Improve gamepad support on MacOS

Categories

(Core :: Hardware Abstraction Layer (HAL), defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla39
Tracking Status
firefox39 --- fixed

People

(Reporter: rbarker, Assigned: rbarker)

Details

Attachments

(1 file, 2 obsolete files)

On MacOS, the gamepad API does not support a number of buttons on the device. Buttons missing include: left and right shoulder triggers, home and back button, thumb stick buttons. Additionally, analog buttons are not supported.
Attached patch Gamepad patch v1 (obsolete) — Splinter Review
Comment on attachment 8532371 [details] [diff] [review] Gamepad patch v1 While playing with the gamepad API on MacOS, I encountered a crash in nightly when a thumb stick button was pressed. The code was hitting an assert because the button ids on MacOS are not sequential. While fixing this issue I noticed the full gamepad was not supported. This patch adds missing buttons and adds support for analog buttons. I think the d-pad/hatswitch is the only thing not supported now.
Attachment #8532371 - Flags: feedback?(ted)
Assignee: nobody → rbarker
Attached patch Gamepad patch v2 (obsolete) — Splinter Review
Added dpad support from :ted
Attachment #8532371 - Attachment is obsolete: true
Attachment #8532371 - Flags: feedback?(ted)
Comment on attachment 8532733 [details] [diff] [review] Gamepad patch v2 Updated patch to include dpad support.
Attachment #8532733 - Flags: review?(ted)
Comment on attachment 8532733 [details] [diff] [review] Gamepad patch v2 Review of attachment 8532733 [details] [diff] [review]: ----------------------------------------------------------------- Thanks for fixing this up! ::: hal/cocoa/CocoaGamepad.cpp @@ +32,5 @@ > + id(aId), > + analog((aMax - aMin) > 1), > + element(aElement), > + min(aMin), > + max(aMax) {;} The semicolon here seems extraneous. @@ +90,5 @@ > // Index given by our superclass. > uint32_t mSuperIndex; > > + const bool isDpad(IOHIDElementRef element) const > + { The positioning of open curly braces is inconsistent with the rest of the file. I don't know what the Mozilla style guide recommends, but can you figure that out and just make them all match the style guide? @@ +173,5 @@ > + usage == kBrakeUsage)) || > + (usagePage == kButtonUsagePage) || > + (usagePage == kConsumerPage && > + (usage == kHomeUsage || > + usage == kBackUsage))) { This is pretty depressing, but that's life with the USB HID.
Attachment #8532733 - Flags: review?(ted) → review+
(In reply to Randall Barker [:rbarker] from comment #0) > On MacOS, the gamepad API does not support a number of buttons on the > device. Buttons missing include: left and right shoulder triggers, home and > back button, thumb stick buttons. Additionally, analog buttons are not > supported. To clarify: USB HID is weird, and devices make use of it in weird ways, and Randall was testing with a controller that I don't have that does things in an exceptionally weird way.
I bet we want a similar fix on Windows. If you have access to a Windows machine I could point you at what to fix. If not I might just have to get one of those controllers.
Were you going to land this? I got one of these gamepads and was playing around with it and it still crashes. :-(
Flags: needinfo?(rbarker)
(In reply to Ted Mielczarek [:ted.mielczarek] from comment #9) > Were you going to land this? I got one of these gamepads and was playing > around with it and it still crashes. :-( Yes, I saw that the e10s work was being done and files were being moved around and was going to update the patch after than landed. Should I stop waiting and just land?
Flags: needinfo?(rbarker)
Yeah, just land it, qdot can rebase around your changes.
Rebased to latest code. Addressed comments. Carry forward r+ from :ted.mielczarek
Attachment #8532733 - Attachment is obsolete: true
Keywords: checkin-needed
Relanded in https://hg.mozilla.org/integration/mozilla-inbound/rev/242d0bc4a44c as the failure happened on another repository where this patch didn't exist, so this couldn't be at fault. Sorry for jumping the gun.
Flags: needinfo?(ted)
Flags: needinfo?(rbarker)
Given the test that was failing I don't blame you!
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla39
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: