aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2020-11-01 17:32:21 +0200
committerKimplul <kimi.h.kuparinen@gmail.com>2020-11-01 17:32:21 +0200
commitdfd059d79ba75f45c0736f822146c6e6d812c1a4 (patch)
treeb0cd84d16c15e4926f4ff65dfeb48ad7eb2c205b
parentf4faf301ef8ce9e86a092569f5656293fb4de666 (diff)
downloadhid-tmff2-dfd059d79ba75f45c0736f822146c6e6d812c1a4.tar.gz
hid-tmff2-dfd059d79ba75f45c0736f822146c6e6d812c1a4.zip
Fixed periodic offset
-rw-r--r--force-effects.txt8
-rw-r--r--hid-tminit.c5
-rw-r--r--hid-tmt300rs.c12
3 files changed, 15 insertions, 10 deletions
diff --git a/force-effects.txt b/force-effects.txt
index 4f6973e..146adaa 100644
--- a/force-effects.txt
+++ b/force-effects.txt
@@ -258,8 +258,8 @@ FF_PERIODIC:
01 - ID
6b - new periodic effect
00 00 - magnitude ***
- fe ff - phase (left/right)
- 00 00 - offset of effect (forward/backward)
+ fe ff - offset (up/down)
+ 00 00 - phase (left/right)
e8 03 - period
00 80
00 00 - attack_length
@@ -293,7 +293,7 @@ FF_PERIODIC:
offset of effect:
60 00
02 - ID
- 0e 04
+ 0e 02
64 35 - value, signed (between 00 00 and ff 7f?)
00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
@@ -303,7 +303,7 @@ FF_PERIODIC:
phase:
60 00
02 - ID
- 0e 02
+ 0e 04
64 35 - value, signed (between 80 01 and ff 7f?)
00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
diff --git a/hid-tminit.c b/hid-tminit.c
index 8cd5dbb..37a034a 100644
--- a/hid-tminit.c
+++ b/hid-tminit.c
@@ -120,6 +120,7 @@ void tminit_controls(struct hid_device *hdev){
if(ret < 0){
hid_err(hdev, "failed with the ctrl: %i", ret);
}
+
ret = usb_control_msg(usbdev,
usb_rcvctrlpipe(usbdev, 0),
86,
@@ -147,6 +148,10 @@ int tminit(struct hid_device *hdev){
tminit_interrupts(hdev);
+ if(ret < 0){
+ hid_err(hdev, "failed with the ctrl: %i", ret);
+ }
+
setup_packet = kmalloc(8, GFP_ATOMIC);
transfer_buffer = kmalloc(8, GFP_ATOMIC);
diff --git a/hid-tmt300rs.c b/hid-tmt300rs.c
index e92dc94..5c4f636 100644
--- a/hid-tmt300rs.c
+++ b/hid-tmt300rs.c
@@ -475,7 +475,7 @@ static int t300rs_modify_periodic(struct t300rs_device_entry *t300rs, struct t30
send_buffer[0] = 0x60;
send_buffer[2] = effect.id + 1;
send_buffer[3] = 0x0e;
- send_buffer[4] = 0x04;
+ send_buffer[4] = 0x02;
send_buffer[5] = le_offset & 0xff;
send_buffer[6] = le_offset >> 8;
@@ -494,7 +494,7 @@ static int t300rs_modify_periodic(struct t300rs_device_entry *t300rs, struct t30
send_buffer[0] = 0x60;
send_buffer[2] = effect.id + 1;
send_buffer[3] = 0x0e;
- send_buffer[4] = 0x02;
+ send_buffer[4] = 0x04;
send_buffer[5] = le_phase & 0xff;
send_buffer[6] = le_phase >> 8;
@@ -853,11 +853,11 @@ static int t300rs_upload_periodic(struct t300rs_device_entry *t300rs, struct t30
send_buffer[4] = le_magnitude & 0xff;
send_buffer[5] = le_magnitude >> 8;
- send_buffer[6] = le_phase & 0xff;
- send_buffer[7] = le_phase >> 8;
+ send_buffer[8] = le_phase & 0xff;
+ send_buffer[9] = le_phase >> 8;
- send_buffer[8] = le_periodic_offset & 0xff;
- send_buffer[9] = le_periodic_offset >> 8;
+ send_buffer[6] = le_periodic_offset & 0xff;
+ send_buffer[7] = le_periodic_offset >> 8;
send_buffer[10] = le_period & 0xff;
send_buffer[11] = le_period >> 8;