diff options
author | Stefan Achatz <erazor_de@users.sourceforge.net> | 2011-05-29 13:32:57 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2011-06-13 06:50:40 -0400 |
commit | 6d1dec85afa7306e66fff633689ff06195ad079a (patch) | |
tree | e6814054d84696115794134ff165f6a206e27427 | |
parent | d762f4383100c2a87b1a3f2d678cd3b5425655b4 (diff) |
HID: roccat: Add "Roccat Talk" support for koneplus
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>
-rw-r--r-- | Documentation/ABI/testing/sysfs-driver-hid-roccat-koneplus | 8 | ||||
-rw-r--r-- | drivers/hid/hid-roccat-koneplus.c | 13 | ||||
-rw-r--r-- | drivers/hid/hid-roccat-koneplus.h | 9 |
3 files changed, 30 insertions, 0 deletions
diff --git a/Documentation/ABI/testing/sysfs-driver-hid-roccat-koneplus b/Documentation/ABI/testing/sysfs-driver-hid-roccat-koneplus index c1b53b8bc2ae..65e6e5dd67e8 100644 --- a/Documentation/ABI/testing/sysfs-driver-hid-roccat-koneplus +++ b/Documentation/ABI/testing/sysfs-driver-hid-roccat-koneplus | |||
@@ -92,6 +92,14 @@ Description: The mouse has a tracking- and a distance-control-unit. These | |||
92 | This file is writeonly. | 92 | This file is writeonly. |
93 | Users: http://roccat.sourceforge.net | 93 | Users: http://roccat.sourceforge.net |
94 | 94 | ||
95 | What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/koneplus/roccatkoneplus<minor>/talk | ||
96 | Date: May 2011 | ||
97 | Contact: Stefan Achatz <erazor_de@users.sourceforge.net> | ||
98 | Description: Used to active some easy* functions of the mouse from outside. | ||
99 | The data has to be 16 bytes long. | ||
100 | This file is writeonly. | ||
101 | Users: http://roccat.sourceforge.net | ||
102 | |||
95 | What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/koneplus/roccatkoneplus<minor>/tcu | 103 | What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/koneplus/roccatkoneplus<minor>/tcu |
96 | Date: October 2010 | 104 | Date: October 2010 |
97 | Contact: Stefan Achatz <erazor_de@users.sourceforge.net> | 105 | Contact: Stefan Achatz <erazor_de@users.sourceforge.net> |
diff --git a/drivers/hid/hid-roccat-koneplus.c b/drivers/hid/hid-roccat-koneplus.c index 5b640a7a15a7..23cdb449d88e 100644 --- a/drivers/hid/hid-roccat-koneplus.c +++ b/drivers/hid/hid-roccat-koneplus.c | |||
@@ -240,6 +240,14 @@ static ssize_t koneplus_sysfs_write(struct file *fp, struct kobject *kobj, | |||
240 | return real_size; | 240 | return real_size; |
241 | } | 241 | } |
242 | 242 | ||
243 | static ssize_t koneplus_sysfs_write_talk(struct file *fp, | ||
244 | struct kobject *kobj, struct bin_attribute *attr, char *buf, | ||
245 | loff_t off, size_t count) | ||
246 | { | ||
247 | return koneplus_sysfs_write(fp, kobj, buf, off, count, | ||
248 | sizeof(struct koneplus_talk), KONEPLUS_USB_COMMAND_TALK); | ||
249 | } | ||
250 | |||
243 | static ssize_t koneplus_sysfs_write_macro(struct file *fp, | 251 | static ssize_t koneplus_sysfs_write_macro(struct file *fp, |
244 | struct kobject *kobj, struct bin_attribute *attr, char *buf, | 252 | struct kobject *kobj, struct bin_attribute *attr, char *buf, |
245 | loff_t off, size_t count) | 253 | loff_t off, size_t count) |
@@ -557,6 +565,11 @@ static struct bin_attribute koneplus_bin_attributes[] = { | |||
557 | .size = sizeof(struct koneplus_macro), | 565 | .size = sizeof(struct koneplus_macro), |
558 | .write = koneplus_sysfs_write_macro | 566 | .write = koneplus_sysfs_write_macro |
559 | }, | 567 | }, |
568 | { | ||
569 | .attr = { .name = "talk", .mode = 0220 }, | ||
570 | .size = sizeof(struct koneplus_talk), | ||
571 | .write = koneplus_sysfs_write_talk | ||
572 | }, | ||
560 | __ATTR_NULL | 573 | __ATTR_NULL |
561 | }; | 574 | }; |
562 | 575 | ||
diff --git a/drivers/hid/hid-roccat-koneplus.h b/drivers/hid/hid-roccat-koneplus.h index c57a376ab8ae..0bf252076ee7 100644 --- a/drivers/hid/hid-roccat-koneplus.h +++ b/drivers/hid/hid-roccat-koneplus.h | |||
@@ -14,6 +14,12 @@ | |||
14 | 14 | ||
15 | #include <linux/types.h> | 15 | #include <linux/types.h> |
16 | 16 | ||
17 | struct koneplus_talk { | ||
18 | uint8_t command; /* KONEPLUS_COMMAND_TALK */ | ||
19 | uint8_t size; /* always 0x10 */ | ||
20 | uint8_t data[14]; | ||
21 | } __packed; | ||
22 | |||
17 | /* | 23 | /* |
18 | * case 1: writes request 80 and reads value 1 | 24 | * case 1: writes request 80 and reads value 1 |
19 | * | 25 | * |
@@ -139,6 +145,7 @@ enum koneplus_commands { | |||
139 | KONEPLUS_COMMAND_INFO = 0x9, | 145 | KONEPLUS_COMMAND_INFO = 0x9, |
140 | KONEPLUS_COMMAND_E = 0xe, | 146 | KONEPLUS_COMMAND_E = 0xe, |
141 | KONEPLUS_COMMAND_SENSOR = 0xf, | 147 | KONEPLUS_COMMAND_SENSOR = 0xf, |
148 | KONEPLUS_COMMAND_TALK = 0x10, | ||
142 | KONEPLUS_COMMAND_FIRMWARE_WRITE = 0x1b, | 149 | KONEPLUS_COMMAND_FIRMWARE_WRITE = 0x1b, |
143 | KONEPLUS_COMMAND_FIRMWARE_WRITE_CONTROL = 0x1c, | 150 | KONEPLUS_COMMAND_FIRMWARE_WRITE_CONTROL = 0x1c, |
144 | }; | 151 | }; |
@@ -153,6 +160,7 @@ enum koneplus_usb_commands { | |||
153 | KONEPLUS_USB_COMMAND_TCU = 0x30c, | 160 | KONEPLUS_USB_COMMAND_TCU = 0x30c, |
154 | KONEPLUS_USB_COMMAND_E = 0x30e, | 161 | KONEPLUS_USB_COMMAND_E = 0x30e, |
155 | KONEPLUS_USB_COMMAND_SENSOR = 0x30f, | 162 | KONEPLUS_USB_COMMAND_SENSOR = 0x30f, |
163 | KONEPLUS_USB_COMMAND_TALK = 0x310, | ||
156 | KONEPLUS_USB_COMMAND_FIRMWARE_WRITE = 0x31b, | 164 | KONEPLUS_USB_COMMAND_FIRMWARE_WRITE = 0x31b, |
157 | KONEPLUS_USB_COMMAND_FIRMWARE_WRITE_CONTROL = 0x31c, | 165 | KONEPLUS_USB_COMMAND_FIRMWARE_WRITE_CONTROL = 0x31c, |
158 | }; | 166 | }; |
@@ -193,6 +201,7 @@ enum koneplus_mouse_report_button_types { | |||
193 | * data2 = action | 201 | * data2 = action |
194 | */ | 202 | */ |
195 | KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_MULTIMEDIA = 0xf0, | 203 | KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_MULTIMEDIA = 0xf0, |
204 | KONEPLUS_MOUSE_REPORT_TALK = 0xff, | ||
196 | }; | 205 | }; |
197 | 206 | ||
198 | enum koneplus_mouse_report_button_action { | 207 | enum koneplus_mouse_report_button_action { |