diff options
author | Stefan Achatz <erazor_de@users.sourceforge.net> | 2012-10-17 10:35:42 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2012-10-17 11:37:21 -0400 |
commit | 5277e97c2474a85eb0325ac6fff71910a4e6c134 (patch) | |
tree | 076e5448a8e733d5bd8057cbc94202ed93864eeb | |
parent | 4424f616e48e0a48ac31de8d223ba1bdb46a84f1 (diff) |
HID: roccat: allow readout of koneplus sensor register data
tcu sysfs attr was used to only control calibration process so far. Direct
sensor register access possibility has been revealed. Allowing readout of tcu
permits usage of this feature.
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 | 6 | ||||
-rw-r--r-- | drivers/hid/hid-roccat-koneplus.c | 11 |
2 files changed, 13 insertions, 4 deletions
diff --git a/Documentation/ABI/testing/sysfs-driver-hid-roccat-koneplus b/Documentation/ABI/testing/sysfs-driver-hid-roccat-koneplus index 65e6e5dd67e8..f9e2a61900e5 100644 --- a/Documentation/ABI/testing/sysfs-driver-hid-roccat-koneplus +++ b/Documentation/ABI/testing/sysfs-driver-hid-roccat-koneplus | |||
@@ -104,9 +104,9 @@ What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid- | |||
104 | Date: October 2010 | 104 | Date: October 2010 |
105 | Contact: Stefan Achatz <erazor_de@users.sourceforge.net> | 105 | Contact: Stefan Achatz <erazor_de@users.sourceforge.net> |
106 | Description: When written a calibration process for the tracking control unit | 106 | Description: When written a calibration process for the tracking control unit |
107 | can be initiated/cancelled. | 107 | can be initiated/cancelled. Also lets one read/write sensor |
108 | The data has to be 3 bytes long. | 108 | registers. |
109 | This file is writeonly. | 109 | The data has to be 4 bytes long. |
110 | Users: http://roccat.sourceforge.net | 110 | Users: http://roccat.sourceforge.net |
111 | 111 | ||
112 | What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/koneplus/roccatkoneplus<minor>/tcu_image | 112 | What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/koneplus/roccatkoneplus<minor>/tcu_image |
diff --git a/drivers/hid/hid-roccat-koneplus.c b/drivers/hid/hid-roccat-koneplus.c index f5602fec4865..c47540a5d4f3 100644 --- a/drivers/hid/hid-roccat-koneplus.c +++ b/drivers/hid/hid-roccat-koneplus.c | |||
@@ -222,6 +222,14 @@ static ssize_t koneplus_sysfs_write_tcu(struct file *fp, | |||
222 | sizeof(struct koneplus_tcu), KONEPLUS_COMMAND_TCU); | 222 | sizeof(struct koneplus_tcu), KONEPLUS_COMMAND_TCU); |
223 | } | 223 | } |
224 | 224 | ||
225 | static ssize_t koneplus_sysfs_read_tcu(struct file *fp, | ||
226 | struct kobject *kobj, struct bin_attribute *attr, char *buf, | ||
227 | loff_t off, size_t count) | ||
228 | { | ||
229 | return koneplus_sysfs_read(fp, kobj, buf, off, count, | ||
230 | sizeof(struct koneplus_tcu), KONEPLUS_COMMAND_TCU); | ||
231 | } | ||
232 | |||
225 | static ssize_t koneplus_sysfs_read_tcu_image(struct file *fp, | 233 | static ssize_t koneplus_sysfs_read_tcu_image(struct file *fp, |
226 | struct kobject *kobj, struct bin_attribute *attr, char *buf, | 234 | struct kobject *kobj, struct bin_attribute *attr, char *buf, |
227 | loff_t off, size_t count) | 235 | loff_t off, size_t count) |
@@ -426,8 +434,9 @@ static struct bin_attribute koneplus_bin_attributes[] = { | |||
426 | .write = koneplus_sysfs_write_sensor | 434 | .write = koneplus_sysfs_write_sensor |
427 | }, | 435 | }, |
428 | { | 436 | { |
429 | .attr = { .name = "tcu", .mode = 0220 }, | 437 | .attr = { .name = "tcu", .mode = 0660 }, |
430 | .size = sizeof(struct koneplus_tcu), | 438 | .size = sizeof(struct koneplus_tcu), |
439 | .read = koneplus_sysfs_read_tcu, | ||
431 | .write = koneplus_sysfs_write_tcu | 440 | .write = koneplus_sysfs_write_tcu |
432 | }, | 441 | }, |
433 | { | 442 | { |