Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932299Ab2JQPil (ORCPT ); Wed, 17 Oct 2012 11:38:41 -0400 Received: from cantor2.suse.de ([195.135.220.15]:51250 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753394Ab2JQPij (ORCPT ); Wed, 17 Oct 2012 11:38:39 -0400 Date: Wed, 17 Oct 2012 17:38:27 +0200 (CEST) From: Jiri Kosina To: Stefan Achatz Cc: Rob Landley , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org Subject: Re: [PATCH] HID: roccat: Made tcu sysfs attr rw to allow readout of koneplus sensor register data In-Reply-To: <1350484542.12102.2.camel@neuromancer.tessier-ashpool> Message-ID: References: <1350484542.12102.2.camel@neuromancer.tessier-ashpool> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2953 Lines: 70 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 > --- > .../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/-:./ Date: October 2010 > Contact: Stefan Achatz > 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/-:./::./koneplus/roccatkoneplus/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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/