aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Achatz <erazor_de@users.sourceforge.net>2012-11-04 03:39:04 -0500
committerJiri Kosina <jkosina@suse.cz>2012-11-05 07:17:39 -0500
commitfabe51eb68d450d25b18882988b29626f51592fd (patch)
tree541471c04a7b2c42fc7a4606ae8eb71716c0be50
parent9e78eb8fbba5b00678d3d20e8e435cd0500716f3 (diff)
HID: roccat: enable Koneplus device reset
Device can be reset to factory state by sending a command via info sysfs attr. Added binary attribute info for this purpose, which obsoletes firmware_version attribute. Signed-off-by: Stefan Achatz <erazor_de@users.sourceforge.net> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r--Documentation/ABI/obsolete/sysfs-driver-hid-roccat-koneplus11
-rw-r--r--Documentation/ABI/testing/sysfs-driver-hid-roccat-koneplus13
-rw-r--r--drivers/hid/hid-roccat-koneplus.c22
3 files changed, 38 insertions, 8 deletions
diff --git a/Documentation/ABI/obsolete/sysfs-driver-hid-roccat-koneplus b/Documentation/ABI/obsolete/sysfs-driver-hid-roccat-koneplus
index c2a270b45b03..22568b45973e 100644
--- a/Documentation/ABI/obsolete/sysfs-driver-hid-roccat-koneplus
+++ b/Documentation/ABI/obsolete/sysfs-driver-hid-roccat-koneplus
@@ -8,3 +8,14 @@ Description: The integer value of this attribute ranges from 0-4.
8 When written, this file sets the number of the startup profile 8 When written, this file sets the number of the startup profile
9 and the mouse activates this profile immediately. 9 and the mouse activates this profile immediately.
10 Please use actual_profile, it does the same thing. 10 Please use actual_profile, it does the same thing.
11
12What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/koneplus/roccatkoneplus<minor>/firmware_version
13Date: October 2010
14Contact: Stefan Achatz <erazor_de@users.sourceforge.net>
15Description: When read, this file returns the raw integer version number of the
16 firmware reported by the mouse. Using the integer value eases
17 further usage in other programs. To receive the real version
18 number the decimal point has to be shifted 2 positions to the
19 left. E.g. a returned value of 121 means 1.21
20 This file is readonly.
21 Please read binary attribute info which contains firmware version.
diff --git a/Documentation/ABI/testing/sysfs-driver-hid-roccat-koneplus b/Documentation/ABI/testing/sysfs-driver-hid-roccat-koneplus
index f9e2a61900e5..ed1213defb81 100644
--- a/Documentation/ABI/testing/sysfs-driver-hid-roccat-koneplus
+++ b/Documentation/ABI/testing/sysfs-driver-hid-roccat-koneplus
@@ -9,15 +9,12 @@ Description: The integer value of this attribute ranges from 0-4.
9 and the mouse activates this profile immediately. 9 and the mouse activates this profile immediately.
10Users: http://roccat.sourceforge.net 10Users: http://roccat.sourceforge.net
11 11
12What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/koneplus/roccatkoneplus<minor>/firmware_version 12What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/koneplus/roccatkoneplus<minor>/info
13Date: October 2010 13Date: November 2012
14Contact: Stefan Achatz <erazor_de@users.sourceforge.net> 14Contact: Stefan Achatz <erazor_de@users.sourceforge.net>
15Description: When read, this file returns the raw integer version number of the 15Description: When read, this file returns general data like firmware version.
16 firmware reported by the mouse. Using the integer value eases 16 When written, the device can be reset.
17 further usage in other programs. To receive the real version 17 The data is 8 bytes long.
18 number the decimal point has to be shifted 2 positions to the
19 left. E.g. a returned value of 121 means 1.21
20 This file is readonly.
21Users: http://roccat.sourceforge.net 18Users: http://roccat.sourceforge.net
22 19
23What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/koneplus/roccatkoneplus<minor>/macro 20What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/koneplus/roccatkoneplus<minor>/macro
diff --git a/drivers/hid/hid-roccat-koneplus.c b/drivers/hid/hid-roccat-koneplus.c
index 0df408362ef1..69592f427579 100644
--- a/drivers/hid/hid-roccat-koneplus.c
+++ b/drivers/hid/hid-roccat-koneplus.c
@@ -183,6 +183,22 @@ static ssize_t koneplus_sysfs_write(struct file *fp, struct kobject *kobj,
183 return real_size; 183 return real_size;
184} 184}
185 185
186static ssize_t koneplus_sysfs_read_info(struct file *fp,
187 struct kobject *kobj, struct bin_attribute *attr, char *buf,
188 loff_t off, size_t count)
189{
190 return koneplus_sysfs_read(fp, kobj, buf, off, count,
191 sizeof(struct koneplus_info), KONEPLUS_COMMAND_INFO);
192}
193
194static ssize_t koneplus_sysfs_write_info(struct file *fp,
195 struct kobject *kobj, struct bin_attribute *attr, char *buf,
196 loff_t off, size_t count)
197{
198 return koneplus_sysfs_write(fp, kobj, buf, off, count,
199 sizeof(struct koneplus_info), KONEPLUS_COMMAND_INFO);
200}
201
186static ssize_t koneplus_sysfs_write_talk(struct file *fp, 202static ssize_t koneplus_sysfs_write_talk(struct file *fp,
187 struct kobject *kobj, struct bin_attribute *attr, char *buf, 203 struct kobject *kobj, struct bin_attribute *attr, char *buf,
188 loff_t off, size_t count) 204 loff_t off, size_t count)
@@ -429,6 +445,12 @@ static struct device_attribute koneplus_attributes[] = {
429 445
430static struct bin_attribute koneplus_bin_attributes[] = { 446static struct bin_attribute koneplus_bin_attributes[] = {
431 { 447 {
448 .attr = { .name = "info", .mode = 0660 },
449 .size = sizeof(struct koneplus_info),
450 .read = koneplus_sysfs_read_info,
451 .write = koneplus_sysfs_write_info
452 },
453 {
432 .attr = { .name = "sensor", .mode = 0660 }, 454 .attr = { .name = "sensor", .mode = 0660 },
433 .size = sizeof(struct koneplus_sensor), 455 .size = sizeof(struct koneplus_sensor),
434 .read = koneplus_sysfs_read_sensor, 456 .read = koneplus_sysfs_read_sensor,