summaryrefslogtreecommitdiffstats
path: root/input
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2007-08-03 13:43:24 +0000
committerClaudio Takahasi <claudio.takahasi@openbossa.org>2007-08-03 13:43:24 +0000
commit2639da11e06cc2d91c7c3416068333587f2b5df1 (patch)
tree59799792f005ab23f43dfa91714b7663dc0ce950 /input
parentebd3c8b3a8fe0ec8050077e7739dba0b25aec2a1 (diff)
input: added epox_endian_quirk function
Diffstat (limited to 'input')
-rw-r--r--input/manager.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/input/manager.c b/input/manager.c
index 74654893..75ab1c15 100644
--- a/input/manager.c
+++ b/input/manager.c
@@ -181,6 +181,31 @@ static int get_handles(struct pending_req *pr, const char *uuid,
return 0;
}
+static void epox_endian_quirk(unsigned char *data, int size)
+{
+ /* USAGE_PAGE (Keyboard) 05 07
+ * USAGE_MINIMUM (0) 19 00
+ * USAGE_MAXIMUM (65280) 2A 00 FF <= must be FF 00
+ * LOGICAL_MINIMUM (0) 15 00
+ * LOGICAL_MAXIMUM (65280) 26 00 FF <= must be FF 00
+ */
+ unsigned char pattern[] = { 0x05, 0x07, 0x19, 0x00, 0x2a, 0x00, 0xff,
+ 0x15, 0x00, 0x26, 0x00, 0xff };
+ int i;
+
+ if (!data)
+ return;
+
+ for (i = 0; i < size - sizeof(pattern); i++) {
+ if (!memcmp(data + i, pattern, sizeof(pattern))) {
+ data[i + 5] = 0xff;
+ data[i + 6] = 0x00;
+ data[i + 10] = 0xff;
+ data[i + 11] = 0x00;
+ }
+ }
+}
+
static void extract_hid_record(sdp_record_t *rec, struct hidp_connadd_req *req)
{
sdp_data_t *pdlist, *pdlist2;
@@ -233,6 +258,7 @@ static void extract_hid_record(sdp_record_t *rec, struct hidp_connadd_req *req)
memcpy(req->rd_data, (unsigned char *) pdlist->val.str,
pdlist->unitSize);
req->rd_size = pdlist->unitSize;
+ epox_endian_quirk(req->rd_data, req->rd_size);
}
}
}