* [PATCH] HID: roccat: Made tcu sysfs attr rw to allow readout of koneplus sensor register data
@ 2012-10-17 14:35 Stefan Achatz
2012-10-17 15:38 ` Jiri Kosina
0 siblings, 1 reply; 2+ messages in thread
From: Stefan Achatz @ 2012-10-17 14:35 UTC (permalink / raw)
To: Rob Landley, Jiri Kosina, linux-doc, linux-kernel, linux-input
tcu sysfs attr was used to only control calibration process so far. Reverse
engineering the firmware revealed direct sensor register access. Allowing
readout of tcu permits usage of this feature.
Signed-off-by: Stefan Achatz <erazor_de@users.sourceforge.net>
---
.../ABI/testing/sysfs-driver-hid-roccat-koneplus | 6 +++---
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 65e6e5d..f9e2a61 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-
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
diff --git a/drivers/hid/hid-roccat-koneplus.c b/drivers/hid/hid-roccat-koneplus.c
index f5602fe..c47540a 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,
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
},
{
--
1.7.3.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] HID: roccat: Made tcu sysfs attr rw to allow readout of koneplus sensor register data
2012-10-17 14:35 [PATCH] HID: roccat: Made tcu sysfs attr rw to allow readout of koneplus sensor register data Stefan Achatz
@ 2012-10-17 15:38 ` Jiri Kosina
0 siblings, 0 replies; 2+ messages in thread
From: Jiri Kosina @ 2012-10-17 15:38 UTC (permalink / raw)
To: Stefan Achatz; +Cc: Rob Landley, linux-doc, linux-kernel, linux-input
On Wed, 17 Oct 2012, Stefan Achatz wrote:
> tcu sysfs attr was used to only control calibration process so far. Reverse
> engineering the firmware revealed direct sensor register access. Allowing
> readout of tcu permits usage of this feature.
>
> Signed-off-by: Stefan Achatz <erazor_de@users.sourceforge.net>
> ---
> .../ABI/testing/sysfs-driver-hid-roccat-koneplus | 6 +++---
> 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 65e6e5d..f9e2a61 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-
> 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
> diff --git a/drivers/hid/hid-roccat-koneplus.c b/drivers/hid/hid-roccat-koneplus.c
> index f5602fe..c47540a 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,
> 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
> },
> {
Applied, thanks.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-10-17 15:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-17 14:35 [PATCH] HID: roccat: Made tcu sysfs attr rw to allow readout of koneplus sensor register data Stefan Achatz
2012-10-17 15:38 ` Jiri Kosina
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox