-
-
Save StollD/89f1c8d094c41e6ab5e3bbbe0dd0335b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 12563a931cb533ca82319f1db783f1516341c4ea Mon Sep 17 00:00:00 2001 | |
From: Dorian Stoll <dorian.stoll@tmsp.io> | |
Date: Tue, 19 May 2020 16:33:33 +0200 | |
Subject: [PATCH 1/2] host2me-feedback | |
--- | |
control.c | 29 +++++++++++++++++++++++++++++ | |
control.h | 2 ++ | |
protocol/feedback.h | 13 ++++++++++++- | |
3 files changed, 43 insertions(+), 1 deletion(-) | |
diff --git a/control.c b/control.c | |
index 9179eca..9d2f892 100644 | |
--- a/control.c | |
+++ b/control.c | |
@@ -57,6 +57,35 @@ int ipts_control_send_feedback(struct ipts_context *ipts, | |
&cmd, sizeof(struct ipts_feedback_cmd)); | |
} | |
+int ipts_control_send_host2me_feedback(struct ipts_context *ipts, | |
+ u32 feedback_type, u8 *data, size_t size) | |
+{ | |
+ struct ipts_buffer_info host2me; | |
+ struct ipts_feedback *feedback; | |
+ struct ipts_feedback_cmd cmd; | |
+ | |
+ host2me = ipts->host2me; | |
+ feedback = (struct ipts_feedback *)host2me.address; | |
+ | |
+ memset(feedback, 0, sizeof(struct ipts_feedback)); | |
+ memset(&cmd, 0, sizeof(struct ipts_feedback_cmd)); | |
+ | |
+ feedback->type = IPTS_FEEDBACK_TYPE_NONE; | |
+ feedback->feedback_data_type = feedback_type; | |
+ feedback->size = size; | |
+ feedback->transaction = 16; | |
+ feedback->reserved[4] = 0xAC; | |
+ | |
+ if (data && size > 0) | |
+ memcpy(feedback->data, data, size); | |
+ | |
+ cmd.buffer = 16; | |
+ cmd.transaction = 0; | |
+ | |
+ return ipts_control_send(ipts, IPTS_CMD(FEEDBACK), | |
+ &cmd, sizeof(struct ipts_feedback_cmd)); | |
+} | |
+ | |
int ipts_control_start(struct ipts_context *ipts) | |
{ | |
ipts->status = IPTS_HOST_STATUS_INIT; | |
diff --git a/control.h b/control.h | |
index e57609c..fabd7f7 100644 | |
--- a/control.h | |
+++ b/control.h | |
@@ -14,5 +14,7 @@ int ipts_control_send(struct ipts_context *ipts, | |
u32 cmd, void *data, u32 size); | |
int ipts_control_send_feedback(struct ipts_context *ipts, | |
u32 buffer, u32 transaction); | |
+int ipts_control_send_host2me_feedback(struct ipts_context *ipts, | |
+ u32 feedback_type, u8 *data, size_t size); | |
#endif /* _IPTS_CONTROL_H_ */ | |
diff --git a/protocol/feedback.h b/protocol/feedback.h | |
index 8b3d8b6..bb4529c 100644 | |
--- a/protocol/feedback.h | |
+++ b/protocol/feedback.h | |
@@ -17,11 +17,22 @@ enum ipts_feedback_type { | |
IPTS_FEEDBACK_TYPE_MAX | |
}; | |
+enum ipts_feedback_data_types { | |
+ IPTS_FEEDBACK_DATA_TYPE_FEEDBACK = 0, | |
+ IPTS_FEEDBACK_DATA_TYPE_SET_FEATURES, | |
+ IPTS_FEEDBACK_DATA_TYPE_GET_FEATURES, | |
+ IPTS_FEEDBACK_DATA_TYPE_OUTPUT_REPORT, | |
+ IPTS_FEEDBACK_DATA_TYPE_STORE_DATA, | |
+ IPTS_FEEDBACK_DATA_TYPE_MAX | |
+}; | |
+ | |
struct ipts_feedback { | |
u32 type; | |
u32 size; | |
u32 transaction; | |
- u8 reserved[52]; | |
+ u32 protocol_ver; | |
+ u32 feedback_data_type; | |
+ u8 reserved[44]; | |
u8 data[]; | |
} __packed; | |
-- | |
2.26.2 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From c8edb1c65e46cfa743e79dedf173d7967c5d8c32 Mon Sep 17 00:00:00 2001 | |
From: Dorian Stoll <dorian.stoll@tmsp.io> | |
Date: Sat, 23 May 2020 10:43:54 +0200 | |
Subject: [PATCH 2/2] get-features-test | |
--- | |
data.c | 12 ++++++++++++ | |
1 file changed, 12 insertions(+) | |
diff --git a/data.c b/data.c | |
index 568bf04..768e38d 100644 | |
--- a/data.c | |
+++ b/data.c | |
@@ -10,21 +10,33 @@ | |
#include "params.h" | |
#include "payload.h" | |
#include "protocol/data.h" | |
+#include "protocol/feedback.h" | |
static void ipts_data_handle_input(struct ipts_context *ipts, int buffer_id) | |
{ | |
struct ipts_buffer_info buffer; | |
struct ipts_data *data; | |
+ u32 wdata[3]; | |
+ | |
buffer = ipts->data[buffer_id]; | |
data = (struct ipts_data *)buffer.address; | |
if (ipts_params.debug) { | |
+ dev_info(ipts->dev, "Type: %d\n", data->type); | |
dev_info(ipts->dev, "Buffer %d\n", buffer_id); | |
print_hex_dump(KERN_INFO, "", DUMP_PREFIX_NONE, 32, 1, | |
data->data, data->size, false); | |
} | |
+ wdata[0] = 0x4; // TOUCH_WRITE_DATA_TYPE_GET_FEATURES | |
+ wdata[1] = 0x1; // TOUCH_WRITE_HDR.WriteDataLen | |
+ wdata[2] = 0x8; // HID report ID | |
+ | |
+ ipts_control_send_host2me_feedback(ipts, | |
+ IPTS_FEEDBACK_DATA_TYPE_GET_FEATURES, | |
+ (u8 *)wdata, sizeof(wdata) * 4); | |
+ | |
switch (data->type) { | |
case IPTS_DATA_TYPE_PAYLOAD: | |
ipts_payload_handle_input(ipts, data); | |
-- | |
2.26.2 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment