From fed8081d45d05ecf2b557515e17a5005b90a7e96 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Wed, 23 Mar 2022 18:39:27 +0200 Subject: test open/close --- hid-tmff2.h | 3 +++ hid-tmt248.c | 18 ++++++++++++++++-- hid-tmt300rs.c | 4 ++-- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/hid-tmff2.h b/hid-tmff2.h index f474ca7..b396d78 100644 --- a/hid-tmff2.h +++ b/hid-tmff2.h @@ -128,4 +128,7 @@ int t300rs_set_gain(void *, uint16_t); int t300rs_set_range(void *, uint16_t); int t300rs_set_autocenter(void *, uint16_t); +int t300rs_send_buf(struct t300rs_device_entry *t300rs, u8 *send_buffer, size_t len); +int t300rs_send_int(struct t300rs_device_entry *t300rs); + #endif /* __HID_TMFF2_H */ diff --git a/hid-tmt248.c b/hid-tmt248.c index 2881ffc..f3d4700 100644 --- a/hid-tmt248.c +++ b/hid-tmt248.c @@ -243,7 +243,14 @@ static int t248_open(void *data) if (!t248) return -ENODEV; - /* TODO: send usb commands to actually open device */ + t248->send_buffer[0] = 0x01; + t248->send_buffer[1] = 0x04; + t300rs_send_int(t248); + + t248->send_buffer[0] = 0x01; + t248->send_buffer[1] = 0x05; + t300rs_send_int(t248); + return t248->open(t248->input_dev); } @@ -253,7 +260,14 @@ static int t248_close(void *data) if (!t248) return -ENODEV; - /* TODO: send usb commands to actually close device */ + t248->send_buffer[0] = 0x01; + t248->send_buffer[1] = 0x05; + t300rs_send_int(t248); + + t248->send_buffer[0] = 0x01; + t248->send_buffer[1] = 0x00; + t300rs_send_int(t248); + t248->close(t248->input_dev); return 0; } diff --git a/hid-tmt300rs.c b/hid-tmt300rs.c index 92e9acd..167262c 100644 --- a/hid-tmt300rs.c +++ b/hid-tmt300rs.c @@ -340,7 +340,7 @@ static u8 damper_values[] = { 0x7f, 0x07 }; -static int t300rs_send_buf(struct t300rs_device_entry *t300rs, u8 *send_buffer, size_t len) +int t300rs_send_buf(struct t300rs_device_entry *t300rs, u8 *send_buffer, size_t len) { int i; /* check that send_buffer fits into our report */ @@ -359,7 +359,7 @@ static int t300rs_send_buf(struct t300rs_device_entry *t300rs, u8 *send_buffer, return 0; } -static int t300rs_send_int(struct t300rs_device_entry *t300rs) +int t300rs_send_int(struct t300rs_device_entry *t300rs) { t300rs_send_buf(t300rs, t300rs->send_buffer, t300rs->buffer_length); memset(t300rs->send_buffer, 0, t300rs->buffer_length); -- cgit v1.3