From b2778ac44ee6d26ace3a403fe4fb014cf25cba8f Mon Sep 17 00:00:00 2001 From: kimi Date: Tue, 23 Jun 2020 10:28:52 -0400 Subject: We have motion! --- README.md | 3 +++ hid-tmff2.c | 25 +++++++++++++++++-------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 8668174..14095ce 100644 --- a/README.md +++ b/README.md @@ -12,3 +12,6 @@ ``` And possibly some ```sudo depmod -a && sudo modprobe hid-tmff2``` To see if the driver is being loaded, run ```dmesg```. The feed should be filled with debugging messages that honestly probably should be improved. A lot. + +GOOD NEWS, EVERYBODY! +I managed to make the wheel turn! Still nowhere near usable as a, y'know, actual wheel, but were getting somewhere boys and girls!!!!!!! diff --git a/hid-tmff2.c b/hid-tmff2.c index 08849cd..51bda48 100644 --- a/hid-tmff2.c +++ b/hid-tmff2.c @@ -194,7 +194,15 @@ static u8 t300rs_fin_6[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; -static u8 *t300rs_fin_arr[] = {t300rs_fin_0, t300rs_fin_1, t300rs_fin_2, t300rs_fin_3, t300rs_fin_4, t300rs_fin_5, t300rs_fin_6 }; + +static u8 t300rs_fin_7[] = { +0x60, 0x00, 0x01, 0x89, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + +static u8 *t300rs_fin_arr[] = {t300rs_fin_0, t300rs_fin_1, t300rs_fin_2, t300rs_fin_3, t300rs_fin_4, t300rs_fin_5, t300rs_fin_6, t300rs_fin_7 }; static unsigned int t300rs_fin_sizes[] = { ARRAY_SIZE(t300rs_fin_0), ARRAY_SIZE(t300rs_fin_1), @@ -202,7 +210,8 @@ ARRAY_SIZE(t300rs_fin_2), ARRAY_SIZE(t300rs_fin_3), ARRAY_SIZE(t300rs_fin_4), ARRAY_SIZE(t300rs_fin_5), -ARRAY_SIZE(t300rs_fin_6) +ARRAY_SIZE(t300rs_fin_6), +ARRAY_SIZE(t300rs_fin_7) }; struct tmff_device { @@ -336,11 +345,11 @@ static int tmff_play(struct input_dev *dev, void *data, ff_field->logical_minimum, ff_field->logical_maximum); - printk("(x, y)=(%04x, %04x)\n", x, y); - //send_buf[4] = x; - //send_buf[5] = y; + send_buf[4] = x; + send_buf[5] = y; + + printk("x = %i y = %i\n", x, y); - printk("Reached debug point 6"); usb_fill_int_urb( urb, @@ -730,7 +739,7 @@ static int tmff_afterthought_t300rs(struct hid_device *hid){ send_buf = kmalloc(256, GFP_ATOMIC); /* overkill but whatever */ rq_buf = kmalloc(256, GFP_ATOMIC); - for(i = 0; i < 7; ++i){ + for(i = 0; i < ARRAY_SIZE(t300rs_fin_sizes); ++i){ memcpy(send_buf, t300rs_fin_arr[i], t300rs_fin_sizes[i]); err = usb_interrupt_msg(usbdev, @@ -773,7 +782,7 @@ static int tm_probe(struct hid_device *hdev, const struct hid_device_id *id) } - ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF); + ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT /* & ~HID_CONNECT_FF*/); if (ret) { hid_err(hdev, "hw start failed\n"); goto err; -- cgit v1.3