]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
HID: roccat: allow readout of koneplus sensor register data
authorStefan Achatz <erazor_de@users.sourceforge.net>
Wed, 17 Oct 2012 14:35:42 +0000 (16:35 +0200)
committerJiri Kosina <jkosina@suse.cz>
Wed, 17 Oct 2012 15:37:21 +0000 (17:37 +0200)
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>
Documentation/ABI/testing/sysfs-driver-hid-roccat-koneplus
drivers/hid/hid-roccat-koneplus.c

index 65e6e5dd67e83a04cc0f8e93feffda8eb5c7be38..f9e2a61900e506cc8fe77930462e96d19d7abdb0 100644 (file)
@@ -104,9 +104,9 @@ What:               /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-
 Date:          October 2010
 Contact:       Stefan Achatz <erazor_de@users.sourceforge.net>
 Description:   When written a calibration process for the tracking control unit
-               can be initiated/cancelled.
-               The data has to be 3 bytes long.
-               This file is writeonly.
+               can be initiated/cancelled. Also lets one read/write sensor
+               registers.
+               The data has to be 4 bytes long.
 Users:         http://roccat.sourceforge.net
 
 What:          /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/koneplus/roccatkoneplus<minor>/tcu_image
index f5602fec48655016ca0fabdad1b743f71c17ae52..c47540a5d4f32b4861241f91871ab4c4220795ff 100644 (file)
@@ -222,6 +222,14 @@ static ssize_t koneplus_sysfs_write_tcu(struct file *fp,
                        sizeof(struct koneplus_tcu), KONEPLUS_COMMAND_TCU);
 }
 
+static ssize_t koneplus_sysfs_read_tcu(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_tcu), KONEPLUS_COMMAND_TCU);
+}
+
 static ssize_t koneplus_sysfs_read_tcu_image(struct file *fp,
                struct kobject *kobj, struct bin_attribute *attr, char *buf,
                loff_t off, size_t count)
@@ -426,8 +434,9 @@ static struct bin_attribute koneplus_bin_attributes[] = {
                .write = koneplus_sysfs_write_sensor
        },
        {
-               .attr = { .name = "tcu", .mode = 0220 },
+               .attr = { .name = "tcu", .mode = 0660 },
                .size = sizeof(struct koneplus_tcu),
+               .read = koneplus_sysfs_read_tcu,
                .write = koneplus_sysfs_write_tcu
        },
        {