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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi


2021. január 2., szombat 23:31 keltezéssel, Roderick Colenbrander írta:

> From: Roderick Colenbrander <roderick.colenbrander@xxxxxxxx>
>
> Implement support for DualSense touchpad as a separate input device.
>
> Signed-off-by: Roderick Colenbrander <roderick.colenbrander@xxxxxxxx>
> [...]
> +static struct input_dev *ps_touchpad_create(struct hid_device *hdev, int width, int height,
> +		unsigned int num_contacts)
> +{
> +	struct input_dev *touchpad;
> +	int ret;
> +
> +	touchpad = ps_allocate_input_dev(hdev, "Touchpad");
> +	if (IS_ERR(touchpad))
> +		return ERR_PTR(-ENOMEM);

I know that at the moment ENOMEM is the only possible error, but I believe
`return ERR_CAST(touchpad);` would be better. (Or even just `return touchpad;`.)


> +
> +	/* Map button underneath touchpad to BTN_LEFT. */
> +	input_set_capability(touchpad, EV_KEY, BTN_LEFT);
> +	__set_bit(INPUT_PROP_BUTTONPAD, touchpad->propbit);
> +
> +	input_set_abs_params(touchpad, ABS_MT_POSITION_X, 0, width - 1, 0, 0);
> +	input_set_abs_params(touchpad, ABS_MT_POSITION_Y, 0, height - 1, 0, 0);
> +
> +	ret = input_mt_init_slots(touchpad, num_contacts, INPUT_MT_POINTER);
> +	if (ret)
> +		return ERR_PTR(ret);
> +
> +	ret = input_register_device(touchpad);
> +	if (ret)
> +		return ERR_PTR(ret);
> +
> +	return touchpad;
> +}
> [...]




[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux