Skip to content

Commit

Permalink
HID: samsung: Broaden device compatibility in samsung driver
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
  • Loading branch information
Sandeep C S authored and Jiri Kosina committed Jan 25, 2024
1 parent fef018d commit ac203cd
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions drivers/hid/hid-samsung.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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);

Expand All @@ -152,16 +152,17 @@ 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");
goto err_free;
}

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) |
Expand Down

0 comments on commit ac203cd

Please sign in to comment.