aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkimi <kimi.h.kuparinen@gmail.com>2020-07-10 12:16:08 -0400
committerkimi <kimi.h.kuparinen@gmail.com>2020-07-10 12:16:08 -0400
commitead4ca3e9726eea7456064682c739aee74416fba (patch)
treeb6247b93582fa08d24b024ef6e4c6b5d0c2f22b8
parent11c7bb0526d1ddd20d86b9cb2981b3a213d40404 (diff)
downloadhid-tmff2-ead4ca3e9726eea7456064682c739aee74416fba.tar.gz
hid-tmff2-ead4ca3e9726eea7456064682c739aee74416fba.zip
wow?
-rw-r--r--compile_commands.json40
-rw-r--r--hid-tminit.kobin419984 -> 280264 bytes
-rw-r--r--hid-tminit.mod2
-rw-r--r--hid-tminit.mod.c34
-rw-r--r--hid-tminit.mod.obin143264 -> 2904 bytes
-rw-r--r--hid-tmt300rs.c85
-rw-r--r--hid-tmt300rs.h6
-rw-r--r--hid-tmt300rs.kobin527336 -> 26560 bytes
-rw-r--r--hid-tmt300rs.mod2
-rw-r--r--hid-tmt300rs.mod.c46
-rw-r--r--hid-tmt300rs.mod.obin144040 -> 2912 bytes
-rw-r--r--hid-tmt300rs.obin384888 -> 24568 bytes
-rw-r--r--modules.order4
13 files changed, 68 insertions, 151 deletions
diff --git a/compile_commands.json b/compile_commands.json
index a75ead3..56b8bee 100644
--- a/compile_commands.json
+++ b/compile_commands.json
@@ -1,24 +1,24 @@
[
{
"arguments": [
- "gcc-9",
+ "gcc",
"-c",
- "-Wp,-MD,/home/kimi/Documents/Projects/hid-tmff2/.hid-tmt300rs.o.d",
+ "-Wp,-MD,/home/kimi/Documents/tmff2/.hid-tmt300rs.o.d",
"-nostdinc",
"-isystem",
"/usr/lib/gcc/x86_64-linux-gnu/9/include",
- "-I/usr/src/linux-headers-5.7.0-1-common/arch/x86/include",
+ "-I./arch/x86/include",
"-I./arch/x86/include/generated",
- "-I/usr/src/linux-headers-5.7.0-1-common/include",
"-I./include",
- "-I/usr/src/linux-headers-5.7.0-1-common/arch/x86/include/uapi",
+ "-I./arch/x86/include/uapi",
"-I./arch/x86/include/generated/uapi",
- "-I/usr/src/linux-headers-5.7.0-1-common/include/uapi",
+ "-I./include/uapi",
"-I./include/generated/uapi",
"-include",
- "/usr/src/linux-headers-5.7.0-1-common/include/linux/kconfig.h",
+ "./include/linux/kconfig.h",
+ "-Iubuntu/include",
"-include",
- "/usr/src/linux-headers-5.7.0-1-common/include/linux/compiler_types.h",
+ "./include/linux/compiler_types.h",
"-D__KERNEL__",
"-Wall",
"-Wundef",
@@ -48,6 +48,15 @@
"-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",
@@ -60,13 +69,14 @@
"-Wno-address-of-packed-member",
"-O2",
"--param=allow-store-data-races=0",
- "-Wframe-larger-than=2048",
+ "-Wframe-larger-than=1024",
"-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",
@@ -88,17 +98,17 @@
"-Werror=date-time",
"-Werror=incompatible-pointer-types",
"-Werror=designated-init",
- "-fmacro-prefix-map=/usr/src/linux-headers-5.7.0-1-common/=",
+ "-fmacro-prefix-map=./=",
"-fcf-protection=none",
"-Wno-packed-not-aligned",
"-DMODULE",
"-DKBUILD_BASENAME=\"hid_tmt300rs\"",
"-DKBUILD_MODNAME=\"hid_tmt300rs\"",
"-o",
- "/home/kimi/Documents/Projects/hid-tmff2/hid-tmt300rs.o",
- "../../../home/kimi/Documents/Projects/hid-tmff2/hid-tmt300rs.c"
+ "/home/kimi/Documents/tmff2/hid-tmt300rs.o",
+ "../../../home/kimi/Documents/tmff2/hid-tmt300rs.c"
],
- "directory": "/usr/src/linux-headers-5.7.0-1-amd64",
- "file": "../../../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-tmt300rs.c"
}
] \ No newline at end of file
diff --git a/hid-tminit.ko b/hid-tminit.ko
index f7a0f97..763336c 100644
--- a/hid-tminit.ko
+++ b/hid-tminit.ko
Binary files differ
diff --git a/hid-tminit.mod b/hid-tminit.mod
index 821c012..858ad57 100644
--- a/hid-tminit.mod
+++ b/hid-tminit.mod
@@ -1,2 +1,2 @@
-/home/kimi/Documents/Projects/hid-tmff2/hid-tminit.o
+/home/kimi/Documents/tmff2/hid-tminit.o
diff --git a/hid-tminit.mod.c b/hid-tminit.mod.c
index 7029581..dbd2e54 100644
--- a/hid-tminit.mod.c
+++ b/hid-tminit.mod.c
@@ -1,5 +1,5 @@
-#include <linux/module.h>
#include <linux/build-salt.h>
+#include <linux/module.h>
#include <linux/vermagic.h>
#include <linux/compiler.h>
@@ -22,34 +22,8 @@ __section(.gnu.linkonce.this_module) = {
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_INFO(depends, "hid");
MODULE_ALIAS("hid:b0003g*v0000044Fp0000B65D");
+
+MODULE_INFO(srcversion, "49C62A898823BBE8124B035");
diff --git a/hid-tminit.mod.o b/hid-tminit.mod.o
index ae7e374..ce3c467 100644
--- a/hid-tminit.mod.o
+++ b/hid-tminit.mod.o
Binary files differ
diff --git a/hid-tmt300rs.c b/hid-tmt300rs.c
index bab04ec..8b002c7 100644
--- a/hid-tmt300rs.c
+++ b/hid-tmt300rs.c
@@ -38,6 +38,9 @@ static int t300rs_send_int(struct input_dev *dev, u8 *send_buffer, int *trans){
struct urb *urb = usb_alloc_urb(0, GFP_ATOMIC);
t300rs = t300rs_get_device(hdev);
+ if(!t300rs){
+ hid_err(hdev, "could not get device\n");
+ }
usbdev = t300rs->usbdev;
usbif = t300rs->usbif;
@@ -495,11 +498,11 @@ static enum hrtimer_restart t300rs_timer(struct hrtimer *t){
struct t300rs_device_entry *t300rs = container_of(t, struct t300rs_device_entry, hrtimer);
int max_count;
- spin_lock_irqsave(&t300rs->lock, t300rs->lock_flags);
+ spin_lock_irqsave(&data_lock, data_flags);
max_count = t300rs_timer_helper(t300rs);
- spin_unlock_irqrestore(&t300rs->lock, t300rs->lock_flags);
+ spin_unlock_irqrestore(&data_lock, data_flags);
if(max_count > 0){
hrtimer_forward_now(&t300rs->hrtimer, ms_to_ktime(timer_msecs));
@@ -663,10 +666,13 @@ static void t300rs_destroy(struct ff_device *ff){
static int t300rs_open(struct input_dev *dev){
+ struct t300rs_device_entry *t300rs;
struct hid_device *hdev = input_get_drvdata(dev);
u8 *send_buffer = kzalloc(T300RS_BUFFER_LENGTH, GFP_ATOMIC);
int ret, trans;
+ t300rs = t300rs_get_device(hdev);
+
send_buffer[0] = 0x60;
send_buffer[1] = 0x01;
send_buffer[2] = 0x04;
@@ -705,14 +711,17 @@ static int t300rs_open(struct input_dev *dev){
err:
kfree(send_buffer);
- return ret;
+ return t300rs->open(dev);
}
-/*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);
+ struct t300rs_device_entry *t300rs;
u8 *send_buffer = kzalloc(T300RS_BUFFER_LENGTH, GFP_ATOMIC);
+ t300rs = t300rs_get_device(hdev);
+
send_buffer[0] = 0x60;
send_buffer[1] = 0x01;
@@ -723,8 +732,10 @@ err:
}
err:
kfree(send_buffer);
+
+ t300rs->close(dev);
return;
-}*/
+}
int t300rs_init(struct hid_device *hdev, const signed short *ff_bits){
struct t300rs_device_entry *t300rs;
@@ -841,8 +852,11 @@ 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; */
+ t300rs->open = input_dev->open;
+ t300rs->close = input_dev->close;
+
+ input_dev->open = t300rs_open;
+ input_dev->close = t300rs_close;
ret = device_create_file(&hdev->dev, &dev_attr_range);
if(ret){
@@ -874,53 +888,6 @@ err:
}
-/* for some reason this specific command must be sent before hid_hw_start. Odd.
- * */
-static int t300rs_preinit(struct hid_device *hdev){
- int ret;
- u8 *setup_packet, *send_buffer;
-
- /* this is sort of unnecessary, as later on I compile the interfaces etc
- * into one struct, but for now this will do
- * */
- struct device *dev = &hdev->dev;
- struct usb_interface *usbif = to_usb_interface(dev->parent);
- struct usb_device *usbdev = interface_to_usbdev(usbif);
- struct urb *urb;
-
- setup_packet = kmalloc(8, GFP_ATOMIC);
- send_buffer = kzalloc(8, GFP_ATOMIC);
-
- memcpy(setup_packet, t300rs_ctrl_out, ARRAY_SIZE(t300rs_ctrl_out));
- urb = usb_alloc_urb(0, GFP_ATOMIC);
-
- usb_fill_control_urb(urb,
- usbdev,
- usb_sndctrlpipe(usbdev, 0),
- setup_packet,
- /* why is it important we have a pointer, when we send out 0 bytes?
- * No clue.
- * */
- send_buffer,
- 0,
- /* technically speaking this isn't an interrupt usb, but hey, this
- * works.
- * */
- t300rs_int_callback,
- hdev);
-
- ret = usb_submit_urb(urb, GFP_ATOMIC);
- if(ret != 0){
- hid_err(hdev, "Failed sending ctrl out with ERRNO: %i", ret);
- goto error;
- }
-
-error:
- kfree(send_buffer);
- kfree(setup_packet);
- return ret;
-}
-
static int t300rs_probe(struct hid_device *hdev, const struct hid_device_id *id){
int ret;
struct t300rs_data *drv_data;
@@ -943,9 +910,6 @@ static int t300rs_probe(struct hid_device *hdev, const struct hid_device_id *id)
goto err;
}
- /* lord have mercy */
- //t300rs_preinit(hdev);
-
ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF);
if(ret){
hid_err(hdev, "hw start failed\n");
@@ -969,20 +933,21 @@ static void t300rs_remove(struct hid_device *hdev){
struct t300rs_device_entry *t300rs;
struct t300rs_data *drv_data;
- spin_lock_irqsave(&lock, lock_flags);
device_remove_file(&hdev->dev, &dev_attr_range);
drv_data = hid_get_drvdata(hdev);
t300rs = t300rs_get_device(hdev);
+ spin_lock_irqsave(&data_lock, data_flags);
+
hrtimer_cancel(&t300rs->hrtimer);
+ hid_hw_stop(hdev);
kfree(t300rs->states);
kfree(drv_data);
kfree(t300rs);
- hid_hw_stop(hdev);
- spin_unlock_irqrestore(&lock, lock_flags);
+ spin_unlock_irqrestore(&data_lock, data_flags);
return;
}
diff --git a/hid-tmt300rs.h b/hid-tmt300rs.h
index b308627..f3c8d97 100644
--- a/hid-tmt300rs.h
+++ b/hid-tmt300rs.h
@@ -21,6 +21,9 @@
spinlock_t lock;
unsigned long lock_flags;
+spinlock_t data_lock;
+unsigned long data_flags;
+
static int timer_msecs = DEFAULT_TIMER_PERIOD;
static const signed short t300rs_ff_effects[] = {
@@ -58,6 +61,9 @@ struct t300rs_device_entry {
struct t300rs_effect_state *states;
struct hrtimer hrtimer;
+ int (*open)(struct input_dev *dev);
+ void (*close)(struct input_dev *dev);
+
spinlock_t lock;
unsigned long lock_flags;
diff --git a/hid-tmt300rs.ko b/hid-tmt300rs.ko
index 07d01f3..4a7c06a 100644
--- a/hid-tmt300rs.ko
+++ b/hid-tmt300rs.ko
Binary files differ
diff --git a/hid-tmt300rs.mod b/hid-tmt300rs.mod
index 8a429e9..92bd18f 100644
--- a/hid-tmt300rs.mod
+++ b/hid-tmt300rs.mod
@@ -1,2 +1,2 @@
-/home/kimi/Documents/Projects/hid-tmff2/hid-tmt300rs.o
+/home/kimi/Documents/tmff2/hid-tmt300rs.o
diff --git a/hid-tmt300rs.mod.c b/hid-tmt300rs.mod.c
index a114b1d..7d03495 100644
--- a/hid-tmt300rs.mod.c
+++ b/hid-tmt300rs.mod.c
@@ -1,5 +1,5 @@
-#include <linux/module.h>
#include <linux/build-salt.h>
+#include <linux/module.h>
#include <linux/vermagic.h>
#include <linux/compiler.h>
@@ -22,46 +22,8 @@ __section(.gnu.linkonce.this_module) = {
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" },
- { 0x59e59766, "_dev_info" },
- { 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" },
- { 0xdc21e866, "hrtimer_forward" },
- { 0x2ea2c95c, "__x86_indirect_thunk_rax" },
- { 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" },
- { 0x15ba50a6, "jiffies" },
- { 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_INFO(depends, "hid");
MODULE_ALIAS("hid:b0003g*v0000044Fp0000B66E");
+
+MODULE_INFO(srcversion, "8A85E6A9A9E4442C81CA1CE");
diff --git a/hid-tmt300rs.mod.o b/hid-tmt300rs.mod.o
index 5ab5b8c..f761a52 100644
--- a/hid-tmt300rs.mod.o
+++ b/hid-tmt300rs.mod.o
Binary files differ
diff --git a/hid-tmt300rs.o b/hid-tmt300rs.o
index a01b321..bc2808c 100644
--- a/hid-tmt300rs.o
+++ b/hid-tmt300rs.o
Binary files differ
diff --git a/modules.order b/modules.order
index a0e2376..0be5217 100644
--- a/modules.order
+++ b/modules.order
@@ -1,2 +1,2 @@
-/home/kimi/Documents/Projects/hid-tmff2/hid-tminit.ko
-/home/kimi/Documents/Projects/hid-tmff2/hid-tmt300rs.ko
+/home/kimi/Documents/tmff2/hid-tminit.ko
+/home/kimi/Documents/tmff2/hid-tmt300rs.ko