linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Todd Showalter <todd@electronjump.com>
Cc: David Herrmann <dh.herrmann@gmail.com>,
	Antonio Ospite <ospite@studenti.unina.it>,
	"open list:HID CORE LAYER" <linux-input@vger.kernel.org>
Subject: Re: Game Controllers
Date: Thu, 2 May 2013 11:29:36 -0700	[thread overview]
Message-ID: <20130502182935.GD28625@core.coreip.homeip.net> (raw)
In-Reply-To: <CAFmpkyjO8WwUxOJ2BtULwOTcfYs7sjdWMS_=Fcho996VijEFHg@mail.gmail.com>

On Thu, May 02, 2013 at 01:06:59PM -0400, Todd Showalter wrote:
> On Thu, May 2, 2013 at 12:38 PM, Dmitry Torokhov
> <dmitry.torokhov@gmail.com> wrote:
> 
> > I wish we have gotten all the mappings correct from the get go, but that
> > did not happen, so now we need to move forward. That means that we can
> > establish the canonical mapping and try to follow it for the new
> > devices, but you still need to support older devices and for that you
> > will still need mapping.
> 
>     That's why I'm suggesting having /dev/input/gamepad* devices
> alongside the equivalent /dev/input/event* devices.  All current users
> are either looking at js* or event* device nodes, so as long as those
> are left unchanged, nothing breaks.  New users can open gamepad* and
> know that they'll get consistent results.
> 
>     New devices can support the gamepad mapping so that what gets
> exported in event* and js* is in canonical order, and older devices
> will just work as they always did.  I strongly suspect once that's in
> place you'll find that most users go straight to the new interface.
> 
>     I'm also talking to the Wayland folks and offering to do the
> gamepad event protocol code, and if /dev/input/gamepad* is available
> that's definitely what I plan to feed into the Wayland event system.
> 
> >>     Really, what I want is roughly what /dev/input/js* has, but as
> >> /dev/input/gamepad* with standardized mapping.
> >
> > This is understandable but I do not believe this should be done in
> > kernel, but rather in userspace.
> 
>     I can see why you believe that, but personally I think the kernel
> is exactly where it belongs:
> 
> - it's a useful abstraction, as useful for games as the standard mouse
> and standard keyboard are for other programs -- programs don't have to
> call a translation library to remap mouse input

That is because all mice generate standard events. Note that mice users
do not have a dedicated interface (mousedev is legacy and nothing
remotely modern is using it).

You only need to translate for devices that do not generate the events
you are expecting.

> 
> - the current game controller semi-standard, the js* interface, was
> really designed for 90s era flight simulator joysticks, and while
> gamepads have been wedged into it they aren't a great match

Completely agree. The js interface was here way before we had the
current input subsystem with evdev interface that is proved to be
flexible enough. So when evdev was created joydev was implemented to
keep compatibility with older software. Newer software again is expected
to use evdev exclusively (from kernel POV, there can/should be userspace
layers on top).

> 
> - any mapping library is going to have to be a mirror of the kernel
> code, which means it's basically just a lot of duplicated effort with
> the added penalty of update lag

The library can do much more than that. You also need to calibrate the
device (per user), adjust it to user's tastes and so on. Maybe you have
a user that is left-handed and you'd like to remap some keys? It is
certainly not kernel's job.

There also should not be lag if new devices follow the agreed upon
mapping.

> 
>     Why not fix the problem at the source?  Creating a
> /dev/input/gamepad* device node for each gamepad in addition to the
> event* device node solves the whole problem.  It leaves the old
> interface intact, it only brings the new interface online for devices
> that support it (and have had the appropriate support code added), and
> it means that the problem can be tackled piecewise.  At the same time,
> it gives us standard behaviour that a game can rely on.

The same thing can be done in a library. Libraries are easier then
kernels, you do not need to consume memory until needed and you do not
need to do the conversion if it is not needed. And it should be possible
to update the library whereas with kernel you mist likely need to reboot
the box.

Why do people believe that patching the kernel is easier than updating
userspace?

Thanks.

-- 
Dmitry

  reply	other threads:[~2013-05-02 18:29 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 [this message]
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
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=20130502182935.GD28625@core.coreip.homeip.net \
    --to=dmitry.torokhov@gmail.com \
    --cc=dh.herrmann@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=ospite@studenti.unina.it \
    --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).