All of lore.kernel.org
 help / color / mirror / Atom feed
From: Frank Praznik <frank.praznik@oh.rr.com>
To: linux-input@vger.kernel.org
Cc: jkosina@suse.cz, dh.herrmann@gmail.com,
	Frank Praznik <frank.praznik@oh.rr.com>
Subject: [PATCH v2 1/8] HID: sony: Fix Sixaxis cable state detection
Date: Thu,  6 Mar 2014 17:32:49 -0500	[thread overview]
Message-ID: <1394145176-24174-2-git-send-email-frank.praznik@oh.rr.com> (raw)
In-Reply-To: <1394145176-24174-1-git-send-email-frank.praznik@oh.rr.com>

Byte 31 of the Sixaxis report can change depending on whether or not the
controller is rumbling.  Using bit 3 is the only reliable way to detect the
state of the cable regardless of rumble activity.

Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com>
---
 drivers/hid/hid-sony.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index 4884bb5..4c445a0 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -863,7 +863,7 @@ static void sixaxis_parse_report(struct sony_sc *sc, __u8 *rd, int size)
 		battery_capacity = sixaxis_battery_capacity[index];
 		battery_charging = 0;
 	}
-	cable_state = !((rd[31] >> 4) & 0x01);
+	cable_state = !(rd[31] & 0x04);
 
 	spin_lock_irqsave(&sc->lock, flags);
 	sc->cable_state = cable_state;
-- 
1.8.5.3


  reply	other threads:[~2014-03-06 22:33 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-06 22:32 [PATCH v2 0/8] HID: sony: More Sony controller fixes and improvements Frank Praznik
2014-03-06 22:32 ` Frank Praznik [this message]
2014-03-06 22:32 ` [PATCH v2 2/8] HID: sony: Set the HID quriks flag for Bluetooth controllers Frank Praznik
2014-03-06 22:32 ` [PATCH v2 3/8] HID: sony: Use inliners for work queue initialization and cancellation Frank Praznik
2014-03-06 22:32 ` [PATCH v2 4/8] HID: sony: Use a struct for the Sixaxis output report Frank Praznik
2014-03-06 22:32 ` [PATCH v2 5/8] HID: sony: Convert startup and shutdown functions to use a uniform parameter type Frank Praznik
2014-03-06 22:32 ` [PATCH v2 6/8] HID: sony: Add an IDA allocator to assign unique device ids Frank Praznik
2014-03-10 22:25   ` Antonio Ospite
2014-03-13 14:30     ` Frank Praznik
2014-03-06 22:32 ` [PATCH v2 7/8] HID: sony: Initialize the controller LEDs with the device ID value Frank Praznik
2014-03-10 22:59   ` Antonio Ospite
2014-03-13 14:24     ` Frank Praznik
2014-03-06 22:32 ` [PATCH v2 8/8] HID: sony: Add blink support to the Sixaxis and DualShock 4 LEDs Frank Praznik
2014-03-14 14:42 ` [PATCH v2 0/8] HID: sony: More Sony controller fixes and improvements Jiri Kosina

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=1394145176-24174-2-git-send-email-frank.praznik@oh.rr.com \
    --to=frank.praznik@oh.rr.com \
    --cc=dh.herrmann@gmail.com \
    --cc=jkosina@suse.cz \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.