linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sandeep C S <sandeep.cs@samsung.com>
To: Jiri Kosina <jikos@kernel.org>,
	Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: gaudium.lee@samsung.com, ih0923.kim@samsung.com,
	suhyun_.kim@samsung.com, jitender.s21@samsung.com,
	junwan.cho@samsung.com, sandeep.cs@samsung.com,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [HID Patchsets for Samsung driver v2 1/6] HID Samsung : Broaden device compatibility in samsung driver.
Date: Mon,  8 Jan 2024 14:49:11 +0530	[thread overview]
Message-ID: <20240108091917.1552013-2-sandeep.cs@samsung.com> (raw)
In-Reply-To: <20240108091917.1552013-1-sandeep.cs@samsung.com>

The USB validation check has been moved wherever its required.

Earlier Samsung driver only handles USB HID devices and returns an error if it encounters a Bluetooth type of HID device.
This changes improves driver compatibility and extends its support for a wide range of devices.

Signed-off-by: Sandeep C S <sandeep.cs@samsung.com>
Signed-off-by: Junwan Cho <junwan.cho@samsung.com>
Signed-off-by: Jitender Sajwan <jitender.s21@samsung.com>
---
 drivers/hid/hid-samsung.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/hid/hid-samsung.c b/drivers/hid/hid-samsung.c
index cf5992e97094..885657531607 100644
--- a/drivers/hid/hid-samsung.c
+++ b/drivers/hid/hid-samsung.c
@@ -128,7 +128,7 @@ static int samsung_kbd_mouse_input_mapping(struct hid_device *hdev,
 static __u8 *samsung_report_fixup(struct hid_device *hdev, __u8 *rdesc,
 	unsigned int *rsize)
 {
-	if (USB_DEVICE_ID_SAMSUNG_IR_REMOTE == hdev->product)
+	if (USB_DEVICE_ID_SAMSUNG_IR_REMOTE == hdev->product  && hid_is_usb(hdev))
 		rdesc = samsung_irda_report_fixup(hdev, rdesc, rsize);
 	return rdesc;
 }
@@ -139,7 +139,7 @@ static int samsung_input_mapping(struct hid_device *hdev, struct hid_input *hi,
 {
 	int ret = 0;
 
-	if (USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE == hdev->product)
+	if (USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE == hdev->product  && hid_is_usb(hdev))
 		ret = samsung_kbd_mouse_input_mapping(hdev,
 			hi, field, usage, bit, max);
 
@@ -152,9 +152,6 @@ static int samsung_probe(struct hid_device *hdev,
 	int ret;
 	unsigned int cmask = HID_CONNECT_DEFAULT;
 
-	if (!hid_is_usb(hdev))
-		return -EINVAL;
-
 	ret = hid_parse(hdev);
 	if (ret) {
 		hid_err(hdev, "parse failed\n");
@@ -162,6 +159,10 @@ static int samsung_probe(struct hid_device *hdev,
 	}
 
 	if (USB_DEVICE_ID_SAMSUNG_IR_REMOTE == hdev->product) {
+		if (!hid_is_usb(hdev)) {
+			ret = -EINVAL;
+			goto err_free;
+		}
 		if (hdev->rsize == 184) {
 			/* disable hidinput, force hiddev */
 			cmask = (cmask & ~HID_CONNECT_HIDINPUT) |
-- 
2.34.1


  parent reply	other threads:[~2024-01-08  9:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20240108091950epcas5p41633efaf7b62db312982aa2f94a26db3@epcas5p4.samsung.com>
2024-01-08  9:19 ` [HID Patchsets for Samsung driver v2 0/6] HID Support for Samsung driver Sandeep C S
     [not found]   ` <CGME20240108091954epcas5p39f9ca04b57adf01a7c964593b7be87d2@epcas5p3.samsung.com>
2024-01-08  9:19     ` Sandeep C S [this message]
     [not found]   ` <CGME20240108091959epcas5p2559b779424e2fb7c7e268d1b24612b4f@epcas5p2.samsung.com>
2024-01-08  9:19     ` [HID Patchsets for Samsung driver v2 2/6] HID: Samsung : Fix the checkpatch complain Sandeep C S
2024-01-08 10:21       ` Joe Perches
2024-01-08 10:44         ` sandeep.cs
2024-01-09  2:34           ` Joe Perches
2024-01-23  9:49           ` Jiri Kosina
2024-01-23 10:04             ` sandeep.cs
     [not found]   ` <CGME20240108092004epcas5p1c7069a6ede85066817d8ce5a79da75ad@epcas5p1.samsung.com>
2024-01-08  9:19     ` [HID Patchsets for Samsung driver v2 3/6] HID: Samsung : Add Samsung wireless keyboard support Sandeep C S
     [not found]   ` <CGME20240108092009epcas5p15c5be87fa427a5c4426c55c86c5ce3bc@epcas5p1.samsung.com>
2024-01-08  9:19     ` [HID Patchsets for Samsung driver v2 4/6] HID: Samsung : Add Samsung wireless gamepad support Sandeep C S
     [not found]   ` <CGME20240108092017epcas5p24c1c263149a0a8bf3204c86925e3cfd9@epcas5p2.samsung.com>
2024-01-08  9:19     ` [HID Patchsets for Samsung driver v2 5/6] HID: Samsung : Add Samsung wireless action mouse support Sandeep C S
     [not found]   ` <CGME20240108092025epcas5p39e2ecb3b12b4fba9e41f0694f430ec1d@epcas5p3.samsung.com>
2024-01-08  9:19     ` [HID Patchsets for Samsung driver v2 6/6] HID: Samsung : Add Samsung wireless bookcover and universal keyboard support Sandeep C S

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=20240108091917.1552013-2-sandeep.cs@samsung.com \
    --to=sandeep.cs@samsung.com \
    --cc=benjamin.tissoires@redhat.com \
    --cc=gaudium.lee@samsung.com \
    --cc=ih0923.kim@samsung.com \
    --cc=jikos@kernel.org \
    --cc=jitender.s21@samsung.com \
    --cc=junwan.cho@samsung.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=suhyun_.kim@samsung.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).