All of lore.kernel.org
 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 v3 5/6] HID: Samsung : Add Samsung wireless action mouse support.
Date: Wed, 24 Jan 2024 21:40:27 +0530	[thread overview]
Message-ID: <20240124161029.3756075-6-sandeep.cs@samsung.com> (raw)
In-Reply-To: <20240124161029.3756075-1-sandeep.cs@samsung.com>

Add support for samsung wireless action mouse with input mapping events.

Device a004 (Samsung wireless action mouse)

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-ids.h     |  1 +
 drivers/hid/hid-samsung.c | 27 +++++++++++++++++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 621853b21923..43a990086225 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -1148,6 +1148,7 @@
 #define USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE	0x0600
 #define USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD	0x7021
 #define USB_DEVICE_ID_SAMSUNG_WIRELESS_GAMEPAD	0xa000
+#define USB_DEVICE_ID_SAMSUNG_WIRELESS_ACTIONMOUSE	0xa004
 
 #define USB_VENDOR_ID_SEMICO			0x1a2c
 #define USB_DEVICE_ID_SEMICO_USB_KEYKOARD	0x0023
diff --git a/drivers/hid/hid-samsung.c b/drivers/hid/hid-samsung.c
index b786888ec077..df0de72062b7 100644
--- a/drivers/hid/hid-samsung.c
+++ b/drivers/hid/hid-samsung.c
@@ -334,6 +334,29 @@ static int samsung_gamepad_input_mapping(struct hid_device *hdev,
 	return 1;
 }
 
+static int samsung_actionmouse_input_mapping(struct hid_device *hdev,
+	struct hid_input *hi, struct hid_field *field, struct hid_usage *usage,
+	unsigned long **bit, int *max)
+{
+
+	dbg_hid("samsung wireless actionmouse input mapping event [0x%x], [0x%x], %ld, %ld, [0x%x]\n",
+			usage->hid, usage->hid & HID_USAGE, hi->input->evbit[0], hi->input->absbit[0],
+			usage->hid & HID_USAGE_PAGE);
+
+	if (((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER) && ((usage->hid & HID_USAGE_PAGE) != HID_UP_BUTTON))
+		return 0;
+
+	switch (usage->hid & HID_USAGE) {
+	case 0x301:
+		samsung_kbd_mouse_map_key_clear(254);
+		break;
+	default:
+		return 0;
+	}
+
+	return 1;
+}
+
 static __u8 *samsung_report_fixup(struct hid_device *hdev, __u8 *rdesc,
 	unsigned int *rsize)
 {
@@ -357,6 +380,9 @@ static int samsung_input_mapping(struct hid_device *hdev, struct hid_input *hi,
 	else if (hdev->product == USB_DEVICE_ID_SAMSUNG_WIRELESS_GAMEPAD)
 		ret = samsung_gamepad_input_mapping(hdev,
 			hi, field, usage, bit, max);
+	else if (hdev->product == USB_DEVICE_ID_SAMSUNG_WIRELESS_ACTIONMOUSE)
+		ret = samsung_actionmouse_input_mapping(hdev,
+			hi, field, usage, bit, max);
 
 	return ret;
 }
@@ -401,6 +427,7 @@ static const struct hid_device_id samsung_devices[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE) },
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SAMSUNG_ELECTRONICS, USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD) },
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SAMSUNG_ELECTRONICS, USB_DEVICE_ID_SAMSUNG_WIRELESS_GAMEPAD) },
+	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SAMSUNG_ELECTRONICS, USB_DEVICE_ID_SAMSUNG_WIRELESS_ACTIONMOUSE) },
 	{ }
 };
 MODULE_DEVICE_TABLE(hid, samsung_devices);
-- 
2.34.1


  parent reply	other threads:[~2024-01-24 16:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20240124161058epcas5p40b641fe9049630c2a9ce69cab17c40b9@epcas5p4.samsung.com>
2024-01-24 16:10 ` [HID Patchsets for Samsung driver v3 0/6] Sandeep C S
     [not found]   ` <CGME20240124161105epcas5p2d1ba581f56e7c0a401a68790202f663b@epcas5p2.samsung.com>
2024-01-24 16:10     ` [HID Patchsets for Samsung driver v3 1/6] HID Samsung : Broaden device compatibility in samsung driver Sandeep C S
     [not found]   ` <CGME20240124161113epcas5p154500f0e71e1145e94f2779ca4c92948@epcas5p1.samsung.com>
2024-01-24 16:10     ` [HID Patchsets for Samsung driver v3 2/6] HID: Samsung : Fix the checkpatch complain. Rewritten code using memcmp where applicable Sandeep C S
     [not found]   ` <CGME20240124161121epcas5p1fef1a14624b26cc436b899d9f6cde164@epcas5p1.samsung.com>
2024-01-24 16:10     ` [HID Patchsets for Samsung driver v3 3/6] HID: Samsung : Add Samsung wireless keyboard support Sandeep C S
2024-01-24 18:19       ` Jiri Kosina
2024-01-25  1:51         ` sandeep.cs
2024-01-25  2:56         ` sandeep.cs
     [not found]   ` <CGME20240124161128epcas5p38a703fcedbacb6e506d9c46579b07b04@epcas5p3.samsung.com>
2024-01-24 16:10     ` [HID Patchsets for Samsung driver v3 4/6] HID: Samsung : Add Samsung wireless gamepad support Sandeep C S
     [not found]   ` <CGME20240124161134epcas5p3f9f50330015d1d80d31087dac09d26da@epcas5p3.samsung.com>
2024-01-24 16:10     ` Sandeep C S [this message]
     [not found]   ` <CGME20240124161142epcas5p42fe248ea16530b66c617890bc495234b@epcas5p4.samsung.com>
2024-01-24 16:10     ` [HID Patchsets for Samsung driver v3 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=20240124161029.3756075-6-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.