aboutsummaryrefslogtreecommitdiff
path: root/tminit.h
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2024-04-16 00:21:50 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2024-04-16 01:08:50 +0300
commit031ef062ac01af9f2ff4b41dde9a89e460f8168d (patch)
treef946fc45b80f94c9dee1869417c5d22416475d18 /tminit.h
parent9cd09c9dadbdd01f159e34142841954a7e41a09b (diff)
downloadhid-tminit-031ef062ac01af9f2ff4b41dde9a89e460f8168d.tar.gz
hid-tminit-031ef062ac01af9f2ff4b41dde9a89e460f8168d.zip
test duplicating driver
Diffstat (limited to 'tminit.h')
-rw-r--r--tminit.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/tminit.h b/tminit.h
new file mode 100644
index 0000000..9e4037d
--- /dev/null
+++ b/tminit.h
@@ -0,0 +1,62 @@
+#ifndef TMINIT_H
+#define TMINIT_H
+
+#include <linux/usb.h>
+
+/*
+ * This structs contains (in little endian) the response data
+ * of the wheel to the request 73
+ *
+ * A sufficient research to understand what each field does is not
+ * beign conducted yet. The position and meaning of fields are a
+ * just a very optimistic guess based on instinct....
+ */
+struct __packed tm_wheel_response
+{
+ /*
+ * Seems to be the type of packet
+ * - 0x0049 if is data.a (15 bytes)
+ * - 0x0047 if is data.b (7 bytes)
+ */
+ uint16_t type;
+
+ union {
+ struct __packed {
+ uint16_t field0;
+ uint16_t field1;
+ /*
+ * Seems to be the model code of the wheel
+ * Read table thrustmaster_wheels to values
+ */
+ uint8_t attachment;
+ uint8_t model;
+
+ uint16_t field2;
+ uint16_t field3;
+ uint16_t field4;
+ uint16_t field5;
+ } a;
+ struct __packed {
+ uint16_t field0;
+ uint16_t field1;
+ uint8_t attachment;
+ uint8_t model;
+ } b;
+ } data;
+};
+
+struct tm_wheel {
+ struct usb_device *usb_dev;
+ struct usb_interface *interface;
+ struct urb *urb;
+
+ struct usb_ctrlrequest *model_request;
+ struct tm_wheel_response *response;
+
+ struct usb_ctrlrequest *change_request;
+};
+
+int thrustmaster_probe(struct tm_wheel *wheel, struct usb_interface *interface);
+void thrustmaster_disconnect(struct tm_wheel *wheel);
+
+#endif /* TMINIT_H */