Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(425)

Issue 14328036: Implement support for USB Xbox360 controllers without a driver on Mac. (Closed)

Created:
7 years, 8 months ago by jeremya
Modified:
7 years, 7 months ago
CC:
chromium-reviews, joi+watch-content_chromium.org, darin-cc_chromium.org, jam, sail+watch_chromium.org, chrome-apps-syd-reviews_chromium.org
Visibility:
Public.

Description

Implement support for USB Xbox360 controllers without a driver on Mac. Without this patch, users have to install a driver that exposes a standard HID device for the controller. Unfortunately, apart from the problems with requiring users to install a driver, the only such available driver (http://tattiebogle.net/index.php/ProjectRoot/Xbox360Controller/OsxDriver) crashes the kernel when the controller is unplugged. This change uses IOKit to talk directly to the Xbox controller without the need for a driver, and exposes it through the normal HTML5 gamepad API. BUG=232238 R=scottmg@chromium.org Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=201717

Patch Set 1 : . #

Total comments: 18

Patch Set 2 : comments #

Total comments: 18

Patch Set 3 : comments #

Patch Set 4 : fix compile #

Total comments: 2

Patch Set 5 : CFCastStrict #

Total comments: 106

Patch Set 6 : addressed mark's comments #

Total comments: 4

Patch Set 7 : rebase & comments #

Patch Set 8 : move conversions back to xbox-specific code; #if out the TYPE_UI stuff just for mac. #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+1095 lines, -61 lines) Patch
M base/base.gypi View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
A base/mac/scoped_ioplugininterface.h View 1 2 3 4 5 1 chunk +76 lines, -0 lines 0 comments Download
M content/browser/gamepad/gamepad_platform_data_fetcher_mac.h View 1 2 3 4 5 3 chunks +33 lines, -9 lines 0 comments Download
M content/browser/gamepad/gamepad_platform_data_fetcher_mac.mm View 1 2 3 4 5 6 7 10 chunks +178 lines, -50 lines 0 comments Download
M content/browser/gamepad/gamepad_provider.cc View 1 2 3 4 5 6 7 1 chunk +11 lines, -2 lines 0 comments Download
A content/browser/gamepad/xbox_data_fetcher_mac.h View 1 2 3 4 5 6 7 1 chunk +167 lines, -0 lines 0 comments Download
A content/browser/gamepad/xbox_data_fetcher_mac.cc View 1 2 3 4 5 6 7 1 chunk +627 lines, -0 lines 1 comment Download
M content/content_browser.gypi View 1 2 3 4 5 6 1 chunk +2 lines, -0 lines 0 comments Download

Messages

Total messages: 26 (0 generated)
jeremya
7 years, 8 months ago (2013-04-19 06:26:26 UTC) #1
scottmg
cool. i tried to apply to test, but doesn't build because of the recent removal ...
7 years, 8 months ago (2013-04-19 17:03:50 UTC) #2
jeremya
On 2013/04/19 17:03:50, scottmg wrote: > cool. i tried to apply to test, but doesn't ...
7 years, 8 months ago (2013-04-20 01:47:17 UTC) #3
scottmg
On 2013/04/20 01:47:17, jeremya wrote: > On 2013/04/19 17:03:50, scottmg wrote: > > cool. i ...
7 years, 8 months ago (2013-04-20 13:30:37 UTC) #4
jeremya
+avi,rsesek for IOKit review (xbox_data_fetcher_mac) :) https://codereview.chromium.org/14328036/diff/9001/content/browser/gamepad/gamepad_platform_data_fetcher_mac.mm File content/browser/gamepad/gamepad_platform_data_fetcher_mac.mm (right): https://codereview.chromium.org/14328036/diff/9001/content/browser/gamepad/gamepad_platform_data_fetcher_mac.mm#newcode332 content/browser/gamepad/gamepad_platform_data_fetcher_mac.mm:332: // but the ...
7 years, 8 months ago (2013-04-21 00:33:09 UTC) #5
Avi (use Gerrit)
+mark, he loves this kind of stuff. https://codereview.chromium.org/14328036/diff/9001/content/browser/gamepad/gamepad_platform_data_fetcher_mac.mm File content/browser/gamepad/gamepad_platform_data_fetcher_mac.mm (right): https://codereview.chromium.org/14328036/diff/9001/content/browser/gamepad/gamepad_platform_data_fetcher_mac.mm#newcode308 content/browser/gamepad/gamepad_platform_data_fetcher_mac.mm:308: using WebKit::WebGamepads; ...
7 years, 8 months ago (2013-04-22 21:00:51 UTC) #6
jeremya
https://codereview.chromium.org/14328036/diff/9001/content/browser/gamepad/gamepad_platform_data_fetcher_mac.mm File content/browser/gamepad/gamepad_platform_data_fetcher_mac.mm (right): https://codereview.chromium.org/14328036/diff/9001/content/browser/gamepad/gamepad_platform_data_fetcher_mac.mm#newcode308 content/browser/gamepad/gamepad_platform_data_fetcher_mac.mm:308: using WebKit::WebGamepads; On 2013/04/22 21:00:51, Avi wrote: > It ...
7 years, 8 months ago (2013-04-23 04:38:24 UTC) #7
Avi (use Gerrit)
https://codereview.chromium.org/14328036/diff/16001/content/browser/gamepad/gamepad_platform_data_fetcher_mac.mm File content/browser/gamepad/gamepad_platform_data_fetcher_mac.mm (right): https://codereview.chromium.org/14328036/diff/16001/content/browser/gamepad/gamepad_platform_data_fetcher_mac.mm#newcode148 content/browser/gamepad/gamepad_platform_data_fetcher_mac.mm:148: WebKit::WebGamepad& pad = data_.items[slot]; ... which means you don't ...
7 years, 8 months ago (2013-04-23 15:12:38 UTC) #8
Mark Mentovai
I started reading this yesterday but didn’t get to the meat of the IOKit stuff. ...
7 years, 8 months ago (2013-04-23 19:46:59 UTC) #9
jeremya
(wfh, haven't compiled this yet) https://codereview.chromium.org/14328036/diff/9001/content/browser/gamepad/gamepad_platform_data_fetcher_mac.mm File content/browser/gamepad/gamepad_platform_data_fetcher_mac.mm (right): https://codereview.chromium.org/14328036/diff/9001/content/browser/gamepad/gamepad_platform_data_fetcher_mac.mm#newcode309 content/browser/gamepad/gamepad_platform_data_fetcher_mac.mm:309: size_t slot; On 2013/04/23 ...
7 years, 8 months ago (2013-04-24 00:18:51 UTC) #10
Avi (use Gerrit)
I'm pretty happy. lgtm Let's see how Mark feels... https://codereview.chromium.org/14328036/diff/30001/content/browser/gamepad/xbox_data_fetcher_mac.cc File content/browser/gamepad/xbox_data_fetcher_mac.cc (right): https://codereview.chromium.org/14328036/diff/30001/content/browser/gamepad/xbox_data_fetcher_mac.cc#newcode473 content/browser/gamepad/xbox_data_fetcher_mac.cc:473: ...
7 years, 8 months ago (2013-04-24 03:30:12 UTC) #11
jeremya
https://codereview.chromium.org/14328036/diff/30001/content/browser/gamepad/xbox_data_fetcher_mac.cc File content/browser/gamepad/xbox_data_fetcher_mac.cc (right): https://codereview.chromium.org/14328036/diff/30001/content/browser/gamepad/xbox_data_fetcher_mac.cc#newcode473 content/browser/gamepad/xbox_data_fetcher_mac.cc:473: (CFNumberRef)IORegistryEntryCreateCFProperty( On 2013/04/24 03:30:12, Avi wrote: > CFCast<CFNumberRef>, probably ...
7 years, 8 months ago (2013-04-24 03:34:15 UTC) #12
Mark Mentovai
https://codereview.chromium.org/14328036/diff/29003/base/mac/scoped_ioplugininterface.h File base/mac/scoped_ioplugininterface.h (right): https://codereview.chromium.org/14328036/diff/29003/base/mac/scoped_ioplugininterface.h#newcode21 base/mac/scoped_ioplugininterface.h:21: typedef T** IFT; What is IFT supposed to stand ...
7 years, 8 months ago (2013-04-24 16:57:20 UTC) #13
jeremya
https://codereview.chromium.org/14328036/diff/29003/base/mac/scoped_ioplugininterface.h File base/mac/scoped_ioplugininterface.h (right): https://codereview.chromium.org/14328036/diff/29003/base/mac/scoped_ioplugininterface.h#newcode21 base/mac/scoped_ioplugininterface.h:21: typedef T** IFT; On 2013/04/24 16:57:20, Mark Mentovai wrote: ...
7 years, 8 months ago (2013-04-26 03:47:40 UTC) #14
jeremya
ping :)
7 years, 7 months ago (2013-04-30 00:05:33 UTC) #15
Mark Mentovai
Sorry, I was out on Monday and Tuesday. https://codereview.chromium.org/14328036/diff/29003/content/browser/gamepad/xbox_data_fetcher_mac.cc File content/browser/gamepad/xbox_data_fetcher_mac.cc (right): https://codereview.chromium.org/14328036/diff/29003/content/browser/gamepad/xbox_data_fetcher_mac.cc#newcode113 content/browser/gamepad/xbox_data_fetcher_mac.cc:113: normalized_data->buttons[0] ...
7 years, 7 months ago (2013-05-01 18:59:19 UTC) #16
jeremya
scottmg - do you have a better understanding than I about the TYPE_IO vs TYPE_UI ...
7 years, 7 months ago (2013-05-21 06:23:25 UTC) #17
Mark Mentovai
https://codereview.chromium.org/14328036/diff/29003/content/browser/gamepad/xbox_data_fetcher_mac.cc File content/browser/gamepad/xbox_data_fetcher_mac.cc (right): https://codereview.chromium.org/14328036/diff/29003/content/browser/gamepad/xbox_data_fetcher_mac.cc#newcode113 content/browser/gamepad/xbox_data_fetcher_mac.cc:113: normalized_data->buttons[0] = data.a ? 1.f : 0.f; jeremya wrote: ...
7 years, 7 months ago (2013-05-21 13:46:18 UTC) #18
Mark Mentovai
If you’re not doing libevent IO, you don’t need a TYPE_IO loop. You can make ...
7 years, 7 months ago (2013-05-21 13:47:50 UTC) #19
scottmg
On 2013/05/21 13:47:50, Mark Mentovai wrote: > If you’re not doing libevent IO, you don’t ...
7 years, 7 months ago (2013-05-21 16:04:07 UTC) #20
jeremya
Moved the conversions back to xbox-specific code, though it's a little clumsy because of the ...
7 years, 7 months ago (2013-05-21 23:57:30 UTC) #21
Mark Mentovai
LGTM
7 years, 7 months ago (2013-05-22 13:56:34 UTC) #22
scottmg
lgtm
7 years, 7 months ago (2013-05-22 16:26:12 UTC) #23
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/jeremya@chromium.org/14328036/58001
7 years, 7 months ago (2013-05-23 00:22:13 UTC) #24
commit-bot: I haz the power
Change committed as 201717
7 years, 7 months ago (2013-05-23 06:48:14 UTC) #25
Avi (use Gerrit)
7 years, 7 months ago (2013-05-23 18:20:50 UTC) #26
Message was sent while issue was closed.
You broke the build.

https://codereview.chromium.org/14328036/diff/58001/content/browser/gamepad/x...
File content/browser/gamepad/xbox_data_fetcher_mac.cc (right):

https://codereview.chromium.org/14328036/diff/58001/content/browser/gamepad/x...
content/browser/gamepad/xbox_data_fetcher_mac.cc:390: uint32 bytesRead =
reinterpret_cast<uint32>(arg0);
This broke the Mac 64 build
(http://build.chromium.org/p/chromium.fyi/builders/Chromium%20Mac%2010.8%20x64...):

/Volumes/data/b/build/slave/Chromium_Mac_10_8_x64__experimental_/build/src/content/browser/gamepad/xbox_data_fetcher_mac.cc:390:22:error:
cast from pointer to smaller type 'uint32' (aka 'unsigned int') loses
information
  uint32 bytesRead = reinterpret_cast<uint32>(arg0);
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

The correct thing to do here imo is to reinterpret_cast to uintptr_t and then
assign over.

Powered by Google App Engine
This is Rietveld 408576698