diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2020-07-10 00:40:09 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2020-07-10 00:40:09 +0300 |
| commit | 2031f19d346e5abcfaa1feb35103fba52dd5c55c (patch) | |
| tree | 2a6a1ea652b700b191041bce2e670850cc861b94 | |
| parent | 6ab0a7ce8601e1b3ae24516d91e26ca116e8fce4 (diff) | |
| download | hid-tmff2-2031f19d346e5abcfaa1feb35103fba52dd5c55c.tar.gz hid-tmff2-2031f19d346e5abcfaa1feb35103fba52dd5c55c.zip | |
incremental additions
| -rw-r--r-- | Module.symvers | 0 | ||||
| -rw-r--r-- | compile_commands.json | 44 | ||||
| -rw-r--r-- | hid-tminit.ko | bin | 0 -> 419984 bytes | |||
| -rw-r--r-- | hid-tminit.mod | 2 | ||||
| -rw-r--r-- | hid-tminit.mod.c | 55 | ||||
| -rw-r--r-- | hid-tminit.mod.o | bin | 0 -> 143264 bytes | |||
| -rw-r--r-- | hid-tminit.o | bin | 0 -> 278312 bytes | |||
| -rw-r--r-- | hid-tmt300rs.c | 36 | ||||
| -rw-r--r-- | hid-tmt300rs.h | 2 | ||||
| -rw-r--r-- | hid-tmt300rs.ko | bin | 0 -> 537752 bytes | |||
| -rw-r--r-- | hid-tmt300rs.mod | 2 | ||||
| -rw-r--r-- | hid-tmt300rs.mod.c | 67 | ||||
| -rw-r--r-- | hid-tmt300rs.mod.o | bin | 0 -> 144040 bytes | |||
| -rw-r--r-- | hid-tmt300rs.o | bin | 0 -> 395304 bytes | |||
| -rw-r--r-- | modules.order | 2 | ||||
| -rw-r--r-- | todo.txt | 3 |
16 files changed, 166 insertions, 47 deletions
diff --git a/Module.symvers b/Module.symvers new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Module.symvers diff --git a/compile_commands.json b/compile_commands.json index ea1a16a..a75ead3 100644 --- a/compile_commands.json +++ b/compile_commands.json @@ -1,24 +1,24 @@ [ { "arguments": [ - "gcc", + "gcc-9", "-c", - "-Wp,-MD,/home/kimi/Documents/tmff2/.hid-tminit.o.d", + "-Wp,-MD,/home/kimi/Documents/Projects/hid-tmff2/.hid-tmt300rs.o.d", "-nostdinc", "-isystem", "/usr/lib/gcc/x86_64-linux-gnu/9/include", - "-I./arch/x86/include", + "-I/usr/src/linux-headers-5.7.0-1-common/arch/x86/include", "-I./arch/x86/include/generated", + "-I/usr/src/linux-headers-5.7.0-1-common/include", "-I./include", - "-I./arch/x86/include/uapi", + "-I/usr/src/linux-headers-5.7.0-1-common/arch/x86/include/uapi", "-I./arch/x86/include/generated/uapi", - "-I./include/uapi", + "-I/usr/src/linux-headers-5.7.0-1-common/include/uapi", "-I./include/generated/uapi", "-include", - "./include/linux/kconfig.h", - "-Iubuntu/include", + "/usr/src/linux-headers-5.7.0-1-common/include/linux/kconfig.h", "-include", - "./include/linux/compiler_types.h", + "/usr/src/linux-headers-5.7.0-1-common/include/linux/compiler_types.h", "-D__KERNEL__", "-Wall", "-Wundef", @@ -48,15 +48,6 @@ "-mno-red-zone", "-mcmodel=kernel", "-DCONFIG_X86_X32_ABI", - "-DCONFIG_AS_CFI=1", - "-DCONFIG_AS_CFI_SIGNAL_FRAME=1", - "-DCONFIG_AS_CFI_SECTIONS=1", - "-DCONFIG_AS_SSSE3=1", - "-DCONFIG_AS_AVX=1", - "-DCONFIG_AS_AVX2=1", - "-DCONFIG_AS_AVX512=1", - "-DCONFIG_AS_SHA1_NI=1", - "-DCONFIG_AS_SHA256_NI=1", "-Wno-sign-compare", "-fno-asynchronous-unwind-tables", "-mindirect-branch=thunk-extern", @@ -69,14 +60,13 @@ "-Wno-address-of-packed-member", "-O2", "--param=allow-store-data-races=0", - "-Wframe-larger-than=1024", + "-Wframe-larger-than=2048", "-fstack-protector-strong", "-Wno-unused-but-set-variable", "-Wimplicit-fallthrough", "-Wno-unused-const-variable", - "-fno-omit-frame-pointer", - "-fno-optimize-sibling-calls", "-fno-var-tracking-assignments", + "-g", "-pg", "-mrecord-mcount", "-mfentry", @@ -98,17 +88,17 @@ "-Werror=date-time", "-Werror=incompatible-pointer-types", "-Werror=designated-init", - "-fmacro-prefix-map=./=", + "-fmacro-prefix-map=/usr/src/linux-headers-5.7.0-1-common/=", "-fcf-protection=none", "-Wno-packed-not-aligned", "-DMODULE", - "-DKBUILD_BASENAME=\"hid_tminit\"", - "-DKBUILD_MODNAME=\"hid_tminit\"", + "-DKBUILD_BASENAME=\"hid_tmt300rs\"", + "-DKBUILD_MODNAME=\"hid_tmt300rs\"", "-o", - "/home/kimi/Documents/tmff2/hid-tminit.o", - "../../../home/kimi/Documents/tmff2/hid-tminit.c" + "/home/kimi/Documents/Projects/hid-tmff2/hid-tmt300rs.o", + "../../../home/kimi/Documents/Projects/hid-tmff2/hid-tmt300rs.c" ], - "directory": "/usr/src/linux-headers-5.4.0-40-generic", - "file": "../../../home/kimi/Documents/tmff2/hid-tminit.c" + "directory": "/usr/src/linux-headers-5.7.0-1-amd64", + "file": "../../../home/kimi/Documents/Projects/hid-tmff2/hid-tmt300rs.c" } ]
\ No newline at end of file diff --git a/hid-tminit.ko b/hid-tminit.ko Binary files differnew file mode 100644 index 0000000..f7a0f97 --- /dev/null +++ b/hid-tminit.ko diff --git a/hid-tminit.mod b/hid-tminit.mod new file mode 100644 index 0000000..821c012 --- /dev/null +++ b/hid-tminit.mod @@ -0,0 +1,2 @@ +/home/kimi/Documents/Projects/hid-tmff2/hid-tminit.o + diff --git a/hid-tminit.mod.c b/hid-tminit.mod.c new file mode 100644 index 0000000..7029581 --- /dev/null +++ b/hid-tminit.mod.c @@ -0,0 +1,55 @@ +#include <linux/module.h> +#include <linux/build-salt.h> +#include <linux/vermagic.h> +#include <linux/compiler.h> + +BUILD_SALT; + +MODULE_INFO(vermagic, VERMAGIC_STRING); +MODULE_INFO(name, KBUILD_MODNAME); + +__visible struct module __this_module +__section(.gnu.linkonce.this_module) = { + .name = KBUILD_MODNAME, + .init = init_module, +#ifdef CONFIG_MODULE_UNLOAD + .exit = cleanup_module, +#endif + .arch = MODULE_ARCH_INIT, +}; + +#ifdef CONFIG_RETPOLINE +MODULE_INFO(retpoline, "Y"); +#endif + +static const struct modversion_info ____versions[] +__used __section(__versions) = { + { 0x7ca88ad8, "module_layout" }, + { 0x817489f6, "hid_unregister_driver" }, + { 0xb7aa9422, "__hid_register_driver" }, + { 0x414fc2a1, "hid_hw_start" }, + { 0xcd9e657d, "hid_open_report" }, + { 0x316d1bda, "_dev_err" }, + { 0xdecd0b29, "__stack_chk_fail" }, + { 0x37a0cba, "kfree" }, + { 0x82fea2ff, "usb_alloc_urb" }, + { 0xc30561e7, "usb_interrupt_msg" }, + { 0x69acdf38, "memcpy" }, + { 0xc27f683d, "kmem_cache_alloc_trace" }, + { 0x46a9479b, "kmalloc_caches" }, + { 0x70bce9a, "__dynamic_dev_dbg" }, + { 0xfeba7354, "current_task" }, + { 0x648538a5, "usb_kill_urb" }, + { 0x7f02188f, "__msecs_to_jiffies" }, + { 0xadd72fe9, "usb_free_urb" }, + { 0x4a3ad70e, "wait_for_completion_timeout" }, + { 0xedb8a9, "usb_submit_urb" }, + { 0x608741b5, "__init_swait_queue_head" }, + { 0x4a0c79b0, "hid_hw_stop" }, + { 0x59e59766, "_dev_info" }, + { 0xbdfb6dbb, "__fentry__" }, +}; + +MODULE_INFO(depends, "hid,usbcore"); + +MODULE_ALIAS("hid:b0003g*v0000044Fp0000B65D"); diff --git a/hid-tminit.mod.o b/hid-tminit.mod.o Binary files differnew file mode 100644 index 0000000..ae7e374 --- /dev/null +++ b/hid-tminit.mod.o diff --git a/hid-tminit.o b/hid-tminit.o Binary files differnew file mode 100644 index 0000000..ae3404b --- /dev/null +++ b/hid-tminit.o diff --git a/hid-tmt300rs.c b/hid-tmt300rs.c index 2e2609a..b8f0a30 100644 --- a/hid-tmt300rs.c +++ b/hid-tmt300rs.c @@ -451,18 +451,16 @@ static int t300rs_timer_helper(struct t300rs_device_entry *t300rs){ hid_info(t300rs->hdev, "commands stacking up, increasing timer period\n"); return current_period; } - - for(effect_id = 0; effect_id < t300rs->max_id; ++effect_id){ + + for(effect_id = 0; effect_id < T300RS_MAX_EFFECTS; ++effect_id){ state = &t300rs->states[effect_id]; - if(!test_bit(FF_EFFECT_QUEUE_START, &state->flags) && - !test_bit(FF_EFFECT_QUEUE_STOP, &state->flags)){ - continue; - } - - if(test_bit(FF_EFFECT_PLAYING, &state->flags)){ + /* + * alright, for now no count support + * if(test_bit(FF_EFFECT_PLAYING, &state->flags)){ if(JIFFIES2MS(jiffies) - state->start_time >= state->effect.replay.length){ + hid_info(t300rs->hdev, "maybe dangerous?"); __clear_bit(FF_EFFECT_PLAYING, &state->flags); if(state->count){ @@ -470,7 +468,7 @@ static int t300rs_timer_helper(struct t300rs_device_entry *t300rs){ state->count--; } } - } + }*/ if(test_bit(FF_EFFECT_QUEUE_UPLOAD, &state->flags)){ __clear_bit(FF_EFFECT_QUEUE_UPLOAD, &state->flags); @@ -537,7 +535,7 @@ static int t300rs_upload(struct input_dev *dev, struct ff_effect *effect, struct struct t300rs_effect_state *state; t300rs = t300rs_get_device(hdev); - + if(effect->type == FF_PERIODIC && effect->u.periodic.period == 0){ return -EINVAL; } @@ -566,11 +564,11 @@ static int t300rs_play(struct input_dev *dev, int effect_id, int value){ t300rs = t300rs_get_device(hdev); state = &t300rs->states[effect_id]; - + spin_lock_irqsave(&t300rs->lock, t300rs->lock_flags); if(value > 0){ - if(test_bit(FF_EFFECT_PLAYING, &state->flags)){ + if(test_bit(FF_EFFECT_QUEUE_START, &state->flags)){ __set_bit(FF_EFFECT_QUEUE_STOP, &state->flags); } else { t300rs->effects_used++; @@ -593,6 +591,7 @@ static int t300rs_play(struct input_dev *dev, int effect_id, int value){ return 0; } +/* we should set a default range */ static ssize_t t300rs_range_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count){ struct hid_device *hdev = to_hid_device(dev); @@ -728,7 +727,7 @@ err: return ret; } -static void t300rs_close(struct input_dev *dev){ +/*static void t300rs_close(struct input_dev *dev){ int ret, trans; struct hid_device *hdev = input_get_drvdata(dev); u8 *send_buffer = kzalloc(T300RS_BUFFER_LENGTH, GFP_ATOMIC); @@ -744,7 +743,7 @@ static void t300rs_close(struct input_dev *dev){ err: kfree(send_buffer); return; -} +}*/ int t300rs_init(struct hid_device *hdev, const signed short *ff_bits){ struct t300rs_device_entry *t300rs; @@ -860,19 +859,20 @@ int t300rs_init(struct hid_device *hdev, const signed short *ff_bits){ ff->set_autocenter = t300rs_set_autocenter; ff->destroy = t300rs_destroy; - input_dev->open = t300rs_open; - input_dev->close = t300rs_close; + /* input_dev->open = t300rs_open; + input_dev->close = t300rs_close; */ ret = device_create_file(&hdev->dev, &dev_attr_range); if(ret){ hid_warn(hdev, "unable to create sysfs interface for range\n"); goto out; } - + hrtimer_init(&t300rs->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); t300rs->hrtimer.function = t300rs_timer; + t300rs_open(input_dev); hid_info(hdev, "force feedback for T300RS\n"); return 0; @@ -940,7 +940,6 @@ static int t300rs_probe(struct hid_device *hdev, const struct hid_device_id *id) struct t300rs_data *drv_data; spin_lock_init(&lock); - spin_lock_irqsave(&lock, lock_flags); drv_data = kzalloc(sizeof(struct t300rs_data), GFP_ATOMIC); if(!drv_data){ @@ -973,7 +972,6 @@ static int t300rs_probe(struct hid_device *hdev, const struct hid_device_id *id) goto err; } - spin_unlock_irqrestore(&lock, lock_flags); return 0; err: kfree(drv_data); diff --git a/hid-tmt300rs.h b/hid-tmt300rs.h index bec73eb..1cc3424 100644 --- a/hid-tmt300rs.h +++ b/hid-tmt300rs.h @@ -7,7 +7,7 @@ #define T300RS_MAX_EFFECTS FF_MAX_EFFECTS #define T300RS_BUFFER_LENGTH 64 -#define DEFAULT_TIMER_PERIOD 2 +#define DEFAULT_TIMER_PERIOD 16 /* the wheel seems to be bad at stuff*/ #define FF_EFFECT_QUEUE_UPLOAD 0 #define FF_EFFECT_QUEUE_START 1 diff --git a/hid-tmt300rs.ko b/hid-tmt300rs.ko Binary files differnew file mode 100644 index 0000000..7ec9bb8 --- /dev/null +++ b/hid-tmt300rs.ko diff --git a/hid-tmt300rs.mod b/hid-tmt300rs.mod new file mode 100644 index 0000000..8a429e9 --- /dev/null +++ b/hid-tmt300rs.mod @@ -0,0 +1,2 @@ +/home/kimi/Documents/Projects/hid-tmff2/hid-tmt300rs.o + diff --git a/hid-tmt300rs.mod.c b/hid-tmt300rs.mod.c new file mode 100644 index 0000000..d10c5bb --- /dev/null +++ b/hid-tmt300rs.mod.c @@ -0,0 +1,67 @@ +#include <linux/module.h> +#include <linux/build-salt.h> +#include <linux/vermagic.h> +#include <linux/compiler.h> + +BUILD_SALT; + +MODULE_INFO(vermagic, VERMAGIC_STRING); +MODULE_INFO(name, KBUILD_MODNAME); + +__visible struct module __this_module +__section(.gnu.linkonce.this_module) = { + .name = KBUILD_MODNAME, + .init = init_module, +#ifdef CONFIG_MODULE_UNLOAD + .exit = cleanup_module, +#endif + .arch = MODULE_ARCH_INIT, +}; + +#ifdef CONFIG_RETPOLINE +MODULE_INFO(retpoline, "Y"); +#endif + +static const struct modversion_info ____versions[] +__used __section(__versions) = { + { 0x7ca88ad8, "module_layout" }, + { 0x817489f6, "hid_unregister_driver" }, + { 0xb7aa9422, "__hid_register_driver" }, + { 0x414fc2a1, "hid_hw_start" }, + { 0xcd9e657d, "hid_open_report" }, + { 0x1ee7d3cd, "hrtimer_init" }, + { 0x7d42edf, "device_create_file" }, + { 0xb3e1146a, "input_ff_create" }, + { 0x70bce9a, "__dynamic_dev_dbg" }, + { 0xfeba7354, "current_task" }, + { 0x648538a5, "usb_kill_urb" }, + { 0x7f02188f, "__msecs_to_jiffies" }, + { 0x4a3ad70e, "wait_for_completion_timeout" }, + { 0x608741b5, "__init_swait_queue_head" }, + { 0xdecd0b29, "__stack_chk_fail" }, + { 0x15ba50a6, "jiffies" }, + { 0xdc21e866, "hrtimer_forward" }, + { 0x2ea2c95c, "__x86_indirect_thunk_rax" }, + { 0x59e59766, "_dev_info" }, + { 0x20000329, "simple_strtoul" }, + { 0xc27f683d, "kmem_cache_alloc_trace" }, + { 0x46a9479b, "kmalloc_caches" }, + { 0xedb8a9, "usb_submit_urb" }, + { 0x82fea2ff, "usb_alloc_urb" }, + { 0x4a0c79b0, "hid_hw_stop" }, + { 0x37a0cba, "kfree" }, + { 0xa0c6befa, "hrtimer_cancel" }, + { 0x9c59e5d5, "device_remove_file" }, + { 0xfbdfc558, "hrtimer_start_range_ns" }, + { 0xb4ff6bb6, "hrtimer_active" }, + { 0xc85d768e, "_dev_warn" }, + { 0xadd72fe9, "usb_free_urb" }, + { 0x316d1bda, "_dev_err" }, + { 0x3812050a, "_raw_spin_unlock_irqrestore" }, + { 0x51760917, "_raw_spin_lock_irqsave" }, + { 0xbdfb6dbb, "__fentry__" }, +}; + +MODULE_INFO(depends, "hid,usbcore"); + +MODULE_ALIAS("hid:b0003g*v0000044Fp0000B66E"); diff --git a/hid-tmt300rs.mod.o b/hid-tmt300rs.mod.o Binary files differnew file mode 100644 index 0000000..95b6880 --- /dev/null +++ b/hid-tmt300rs.mod.o diff --git a/hid-tmt300rs.o b/hid-tmt300rs.o Binary files differnew file mode 100644 index 0000000..743d20b --- /dev/null +++ b/hid-tmt300rs.o diff --git a/modules.order b/modules.order new file mode 100644 index 0000000..a0e2376 --- /dev/null +++ b/modules.order @@ -0,0 +1,2 @@ +/home/kimi/Documents/Projects/hid-tmff2/hid-tminit.ko +/home/kimi/Documents/Projects/hid-tmff2/hid-tmt300rs.ko diff --git a/todo.txt b/todo.txt new file mode 100644 index 0000000..ea2310d --- /dev/null +++ b/todo.txt @@ -0,0 +1,3 @@ +1. set a default range for the wheel so that it syncs up correctly +2. figure out the bug where the effects suddenly stop being sent (happens in +dirt rally at least) |
