diff options
| author | Stefan Achatz <erazor_de@users.sourceforge.net> | 2012-11-04 03:39:04 -0500 |
|---|---|---|
| committer | Jiri Kosina <jkosina@suse.cz> | 2012-11-05 07:17:39 -0500 |
| commit | fabe51eb68d450d25b18882988b29626f51592fd (patch) | |
| tree | 541471c04a7b2c42fc7a4606ae8eb71716c0be50 | |
| parent | 9e78eb8fbba5b00678d3d20e8e435cd0500716f3 (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-koneplus | 11 | ||||
| -rw-r--r-- | Documentation/ABI/testing/sysfs-driver-hid-roccat-koneplus | 13 | ||||
| -rw-r--r-- | drivers/hid/hid-roccat-koneplus.c | 22 |
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 | |||
| 12 | What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/koneplus/roccatkoneplus<minor>/firmware_version | ||
| 13 | Date: October 2010 | ||
| 14 | Contact: Stefan Achatz <erazor_de@users.sourceforge.net> | ||
| 15 | Description: 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. |
| 10 | Users: http://roccat.sourceforge.net | 10 | Users: http://roccat.sourceforge.net |
| 11 | 11 | ||
| 12 | What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/koneplus/roccatkoneplus<minor>/firmware_version | 12 | What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/koneplus/roccatkoneplus<minor>/info |
| 13 | Date: October 2010 | 13 | Date: November 2012 |
| 14 | Contact: Stefan Achatz <erazor_de@users.sourceforge.net> | 14 | Contact: Stefan Achatz <erazor_de@users.sourceforge.net> |
| 15 | Description: When read, this file returns the raw integer version number of the | 15 | Description: 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. | ||
| 21 | Users: http://roccat.sourceforge.net | 18 | Users: http://roccat.sourceforge.net |
| 22 | 19 | ||
| 23 | What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/koneplus/roccatkoneplus<minor>/macro | 20 | What: /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 | ||
| 186 | static 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 | |||
| 194 | static 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 | |||
| 186 | static ssize_t koneplus_sysfs_write_talk(struct file *fp, | 202 | static 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 | ||
| 430 | static struct bin_attribute koneplus_bin_attributes[] = { | 446 | static 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, |
