From: David Herrmann <dh.herrmann@gmail.com>
To: Frank Praznik <frank.praznik@oh.rr.com>
Cc: "open list:HID CORE LAYER" <linux-input@vger.kernel.org>,
Jiri Kosina <jkosina@suse.cz>
Subject: Re: [PATCH v2 6/6] HID: sony: Add conditionals to enable all features in Bluetooth mode
Date: Mon, 3 Feb 2014 17:31:28 +0100 [thread overview]
Message-ID: <CANq1E4SdMD8Psgjp2+xrBqEQ4KcHpkJisn61BLa2+akyunAzCw@mail.gmail.com> (raw)
In-Reply-To: <1391102648-19381-7-git-send-email-frank.praznik@oh.rr.com>
Hi
On Thu, Jan 30, 2014 at 6:24 PM, Frank Praznik <frank.praznik@oh.rr.com> wrote:
> Add the necessary conditionals to enable battery reporting, rumble, LED
> settings and touchpad parsing.
>
> Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com>
>
> ---
> drivers/hid/hid-sony.c | 20 +++++++++++++-------
> 1 file changed, 13 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
> index eee56d7..d920362 100644
> --- a/drivers/hid/hid-sony.c
> +++ b/drivers/hid/hid-sony.c
> @@ -44,8 +44,10 @@
> #define DUALSHOCK4_CONTROLLER_USB BIT(5)
> #define DUALSHOCK4_CONTROLLER_BT BIT(6)
>
> -#define SONY_LED_SUPPORT (SIXAXIS_CONTROLLER_USB | BUZZ_CONTROLLER | DUALSHOCK4_CONTROLLER_USB)
> -#define SONY_BATTERY_SUPPORT (SIXAXIS_CONTROLLER_USB | SIXAXIS_CONTROLLER_BT | DUALSHOCK4_CONTROLLER_USB)
> +#define SONY_LED_SUPPORT (SIXAXIS_CONTROLLER_USB | BUZZ_CONTROLLER | \
> + DUALSHOCK4_CONTROLLER_USB | DUALSHOCK4_CONTROLLER_BT)
> +#define SONY_BATTERY_SUPPORT (SIXAXIS_CONTROLLER_USB | SIXAXIS_CONTROLLER_BT | \
> + DUALSHOCK4_CONTROLLER_USB | DUALSHOCK4_CONTROLLER_BT)
How about adding:
#define DUALSHOCK4_CONTROLLER (DUALSHOCK4_CONTROLLER_USB |
DUALSHOCK4_CONTROLLER_BT)
and then simplifying the chunks below? Seems a bit redundant to always
check for both, _USB and _BT in the dualshock4 case.
Thanks
David
>
> #define MAX_LEDS 4
>
> @@ -939,8 +941,9 @@ static int sony_raw_event(struct hid_device *hdev, struct hid_report *report,
> swap(rd[47], rd[48]);
>
> sixaxis_parse_report(sc, rd, size);
> - } else if ((sc->quirks & DUALSHOCK4_CONTROLLER_USB) && rd[0] == 0x01 &&
> - size == 64) {
> + } else if (((sc->quirks & DUALSHOCK4_CONTROLLER_USB) && rd[0] == 0x01 &&
> + size == 64) || ((sc->quirks & DUALSHOCK4_CONTROLLER_BT)
> + && rd[0] == 0x11 && size == 78)) {
> dualshock4_parse_report(sc, rd, size);
> }
>
> @@ -1079,7 +1082,8 @@ static void sony_set_leds(struct hid_device *hdev, const __u8 *leds, int count)
> if (drv_data->quirks & BUZZ_CONTROLLER && count == 4) {
> buzz_set_leds(hdev, leds);
> } else if ((drv_data->quirks & SIXAXIS_CONTROLLER_USB) ||
> - (drv_data->quirks & DUALSHOCK4_CONTROLLER_USB)) {
> + (drv_data->quirks & DUALSHOCK4_CONTROLLER_USB) ||
> + (drv_data->quirks & DUALSHOCK4_CONTROLLER_BT)) {
> for (n = 0; n < count; n++)
> drv_data->led_state[n] = leds[n];
> schedule_work(&drv_data->state_worker);
> @@ -1184,7 +1188,8 @@ static int sony_leds_init(struct hid_device *hdev)
> /* Validate expected report characteristics. */
> if (!hid_validate_values(hdev, HID_OUTPUT_REPORT, 0, 0, 7))
> return -ENODEV;
> - } else if (drv_data->quirks & DUALSHOCK4_CONTROLLER_USB) {
> + } else if ((drv_data->quirks & DUALSHOCK4_CONTROLLER_USB) ||
> + (drv_data->quirks & DUALSHOCK4_CONTROLLER_BT)) {
> drv_data->led_count = 3;
> max_brightness = 255;
> use_colors = 1;
> @@ -1509,7 +1514,8 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
> }
> else if (sc->quirks & SIXAXIS_CONTROLLER_BT)
> ret = sixaxis_set_operational_bt(hdev);
> - else if (sc->quirks & DUALSHOCK4_CONTROLLER_USB) {
> + else if ((sc->quirks & DUALSHOCK4_CONTROLLER_USB) ||
> + (sc->quirks & DUALSHOCK4_CONTROLLER_BT)) {
> if ((sc->quirks & DUALSHOCK4_CONTROLLER_USB) &&
> hdev->ll_driver->output_report == NULL) {
> hid_err(hdev, "NULL output_report handler\n");
> --
> 1.8.5.3
>
prev parent reply other threads:[~2014-02-03 16:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-30 17:24 [PATCH v2 0/6] HID: sony: Add full Dualshock 4 support in Bluetooth mode Frank Praznik
2014-01-30 17:24 ` [PATCH v2 1/6] HID: sony: Use low-level transport driver functions Frank Praznik
2014-02-03 16:26 ` David Herrmann
2014-01-30 17:24 ` [PATCH v2 2/6] HID: sony: Add modified Dualshock 4 Bluetooth HID descriptor Frank Praznik
2014-01-30 17:24 ` [PATCH v2 3/6] HID: sony: Add Bluetooth output report formatting Frank Praznik
2014-02-03 16:29 ` David Herrmann
2014-01-30 17:24 ` [PATCH v2 4/6] HID: sony: Add Dualshock 4 Bluetooth battery and touchpad parsing Frank Praznik
2014-01-30 17:24 ` [PATCH v2 5/6] HID: sony: Set initial battery level to 100% to avoid false low battery warnings Frank Praznik
2014-01-30 17:24 ` [PATCH v2 6/6] HID: sony: Add conditionals to enable all features in Bluetooth mode Frank Praznik
2014-02-03 16:31 ` David Herrmann [this message]
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=CANq1E4SdMD8Psgjp2+xrBqEQ4KcHpkJisn61BLa2+akyunAzCw@mail.gmail.com \
--to=dh.herrmann@gmail.com \
--cc=frank.praznik@oh.rr.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 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).