From: David Herrmann <dh.herrmann@gmail.com>
To: Todd Showalter <todd@electronjump.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
"open list:HID CORE LAYER" <linux-input@vger.kernel.org>
Subject: Re: Game Controllers
Date: Thu, 2 May 2013 19:54:40 +0200 [thread overview]
Message-ID: <CANq1E4RRFNPZ-z86yny89hViMWREpG1f1in5O3kT8usHO57YAQ@mail.gmail.com> (raw)
In-Reply-To: <CAFmpkygr5c-munK9ix=exq4KRgDEUbP+OP_AABuuTR1P_2V1-g@mail.gmail.com>
Hi Todd
On Thu, May 2, 2013 at 7:35 PM, Todd Showalter <todd@electronjump.com> wrote:
> On Thu, May 2, 2013 at 1:01 PM, Dmitry Torokhov
> <dmitry.torokhov@gmail.com> wrote:
>> On Thu, May 02, 2013 at 09:46:44AM -0400, Todd Showalter wrote:
>>>
>>> left stick: ABS_X, ABS_Y
>>> right stick: ABS_RX, ABS_RY
>>
>> Not sure about this one. Originally RX, RY and RZ were introduces for
>> device having more than 3 degress of freedom; and RX is used by many
>> joystick devices. We'd ether need a property bit to distinguish gamepad
>> from a joystick or simply ass ABS_X2, ABS_Y2 etc for the second stick.
>
> I'd be happy to have ABS_LX, ABS_LY and ABS_RX, ABS_RY, I was just
> looking at what was available in input.h and what the xbox pads were
> already doing. Likewise, mapping the dpad as HAT0X, HAT0Y is a little
> wierd and ABS_DX, ABS_DY would probably be better.
>
>>> dpad: ABS_HAT0X, ABS_HAT0Y
>>> left trigger: ABS_Z
>>
>> Huh?
>>
>>> right trigger: ABS_RZ
>>
>> Not at all. These are not absolute events but rather buttons, so let's
>> define them as such.
>
> Most game controllers these days (including ps3 and xbox/xbox 360)
> have analog shoulder triggers. On Microsoft, LT and RT are analog
> (0..255) and LB and RB are digital. On ps3, L1, L2, R1 and R2 are
> actually pressure sensitive and are exported both as analog (0..255)
> and digital; I figured we'd treat LR1 as digital, LR2 as analog. The
> Wii Classic controller has L and R analog, ZL and ZR digital, though
> IIRC the Classic Pro controller has L and R as digital.
>
> Here's a complete mapping for some well known controllers:
>
> left stick
> - ps3, xbox, xbox360, wiiclassic, ouya -- left stick
>
> right stick
> - ps3, xbox, xbox360, wiiclassic, ouya -- right stick
>
> dpad
> - ps3, xbox, xbox360, wiiclassic, ouya -- dpad
>
> shoulder analog triggers
> - ps3 -- L2, R2, use pressure values
> - xbox, xbox360 -- LT, RT
> - wiiclassic -- L, R
> - ouya -- unsure what they're called, but it has them
>
> shoulder digital buttons
> - ps3 -- L1, R1
> - xbox, xbox360 -- LB, RB
> - wiiclassic -- ZL, ZR
> - ouya -- unsure what they're called, but it has them
>
> face buttons (NORTH, EAST, SOUTH, WEST)
> - ps3 -- triangle, circle, x, square
> - xbox, xbox360 -- Y, B, A, X
> - wiiclassic -- x, a, b, y
> - ouya -- Y, A, O, U
>
> stick buttons
> - ps3, xbox, xbox360, wiiclassic -- left stick click, right stick click
> - ouya -- unsure if this is supported,
>
> start button
> - ps3, xbox, xbox360, wiiclassic -- start
> - ouya -- not present, developers are asking for one
>
> system button
> - ps3 -- playstation logo button
> - xbox -- not available
> - xbox360 -- glowy x button
> - ouya -- system (U) button
>
> select button -- arguable
> - ps3, wiiclassic -- select
> - xbox, xbox360 -- back
> - ouya -- not present, developers are asking for one
>
> Todd.
How about a new input property that marks devices that follow general
rules as such? So for instance:
INPUT_PROP_DEV_MOUSE
INPUT_PROP_DEV_KEYBOARD
INPUT_PROP_DEV_GAMEPAD
INPUT_PROP_DEV_JOYSTICK
And so on. And then we can decide on a generic mapping for each. We
only set these properties on devices that follow the generic mapping.
Devices that don't have these flags set are non-generic or have weird
keymaps. This would also solve problems were the xserver thinks some
gamepads or accelerometers are a mouse (or similar).
This allows user-space to detect generic devices. For all other device
types, they need special support, anyway. They can still use the same
heuristics that they use now, but we can try to provide a generic flag
to avoid these often wrong heuristics.
I talked with Kay (udev maintainer) and he was really opposed to huge
udev black/white-lists that mark devices as generic MOUSE, KEYBOARD,
TOUCHPAD, ... These kernel properties would really help, but require
agreement on a generic mapping.
And as Dmitry noted, we cannot change legacy drivers due to backwards
compatibility. A separate /dev/input/gamepad* interface just wastes
resources when all you want is just a different and consistent
mapping.
Why not try to create a /usr/share/gamepad/*.map filetype and let
distros ship these files. Your game can then parse these into a table
and use the mappings for all legacy gamepads.
Or provide a "enable_legacy_mapping=true" module option for legacy
gamepad-drivers which allows to switch between different mappings
(even though that would be a global flag).
I still think the problems with user-space mappings can be solved. And
we should avoid wasting kernel memory for an interface that does
nothing more than change button-mappings.
Cheers
David
next prev parent reply other threads:[~2013-05-02 17:54 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-27 0:13 Game Controllers Todd Showalter
2013-04-29 21:04 ` Dmitry Torokhov
2013-04-30 0:46 ` Todd Showalter
2013-05-02 6:35 ` Antonio Ospite
2013-05-02 13:46 ` Todd Showalter
2013-05-02 14:09 ` David Herrmann
2013-05-02 15:37 ` Todd Showalter
2013-05-02 16:55 ` Dmitry Torokhov
2013-05-02 15:58 ` Todd Showalter
2013-05-02 16:38 ` Dmitry Torokhov
2013-05-02 17:06 ` Todd Showalter
2013-05-02 18:29 ` Dmitry Torokhov
2013-05-02 19:54 ` Todd Showalter
2013-05-02 20:18 ` Dmitry Torokhov
2013-05-02 20:30 ` Todd Showalter
2013-05-02 20:49 ` Dmitry Torokhov
2013-05-02 17:01 ` Dmitry Torokhov
2013-05-02 17:35 ` Todd Showalter
2013-05-02 17:54 ` David Herrmann [this message]
2013-05-02 19:10 ` Todd Showalter
2013-05-02 20:45 ` Dmitry Torokhov
2013-05-02 21:10 ` Todd Showalter
2013-05-03 15:50 ` Dmitry Torokhov
2013-09-07 17:01 ` Bastien Nocera
2013-05-03 10:29 ` Simon Farnsworth
2013-05-03 12:57 ` Todd Showalter
2013-05-03 16:01 ` Dmitry Torokhov
2013-05-03 17:12 ` Todd Showalter
2013-05-03 22:03 ` Ignaz Forster
2013-05-04 13:48 ` Todd Showalter
2013-05-02 3:25 ` Ray Dillinger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CANq1E4RRFNPZ-z86yny89hViMWREpG1f1in5O3kT8usHO57YAQ@mail.gmail.com \
--to=dh.herrmann@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=todd@electronjump.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).