linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: 'Dmitry Torokhov' <dmitry.torokhov@gmail.com>
To: "Holmberg, Hans" <hans.holmberg@intel.com>
Cc: "'devicetree@vger.kernel.org'" <devicetree@vger.kernel.org>,
	"'linux-input@vger.kernel.org'" <linux-input@vger.kernel.org>
Subject: Re: [PATCH 0/2] GPIO joystick driver
Date: Wed, 11 Feb 2015 10:06:38 -0800	[thread overview]
Message-ID: <20150211180638.GB29440@dtor-ws> (raw)
In-Reply-To: <4B6D6D87A8FB62428BE0A3E38461A1AB18D6BB34@irsmsx105.ger.corp.intel.com>

On Wed, Feb 11, 2015 at 08:49:16AM +0000, Holmberg, Hans wrote:
> > > > As far as I can tell, there is no way to specify values for ABS-"keys"
> > > > in the device tree binding.
> > >
> > > It may not be present in device tree binding, but the driver does
> > > support it, so I would rather extend the binding than have a brand new
> > driver.
> > 
> > All right, I find it a bit like whacking a round peg down a square hole, but I'll
> > head down that path and see where it leads.
> > 
> 
> This is what I've found:
> 
> A digital joystick driver needs to report three states per axis: min,
> max and neutral. The hardware only have two signals per axis(i.e. up
> and down) however. See http://wiki.icomp.de/wiki/DB9-Joystick 
> 
> This makes gpio-keys pretty much impossible to use for joysticks - as
> the driver only reports abs-events when a button/key is pressed, how
> would the neutral state be reported?  (as there is no signal for
> "neutral")
> 
> Even if through some hackery the driver would be modified to report a
> special neutral event if all  "buttons/keys" for that axis are not
> pressed, what value should be reported?  An average of the values for
> that axis?   Also, reporting such an implicit neutral event would
> break the behavior of existing abs-reporting instances, right?

You have 2 gpio per axis, and since you can't measure how "far" down the
axis you have moved the driver should only report values -1, 0, 1 per
axis. You start at neutral position, and move right. IRQ for right gpio
is fired and you report EV_ABS/ABS_X/1. Then you start moving to the
left, gpio IRQ fires (you want it to trigger on both edges) and you
report EV_ABS/ABS_X/0. You continue moving to the left and IRQ for left
gpio fires up and you report EV_ABS/ABS_X/-1.

This assumes that you assign EV_ABS/ABS_X and value 1 for right gpio and
EV_ABS/ABS_X and value -1 for left gpio.

Thanks.

-- 
Dmitry

  reply	other threads:[~2015-02-11 18:06 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-06  9:32 [PATCH 0/2] GPIO joystick driver Hans Holmberg
2015-02-06  9:32 ` [PATCH 2/2] input: gpio-joy - " Hans Holmberg
     [not found]   ` <1423215122-19947-3-git-send-email-hans.holmberg-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-02-06 11:02     ` Mark Rutland
2015-02-07  7:53       ` Holmberg, Hans
     [not found] ` <1423215122-19947-1-git-send-email-hans.holmberg-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-02-06  9:32   ` [PATCH 1/2] Documentation: Device Tree binding information for gpio-joy driver Hans Holmberg
     [not found]     ` <1423215122-19947-2-git-send-email-hans.holmberg-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-02-06 10:53       ` Mark Rutland
2015-02-07  7:50         ` Holmberg, Hans
2015-02-06 15:31   ` [PATCH 0/2] GPIO joystick driver Dmitry Torokhov
     [not found]     ` <1AA6C46C-36D9-4243-9DC5-254A7202D339-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-02-07  7:35       ` Holmberg, Hans
     [not found]         ` <4B6D6D87A8FB62428BE0A3E38461A1AB18D6AF04-pww93C2UFcwu0RiL9chJVbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-02-07 20:46           ` Dmitry Torokhov
2015-02-09 10:19             ` Holmberg, Hans
2015-02-11  8:49               ` Holmberg, Hans
2015-02-11 18:06                 ` 'Dmitry Torokhov' [this message]
2015-02-18  8:42                   ` Holmberg, Hans

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=20150211180638.GB29440@dtor-ws \
    --to=dmitry.torokhov@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=hans.holmberg@intel.com \
    --cc=linux-input@vger.kernel.org \
    /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).