Skip to content

Commit

Permalink
HID: roccat: Add "Roccat Talk" support for koneplus
Browse files Browse the repository at this point in the history
Added binary sysfs attribute to support new functionality the manufacturer
added to koneplus.

Signed-off-by: Stefan Achatz <erazor_de@users.sourceforge.net>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Stefan Achatz authored and Jiri Kosina committed Jun 13, 2011
1 parent d762f43 commit 6d1dec8
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Documentation/ABI/testing/sysfs-driver-hid-roccat-koneplus
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ Description: The mouse has a tracking- and a distance-control-unit. These
This file is writeonly.
Users: http://roccat.sourceforge.net

What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/koneplus/roccatkoneplus<minor>/talk
Date: May 2011
Contact: Stefan Achatz <erazor_de@users.sourceforge.net>
Description: Used to active some easy* functions of the mouse from outside.
The data has to be 16 bytes long.
This file is writeonly.
Users: http://roccat.sourceforge.net

What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/koneplus/roccatkoneplus<minor>/tcu
Date: October 2010
Contact: Stefan Achatz <erazor_de@users.sourceforge.net>
Expand Down
13 changes: 13 additions & 0 deletions drivers/hid/hid-roccat-koneplus.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,14 @@ static ssize_t koneplus_sysfs_write(struct file *fp, struct kobject *kobj,
return real_size;
}

static ssize_t koneplus_sysfs_write_talk(struct file *fp,
struct kobject *kobj, struct bin_attribute *attr, char *buf,
loff_t off, size_t count)
{
return koneplus_sysfs_write(fp, kobj, buf, off, count,
sizeof(struct koneplus_talk), KONEPLUS_USB_COMMAND_TALK);
}

static ssize_t koneplus_sysfs_write_macro(struct file *fp,
struct kobject *kobj, struct bin_attribute *attr, char *buf,
loff_t off, size_t count)
Expand Down Expand Up @@ -557,6 +565,11 @@ static struct bin_attribute koneplus_bin_attributes[] = {
.size = sizeof(struct koneplus_macro),
.write = koneplus_sysfs_write_macro
},
{
.attr = { .name = "talk", .mode = 0220 },
.size = sizeof(struct koneplus_talk),
.write = koneplus_sysfs_write_talk
},
__ATTR_NULL
};

Expand Down
9 changes: 9 additions & 0 deletions drivers/hid/hid-roccat-koneplus.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@

#include <linux/types.h>

struct koneplus_talk {
uint8_t command; /* KONEPLUS_COMMAND_TALK */
uint8_t size; /* always 0x10 */
uint8_t data[14];
} __packed;

/*
* case 1: writes request 80 and reads value 1
*
Expand Down Expand Up @@ -139,6 +145,7 @@ enum koneplus_commands {
KONEPLUS_COMMAND_INFO = 0x9,
KONEPLUS_COMMAND_E = 0xe,
KONEPLUS_COMMAND_SENSOR = 0xf,
KONEPLUS_COMMAND_TALK = 0x10,
KONEPLUS_COMMAND_FIRMWARE_WRITE = 0x1b,
KONEPLUS_COMMAND_FIRMWARE_WRITE_CONTROL = 0x1c,
};
Expand All @@ -153,6 +160,7 @@ enum koneplus_usb_commands {
KONEPLUS_USB_COMMAND_TCU = 0x30c,
KONEPLUS_USB_COMMAND_E = 0x30e,
KONEPLUS_USB_COMMAND_SENSOR = 0x30f,
KONEPLUS_USB_COMMAND_TALK = 0x310,
KONEPLUS_USB_COMMAND_FIRMWARE_WRITE = 0x31b,
KONEPLUS_USB_COMMAND_FIRMWARE_WRITE_CONTROL = 0x31c,
};
Expand Down Expand Up @@ -193,6 +201,7 @@ enum koneplus_mouse_report_button_types {
* data2 = action
*/
KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_MULTIMEDIA = 0xf0,
KONEPLUS_MOUSE_REPORT_TALK = 0xff,
};

enum koneplus_mouse_report_button_action {
Expand Down

0 comments on commit 6d1dec8

Please sign in to comment.