Skip to content

Commit e149af9

Browse files
EvenxfJiri Kosina
authored andcommitted
HID: Intel-thc-hid: Intel-quicki2c: Support writing output report format
There are two output formats requested in the HID-over-I2C specification: - Command format (set feature/set report): encoded command written to command register, followed by data written to data register - Output report format: all data written directly to output register Current quicki2c_init_write_buf() implementation only supports the command format. Extend quicki2c_init_write_buf() to automatically detect the output format based on the presence of command parameters and prepare the appropriate output buffer accordingly. Tested-by: Rui Zhang <rui1.zhang@intel.com> Signed-off-by: Even Xu <even.xu@intel.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
1 parent 678cbaa commit e149af9

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

drivers/hid/intel-thc-hid/intel-quicki2c/quicki2c-protocol.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,18 @@ static ssize_t quicki2c_init_write_buf(struct quicki2c_device *qcdev, u32 cmd, s
3030
if (buf_len > write_buf_len)
3131
return -EINVAL;
3232

33-
memcpy(write_buf, &qcdev->dev_desc.cmd_reg, HIDI2C_REG_LEN);
34-
offset += HIDI2C_REG_LEN;
35-
memcpy(write_buf + offset, &cmd, cmd_len);
36-
offset += cmd_len;
33+
if (cmd_len) {
34+
memcpy(write_buf, &qcdev->dev_desc.cmd_reg, HIDI2C_REG_LEN);
35+
offset += HIDI2C_REG_LEN;
36+
memcpy(write_buf + offset, &cmd, cmd_len);
37+
offset += cmd_len;
3738

38-
if (append_data_reg) {
39-
memcpy(write_buf + offset, &qcdev->dev_desc.data_reg, HIDI2C_REG_LEN);
39+
if (append_data_reg) {
40+
memcpy(write_buf + offset, &qcdev->dev_desc.data_reg, HIDI2C_REG_LEN);
41+
offset += HIDI2C_REG_LEN;
42+
}
43+
} else {
44+
memcpy(write_buf, &qcdev->dev_desc.output_reg, HIDI2C_REG_LEN);
4045
offset += HIDI2C_REG_LEN;
4146
}
4247

0 commit comments

Comments
 (0)