summaryrefslogtreecommitdiff
path: root/drivers/hid/hid-uclogic-params.h
diff options
context:
space:
mode:
authorJosé Expósito <jose.exposito89@gmail.com>2022-12-26 13:54:52 +0100
committerJiri Kosina <jkosina@suse.cz>2023-01-18 09:44:57 +0100
commita251d6576d2a29fc0806ef4775719e3b6e672d91 (patch)
treedc01207f77f9300469c0ca9f7e8916a3e7bfd178 /drivers/hid/hid-uclogic-params.h
parentbd85c131b2e3edf2cf1a498652e8c3a066a338e7 (diff)
HID: uclogic: Handle wireless device reconnection
UGEEv2 tablets with battery can be connected using a USB cable or a USB Bluetooth dongle. When the Bluetooth dongle is used, the connection to that tablet can be lost because the tablet is out of the range of the receiver or because it was switched off using the switch placed in the back of the tablet's frame. After losing connection, the tablet is able to reconnect automatically and its firmware sends a special packet indicating that the device was reconnected. In response to this packet, the tablet needs to receive the same array of magic data it expects on probe to enable its interfaces. This patch implements a generic mechanism to hook raw events and schedule a work to perform any custom action. Tested-by: Mia Kanashi <chad@redpilled.dev> Tested-by: Andreas Grosse <andig.mail@t-online.de> Signed-off-by: José Expósito <jose.exposito89@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-uclogic-params.h')
-rw-r--r--drivers/hid/hid-uclogic-params.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/hid/hid-uclogic-params.h b/drivers/hid/hid-uclogic-params.h
index b0e7f3807939..d6ffadb2f601 100644
--- a/drivers/hid/hid-uclogic-params.h
+++ b/drivers/hid/hid-uclogic-params.h
@@ -18,6 +18,7 @@
#include <linux/usb.h>
#include <linux/hid.h>
+#include <linux/list.h>
#define UCLOGIC_MOUSE_FRAME_QUIRK BIT(0)
#define UCLOGIC_BATTERY_QUIRK BIT(1)
@@ -177,6 +178,17 @@ struct uclogic_params_frame {
};
/*
+ * List of works to be performed when a certain raw event is received.
+ */
+struct uclogic_raw_event_hook {
+ struct hid_device *hdev;
+ __u8 *event;
+ size_t size;
+ struct work_struct work;
+ struct list_head list;
+};
+
+/*
* Tablet interface report parameters.
*
* Must use declarative (descriptive) language, not imperative, to simplify
@@ -216,6 +228,10 @@ struct uclogic_params {
* parts. Only valid, if "invalid" is false.
*/
struct uclogic_params_frame frame_list[3];
+ /*
+ * List of event hooks.
+ */
+ struct uclogic_raw_event_hook *event_hooks;
};
/* Driver data */