summaryrefslogtreecommitdiff
path: root/drivers/hid/hid-roccat-koneplus.c
diff options
context:
space:
mode:
authorStefan Achatz <erazor_de@users.sourceforge.net>2012-11-04 12:39:04 +0400
committerJiri Kosina <jkosina@suse.cz>2012-11-05 16:17:39 +0400
commitfabe51eb68d450d25b18882988b29626f51592fd (patch)
tree541471c04a7b2c42fc7a4606ae8eb71716c0be50 /drivers/hid/hid-roccat-koneplus.c
parent9e78eb8fbba5b00678d3d20e8e435cd0500716f3 (diff)
downloadlinux-fabe51eb68d450d25b18882988b29626f51592fd.tar.xz
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>
Diffstat (limited to 'drivers/hid/hid-roccat-koneplus.c')
-rw-r--r--drivers/hid/hid-roccat-koneplus.c22
1 files changed, 22 insertions, 0 deletions
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,
return real_size;
}
+static ssize_t koneplus_sysfs_read_info(struct file *fp,
+ struct kobject *kobj, struct bin_attribute *attr, char *buf,
+ loff_t off, size_t count)
+{
+ return koneplus_sysfs_read(fp, kobj, buf, off, count,
+ sizeof(struct koneplus_info), KONEPLUS_COMMAND_INFO);
+}
+
+static ssize_t koneplus_sysfs_write_info(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_info), KONEPLUS_COMMAND_INFO);
+}
+
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)
@@ -429,6 +445,12 @@ static struct device_attribute koneplus_attributes[] = {
static struct bin_attribute koneplus_bin_attributes[] = {
{
+ .attr = { .name = "info", .mode = 0660 },
+ .size = sizeof(struct koneplus_info),
+ .read = koneplus_sysfs_read_info,
+ .write = koneplus_sysfs_write_info
+ },
+ {
.attr = { .name = "sensor", .mode = 0660 },
.size = sizeof(struct koneplus_sensor),
.read = koneplus_sysfs_read_sensor,