From: "Barnabás Pőcze" <pobrn@protonmail.com>
To: Roderick Colenbrander <roderick@gaikai.com>
Cc: Jiri Kosina <jikos@kernel.org>,
Benjamin Tissoires <benjamin.tissoires@redhat.com>,
"linux-input@vger.kernel.org" <linux-input@vger.kernel.org>,
Chris Ye <lzye@google.com>,
Roderick Colenbrander <roderick.colenbrander@sony.com>
Subject: Re: [PATCH v2 05/13] HID: playstation: add DualSense accelerometer and gyroscope support.
Date: Fri, 08 Jan 2021 12:01:44 +0000 [thread overview]
Message-ID: <oMAXtdv54Nx6A2ugm9PmU5jd430MrPZPoJ01iEcCtUXZ5dxzHQc3hqTxp_Mb-2oKdtBEAd-U3QsTD2JFROklqtvl4HV-BB7LGDfn1d3MnUg=@protonmail.com> (raw)
In-Reply-To: <CANndSKk9Z=ivs_TiuLd77Kv9DMdhqTcdQnobNfnfVPTd2Bpzqg@mail.gmail.com>
Hi
2021. január 8., péntek 7:06 keltezéssel, Roderick Colenbrander írta:
> [...]
> > > +static int dualsense_get_calibration_data(struct dualsense *ds)
> > > +{
> > > + short gyro_pitch_bias, gyro_pitch_plus, gyro_pitch_minus;
> > > + short gyro_yaw_bias, gyro_yaw_plus, gyro_yaw_minus;
> > > + short gyro_roll_bias, gyro_roll_plus, gyro_roll_minus;
> > > + short gyro_speed_plus, gyro_speed_minus;
> > > + short acc_x_plus, acc_x_minus;
> > > + short acc_y_plus, acc_y_minus;
> > > + short acc_z_plus, acc_z_minus;
> > > + int speed_2x;
> > > + int range_2g;
> > > + int ret = 0;
> > > + uint8_t *buf;
> > > +
> > > + buf = kzalloc(DS_FEATURE_REPORT_CALIBRATION_SIZE, GFP_KERNEL);
> > > + if (!buf)
> > > + return -ENOMEM;
> > > +
> > > + ret = hid_hw_raw_request(ds->base.hdev, DS_FEATURE_REPORT_CALIBRATION, buf,
> > > + DS_FEATURE_REPORT_CALIBRATION_SIZE, HID_FEATURE_REPORT, HID_REQ_GET_REPORT);
> >
> > I think it would be better if lines were aligned. I have missed this in other patches,
> > so if you decide to make this change, please do it everywhere.
>
> What do you mean with "if lines were aligned"? You mean aligning the
> DS_FEATURE.. part with ds->base.hdev?
Yes, exactly.
>
> I'm almost tempted in the future (as part of a future patch series) to
> perhaps have a ps_device_get_feature_report or something like that as
> there is the same code in multiple places. It can do some nicer
> checking as well (including to see if the first byte is the report ID
> number, which is guaranteed for DualSense). I think it is a bit much
> to add now, but probably in the future also when I add DualShock 4 in
> here.
I think it's a good idea to add such a function sometime.
>
> >
> > > + if (ret < 0)
> > > + goto err_free;
> > > + else if (ret != DS_FEATURE_REPORT_CALIBRATION_SIZE) {
> >
> > As per coding style[1], please either use {} for all branches, or just drop the
> > `else` and maybe add a new line:
> >
> > ```
> > if (ret < 0)
> > goto ...
> >
> > if (ret != ...) {
> > ...
> > }
> > ```
> >
> >
> > > + hid_err(ds->base.hdev, "failed to retrieve DualSense calibration info\n");
> >
> > I think this message could be improved to better pinpoint the exact problem
> > that triggered it.
> >
> >
> > > + ret = -EINVAL;
> > > + goto err_free;
> > > + }
> [...]
Regards,
Barnabás Pőcze
next prev parent reply other threads:[~2021-01-08 12:02 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-02 22:30 [PATCH v2 00/13] HID: new driver for PS5 'DualSense' controller Roderick Colenbrander
2021-01-02 22:30 ` [PATCH v2 01/13] HID: playstation: initial DualSense USB support Roderick Colenbrander
2021-01-04 12:20 ` Jiri Kosina
2021-01-05 8:20 ` Benjamin Tissoires
2021-01-07 17:14 ` Barnabás Pőcze
2021-01-08 7:12 ` Roderick Colenbrander
2021-01-08 11:53 ` Barnabás Pőcze
2021-01-02 22:30 ` [PATCH v2 02/13] HID: playstation: use DualSense MAC address as unique identifier Roderick Colenbrander
2021-01-07 17:22 ` Barnabás Pőcze
2021-01-02 22:30 ` [PATCH v2 03/13] HID: playstation: add DualSense battery support Roderick Colenbrander
2021-01-07 17:50 ` Barnabás Pőcze
2021-01-02 22:31 ` [PATCH v2 04/13] HID: playstation: add DualSense touchpad support Roderick Colenbrander
2021-01-07 17:55 ` Barnabás Pőcze
2021-01-02 22:31 ` [PATCH v2 05/13] HID: playstation: add DualSense accelerometer and gyroscope support Roderick Colenbrander
2021-01-07 13:34 ` Florian Märkl
2021-01-08 5:51 ` Roderick Colenbrander
2021-01-07 18:51 ` Barnabás Pőcze
2021-01-08 6:06 ` Roderick Colenbrander
2021-01-08 12:01 ` Barnabás Pőcze [this message]
2021-01-08 17:15 ` Siarhei Vishniakou
2021-01-08 19:54 ` Roderick Colenbrander
2021-01-09 0:11 ` Siarhei Vishniakou
2021-01-11 0:06 ` Roderick Colenbrander
2021-01-02 22:31 ` [PATCH v2 06/13] HID: playstation: track devices in list Roderick Colenbrander
2021-01-07 20:13 ` Barnabás Pőcze
2021-01-02 22:31 ` [PATCH v2 07/13] HID: playstation: add DualSense Bluetooth support Roderick Colenbrander
2021-01-07 20:18 ` Barnabás Pőcze
2021-01-02 22:31 ` [PATCH v2 08/13] HID: playstation: add DualSense classic rumble support Roderick Colenbrander
2021-01-07 20:41 ` Barnabás Pőcze
2021-01-07 20:48 ` Barnabás Pőcze
2021-01-08 17:01 ` Roderick Colenbrander
2021-01-02 22:31 ` [PATCH v2 09/13] HID: playstation: add DualSense lightbar support Roderick Colenbrander
2021-01-07 21:01 ` Barnabás Pőcze
2021-01-02 22:31 ` [PATCH v2 10/13] HID: playstation: add microphone mute support for DualSense Roderick Colenbrander
2021-01-07 21:57 ` Barnabás Pőcze
2021-01-02 22:31 ` [PATCH v2 11/13] HID: playstation: add DualSense player LEDs support Roderick Colenbrander
2021-01-07 22:17 ` Barnabás Pőcze
2021-01-02 22:31 ` [PATCH v2 12/13] HID: playstation: DualSense set LEDs to default player id Roderick Colenbrander
2021-01-07 22:25 ` Barnabás Pőcze
2021-01-02 22:31 ` [PATCH v2 13/13] HID: playstation: report DualSense hardware and firmware version Roderick Colenbrander
2021-01-07 22:26 ` Barnabás Pőcze
2021-01-09 1:35 ` Roderick Colenbrander
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='oMAXtdv54Nx6A2ugm9PmU5jd430MrPZPoJ01iEcCtUXZ5dxzHQc3hqTxp_Mb-2oKdtBEAd-U3QsTD2JFROklqtvl4HV-BB7LGDfn1d3MnUg=@protonmail.com' \
--to=pobrn@protonmail.com \
--cc=benjamin.tissoires@redhat.com \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=lzye@google.com \
--cc=roderick.colenbrander@sony.com \
--cc=roderick@gaikai.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).