Thread (43 messages) 43 messages, 6 authors, 2020-12-31

Re: [PATCH 04/13] HID: playstation: add DualSense touchpad support.

From: Roderick Colenbrander <hidden>
Date: 2020-12-26 22:28:09

Hi Samuel,

Thanks for your review.


On Fri, Dec 25, 2020 at 6:14 PM Samuel Čavoj [off-list ref] wrote:
Hello,

thank you for this driver. It makes me really happy to see an official
one. Just a small thing I noticed while reading through it:


On 18.12.2020 22:23, Roderick Colenbrander wrote:
quoted
@@ -311,6 +345,25 @@ static int dualsense_parse_report(struct ps_device *ps_dev, struct hid_report *r
      input_report_key(ds->gamepad, BTN_MODE, ds_report->buttons[2] & DS_BUTTONS2_PS_HOME);
      input_sync(ds->gamepad);

+     input_report_key(ds->touchpad, BTN_LEFT, ds_report->buttons[2] & DS_BUTTONS2_TOUCHPAD);
The above line is duplicated right before the input_sync (marked). Is
there any reason for this or is it accidental?
Good catch. It was purely accidental as the code went through many
rebases and code shuffling. So a little artifact..
quoted
+     for (i = 0; i < 2; i++) {
+             bool active = (ds_report->points[i].contact & 0x80) ? false : true;
+
+             input_mt_slot(ds->touchpad, i);
+             input_mt_report_slot_state(ds->touchpad, MT_TOOL_FINGER, active);
+
+             if (active) {
+                     int x = (ds_report->points[i].x_hi << 8) | ds_report->points[i].x_lo;
+                     int y = (ds_report->points[i].y_hi << 4) | ds_report->points[i].y_lo;
+
+                     input_report_abs(ds->touchpad, ABS_MT_POSITION_X, x);
+                     input_report_abs(ds->touchpad, ABS_MT_POSITION_Y, y);
+             }
+     }
+     input_mt_sync_frame(ds->touchpad);
+     input_report_key(ds->touchpad, BTN_LEFT, ds_report->buttons[2] & DS_BUTTONS2_TOUCHPAD);
Right here.
I will probably keep this one and take the other one out as this is
next to the other touchpad code.
quoted
+     input_sync(ds->touchpad);
+
Regards,
Samuel
Thanks,
Roderick
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help