linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: simon-wM4F9T/ekXmXDw4h08c5KA@public.gmane.org
Cc: linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Frank Praznik
	<frank.praznik-oKii7tqusJgAvxtiuMwx3w@public.gmane.org>,
	linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Srinivas Pandruvada
	<srinivas.pandruvada-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Subject: Re: [RFC] HID: hid-sony: Add basic iio-subsystem reading of SixAxis Accelerometers
Date: Sun, 14 Jun 2015 18:57:24 +0100	[thread overview]
Message-ID: <557DC084.6090205@kernel.org> (raw)
In-Reply-To: <d6702f5d19d2baea80132666fcf7654a.squirrel-wM4F9T/ekXmXDw4h08c5KA@public.gmane.org>

On 14/06/15 18:25, simon-wM4F9T/ekXmXDw4h08c5KA@public.gmane.org wrote:
> Thank you for your comments, I'm just getting started with IIO so it's all
> good stuff...
> 
Srinivas, cc'd you as a few queries came up about the hid-sensors driver.
(it's got me thoroughly confused ;(
>>> +++++++++++++++++++++++++++++++++++++++++++++++++
>> Hmm. This driver is already a substantial mash up of a number of different
>> types of driver (as far as linux is concerned), with input, battery and
>> led
>> drivers.  Might be worth considering a more formal MFD approach as it'll
>> break the driver up into a number of sub components that will then sit
>> in the various subsystems in a cleaner fashion.
>> Just a thought!
> 
> Might be, but that sounds like more work ;-) If pushing some ideas around
> prompts that, it can't be a bad thing.... right?
> 
>>> +	case IIO_CHAN_INFO_SCALE:
>>> +		switch (chan->type) {
>> If the scale really is 1 then don't export it.  Note the units would
>> have to be in m/s^2 which seems unlikely though. I'm guessing this
>> is a placeholder..
> 
> Yes place holder, different controllers (SixAxis, DS4 and PSMove) have
> different values. In the far future I'd hope to use the per-device
> calibration stored on the PSMove.
> 
> https://github.com/nitsch/moveonpc/wiki/Calibration-data
> 
>>> +static const struct iio_chan_spec sony_sixaxis_channels[] = {
>>> +	SONY_ACC_CHANNEL(X),
>>> +	SONY_ACC_CHANNEL(Y),
>>> +	SONY_ACC_CHANNEL(Z),
>> No gyro channels yet?
>> Just to note, if the gyro frequency etc is different from the
>> accelerometer
>> (pretty common) then you'll want to register two IIO devices rather than
>> just the one so that the control and buffers are separate.
> 
> I have a vague memory that the SixAxis has a 1-ch gyro but this is not
> showing on hidraw (might be 'hidden' behind MultiTouch ID/Bug).
> 
> The DS4 has Accel/Gyros, and the PSMove has Accel/Gyro/Mag. I didn't
> expose the mags over input/joystick axis as I didn't want to corrupt
> stream the PSMoveAPI (it needs to be re-ordered) and it's unlikely anyone
> would actually use via joystick.
> 
> The PSMove's report actually contains 2 frames assumed to be 1/2 sample
> rate apart for the Accel/Gyro, but only one Mag reading.
> 
> 
> 
> I have further advanced the patch to include reading via buffer, but I'm
> having trigger 'conceptual' problems getting my head around the HID device
> issuing an interrupt when a input report is received. Looking at
> iio_dummy_event and iios_sysfs for inspiration....
You can skip the triggers.  It's not obligatory, you can push directly into a buffer.
Triggers are nice for 'data ready' type signals (which is closest to what we
have here) if you might want to hang other sensors off the timing (so read
on demand ADCs etc.  They aren't actually 'required' as such.

Looking at the hid drivers I'm not entirely sure they are actually doing anything.
(been a while since I looked at these in detail!).  Srinivas, perhaps you could help
out with what's going on there?

I can't find an iio_trigger_poll call so the trigger is neither used by the
hid sensors drivers, not usable by anything else as far as I can see..
Looks like it is used purely to get the device into the correct power state
etc.  If so that stuff should be in the buffer preenable / postdisable not
the trigger stuff.

I get the feeling that this might all be a work around for a perceived need
for a trigger (particularly in userspace app examples?) as it predates
the am355x driver where we absolutely said they weren't required and the
userspace demo changes that were made to support that.
> 
> On the assumption that there will be multiple devices (either same type or
> with different HID drivers) all trying to issue triggers, we'd need to be
> a little careful.
> 
> Is there a 'short-cut' we can use if a HID device is only required to
> trigger itself (and not other iio devices)? ie. not need true interrupt
> system.
Yes, you can use the 'validate_trigger' and 'validate_device' callbacks to
reject either other devices trying to use the trigger, or your device trying
to use a different one.  Lots of drivers do this in the first place (as you
point out it is a short cut to get things working) then if anyone cares
relax the constraint later by making the true interrupt stuff work.


> 
> Simon.
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

  parent reply	other threads:[~2015-06-14 17:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-08 15:41 Handling Controllers with Acc/Gyro/Mag via HID system simon
2015-06-08 22:43 ` Frank Praznik
     [not found] ` <195dff9bd065db7e618280cb7c6eb5a9.squirrel-wM4F9T/ekXmXDw4h08c5KA@public.gmane.org>
2015-06-11 14:54   ` [RFC] HID: hid-sony: Add basic iio-subsystem reading of SixAxis Accelerometers Simon Wood
2015-06-11 15:07     ` Bastien Nocera
2015-06-14 14:53     ` Jonathan Cameron
2015-06-14 17:25       ` simon
     [not found]         ` <d6702f5d19d2baea80132666fcf7654a.squirrel-wM4F9T/ekXmXDw4h08c5KA@public.gmane.org>
2015-06-14 17:57           ` Jonathan Cameron [this message]
2015-06-15 18:14             ` Srinivas Pandruvada
     [not found]               ` <1434392064.2353.77.camel-hINH/TbAiWqaJgj69oe+EDMJUdESFZ8XQQ4Iyu8u01E@public.gmane.org>
2015-06-21 13:16                 ` Jonathan Cameron
2015-06-18  6:15             ` simon
     [not found]               ` <a740eca098128c7a830db825d7c0288c.squirrel-wM4F9T/ekXmXDw4h08c5KA@public.gmane.org>
2015-06-21 13:12                 ` Jonathan Cameron

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=557DC084.6090205@kernel.org \
    --to=jic23-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=frank.praznik-oKii7tqusJgAvxtiuMwx3w@public.gmane.org \
    --cc=linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=simon-wM4F9T/ekXmXDw4h08c5KA@public.gmane.org \
    --cc=srinivas.pandruvada-VuQAYsv1563Yd54FQh9/CA@public.gmane.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).