From fabe51eb68d450d25b18882988b29626f51592fd Mon Sep 17 00:00:00 2001 From: Stefan Achatz Date: Sun, 4 Nov 2012 09:39:04 +0100 Subject: 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 Signed-off-by: Jiri Kosina --- drivers/hid/hid-roccat-koneplus.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'drivers/hid') diff --git a/drivers/hid/hid-roccat-koneplus.c b/drivers/hid/hid-roccat-koneplus.c index 0df4083..69592f4 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, -- cgit v1.1