Commit 5277e97c authored by Stefan Achatz's avatar Stefan Achatz Committed by Jiri Kosina

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: default avatarStefan Achatz <erazor_de@users.sourceforge.net>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent 4424f616
...@@ -104,9 +104,9 @@ What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid- ...@@ -104,9 +104,9 @@ What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-
Date: October 2010 Date: October 2010
Contact: Stefan Achatz <erazor_de@users.sourceforge.net> Contact: Stefan Achatz <erazor_de@users.sourceforge.net>
Description: When written a calibration process for the tracking control unit Description: When written a calibration process for the tracking control unit
can be initiated/cancelled. can be initiated/cancelled. Also lets one read/write sensor
The data has to be 3 bytes long. registers.
This file is writeonly. The data has to be 4 bytes long.
Users: http://roccat.sourceforge.net 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 What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/koneplus/roccatkoneplus<minor>/tcu_image
......
...@@ -222,6 +222,14 @@ static ssize_t koneplus_sysfs_write_tcu(struct file *fp, ...@@ -222,6 +222,14 @@ static ssize_t koneplus_sysfs_write_tcu(struct file *fp,
sizeof(struct koneplus_tcu), KONEPLUS_COMMAND_TCU); 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, static ssize_t koneplus_sysfs_read_tcu_image(struct file *fp,
struct kobject *kobj, struct bin_attribute *attr, char *buf, struct kobject *kobj, struct bin_attribute *attr, char *buf,
loff_t off, size_t count) loff_t off, size_t count)
...@@ -426,8 +434,9 @@ static struct bin_attribute koneplus_bin_attributes[] = { ...@@ -426,8 +434,9 @@ static struct bin_attribute koneplus_bin_attributes[] = {
.write = koneplus_sysfs_write_sensor .write = koneplus_sysfs_write_sensor
}, },
{ {
.attr = { .name = "tcu", .mode = 0220 }, .attr = { .name = "tcu", .mode = 0660 },
.size = sizeof(struct koneplus_tcu), .size = sizeof(struct koneplus_tcu),
.read = koneplus_sysfs_read_tcu,
.write = koneplus_sysfs_write_tcu .write = koneplus_sysfs_write_tcu
}, },
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment