aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2022-03-23 18:39:27 +0200
committerKimplul <kimi.h.kuparinen@gmail.com>2022-03-23 18:39:27 +0200
commitfed8081d45d05ecf2b557515e17a5005b90a7e96 (patch)
tree55838cf27bc364cf0b065e29921eb3fce8d6c24e
parent3eba47f56dcb539b3dd475b9906ed9af7bd8db7f (diff)
downloadhid-tmff2-fed8081d45d05ecf2b557515e17a5005b90a7e96.tar.gz
hid-tmff2-fed8081d45d05ecf2b557515e17a5005b90a7e96.zip
test open/close
-rw-r--r--hid-tmff2.h3
-rw-r--r--hid-tmt248.c18
-rw-r--r--hid-tmt300rs.c4
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);