From patchwork Sat Aug 27 13:24:41 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Achatz X-Patchwork-Id: 1103752 X-Patchwork-Delegate: jikos@jikos.cz Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p7RDPg8a029459 for ; Sat, 27 Aug 2011 13:25:47 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751941Ab1H0NYp (ORCPT ); Sat, 27 Aug 2011 09:24:45 -0400 Received: from mail-in-03.arcor-online.net ([151.189.21.43]:42917 "EHLO mail-in-03.arcor-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751836Ab1H0NYn (ORCPT ); Sat, 27 Aug 2011 09:24:43 -0400 Received: from mail-in-11-z2.arcor-online.net (mail-in-11-z2.arcor-online.net [151.189.8.28]) by mx.arcor.de (Postfix) with ESMTP id 79A781AD29F; Sat, 27 Aug 2011 15:24:42 +0200 (CEST) Received: from mail-in-10.arcor-online.net (mail-in-10.arcor-online.net [151.189.21.50]) by mail-in-11-z2.arcor-online.net (Postfix) with ESMTP id 6EB221CB60B; Sat, 27 Aug 2011 15:24:42 +0200 (CEST) Received: from [192.168.0.7] (dslb-188-105-218-067.pools.arcor-ip.net [188.105.218.67]) (Authenticated sender: screamingfist@arcor.de) by mail-in-10.arcor-online.net (Postfix) with ESMTPSA id 19D2E2D6714; Sat, 27 Aug 2011 15:24:42 +0200 (CEST) X-DKIM: Sendmail DKIM Filter v2.8.2 mail-in-10.arcor-online.net 19D2E2D6714 Subject: [PATCH 2/5] HID: roccat: Pyra now reports external profile changes via roccat device From: Stefan Achatz Reply-To: erazor_de@users.sourceforge.net To: Jiri Kosina , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Date: Sat, 27 Aug 2011 15:24:41 +0200 Message-ID: <1314451481.24216.73.camel@neuromancer.tessier-ashpool> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 (2.30.3-1.fc13) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Sat, 27 Aug 2011 13:25:47 +0000 (UTC) Profile changes were only reported when issued mouse internal. Now all changes are reported. Signed-off-by: Stefan Achatz --- drivers/hid/hid-roccat-pyra.c | 23 +++++++++++++++-------- 1 files changed, 15 insertions(+), 8 deletions(-) diff --git a/drivers/hid/hid-roccat-pyra.c b/drivers/hid/hid-roccat-pyra.c index 8140776b..df05c1b 100644 --- a/drivers/hid/hid-roccat-pyra.c +++ b/drivers/hid/hid-roccat-pyra.c @@ -298,6 +298,7 @@ static ssize_t pyra_sysfs_write_settings(struct file *fp, struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); int retval = 0; int difference; + struct pyra_roccat_report roccat_report; if (off != 0 || count != sizeof(struct pyra_settings)) return -EINVAL; @@ -307,17 +308,23 @@ static ssize_t pyra_sysfs_write_settings(struct file *fp, if (difference) { retval = pyra_set_settings(usb_dev, (struct pyra_settings const *)buf); - if (!retval) - memcpy(&pyra->settings, buf, - sizeof(struct pyra_settings)); - } - mutex_unlock(&pyra->pyra_lock); + if (retval) { + mutex_unlock(&pyra->pyra_lock); + return retval; + } - if (retval) - return retval; + memcpy(&pyra->settings, buf, + sizeof(struct pyra_settings)); - profile_activated(pyra, pyra->settings.startup_profile); + profile_activated(pyra, pyra->settings.startup_profile); + roccat_report.type = PYRA_MOUSE_EVENT_BUTTON_TYPE_PROFILE_2; + roccat_report.value = pyra->settings.startup_profile + 1; + roccat_report.key = 0; + roccat_report_event(pyra->chrdev_minor, + (uint8_t const *)&roccat_report); + } + mutex_unlock(&pyra->pyra_lock); return sizeof(struct pyra_settings); }