diff options
| author | kimi <kimi.h.kuparinen@gmail.com> | 2020-06-27 12:51:15 -0400 |
|---|---|---|
| committer | kimi <kimi.h.kuparinen@gmail.com> | 2020-06-27 12:51:15 -0400 |
| commit | ca37551b7672ac9af70977df006cf86f0af5cd7b (patch) | |
| tree | 7ac91e284c95f242fd59e67449ff3cf9047b4b2d /hid-tmff2.c | |
| parent | c975940c88575b0c84c8d1f14df9b7ae5f02a90a (diff) | |
| download | hid-tmff2-ca37551b7672ac9af70977df006cf86f0af5cd7b.tar.gz hid-tmff2-ca37551b7672ac9af70977df006cf86f0af5cd7b.zip | |
further
Diffstat (limited to 'hid-tmff2.c')
| -rw-r--r-- | hid-tmff2.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/hid-tmff2.c b/hid-tmff2.c index 2f1090c..aebfbff 100644 --- a/hid-tmff2.c +++ b/hid-tmff2.c @@ -63,8 +63,6 @@ static unsigned int setup_arr_sizes[] = { ARRAY_SIZE(setup_4) }; -u8 new_value = 0; - static u8 hw_rq_in[] = { 0xc1, 0x49, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00 }; static u8 hw_rq_out[] = { 0x41, 0x53, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00 }; static u8 ff_constant_array[] = { @@ -343,7 +341,7 @@ static int tmff_play(struct input_dev *dev, void *data, struct usb_device *usbdev = interface_to_usbdev(usbif); struct usb_host_endpoint *ep; - if(ktime_get_ns() - last < 4000000){ + if((ktime_get_ns() - last) < 4000000){ return 0; } @@ -363,19 +361,23 @@ static int tmff_play(struct input_dev *dev, void *data, x = tmff_scale_s8(effect->u.ramp.start_level, ff_field->logical_minimum, ff_field->logical_maximum); - new_value = x; + y = tmff_scale_s8(effect->u.ramp.end_level, + ff_field->logical_minimum, + ff_field->logical_maximum); + if(x == 128){ memcpy(send_buf, ff_stop_array, ARRAY_SIZE(ff_stop_array)); } else { - if(x < 128){ + /*if(x < 128){ x = 128 - x; } else if(x > 128){ x = 256 - (x - 128); - } + }*/ - send_buf[5] = x; + send_buf[4] = x; + send_buf[5] = y; } |
