From patchwork Thu Feb 26 09:14:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Keir X-Patchwork-Id: 5890741 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E8434BF440 for ; Thu, 26 Feb 2015 10:51:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0D3D520392 for ; Thu, 26 Feb 2015 10:51:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4823F20381 for ; Thu, 26 Feb 2015 10:51:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753432AbbBZKvl (ORCPT ); Thu, 26 Feb 2015 05:51:41 -0500 Received: from a8-41.smtp-out.amazonses.com ([54.240.8.41]:51661 "EHLO a8-41.smtp-out.amazonses.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753423AbbBZKvk (ORCPT ); Thu, 26 Feb 2015 05:51:40 -0500 X-Greylist: delayed 5463 seconds by postgrey-1.27 at vger.kernel.org; Thu, 26 Feb 2015 05:51:39 EST DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=224i4yxa5dv7c2xz3womw6peuasteono; d=amazonses.com; t=1424942043; h=From:To:Cc:Subject:Date:Message-Id:Feedback-ID; bh=IWBamy+vW84WxWpWXr6Zy05pMcfy6p1pL3FUYeXuoI8=; b=HECoGkkZkmCTd4hcHjS18s/k8CSyo1RHTLH2BjSUkZMl8yZKYqrwy963n69za3ay olRmjyMH2EtuUQsZyiA+N60Yek44ak4n/5qQpp07EofHpXQwti+BVocfdzCFZge05Lx 122F+JFwXtdsAc89gdX57KP0TAVzKg4FB0myRUjE= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=wskikwaygy6dq7o6mewsvwbivuod352d; d=oracledbadirect.com; t=1424942043; h=From:To:Cc:Subject:Date:Message-Id; bh=IWBamy+vW84WxWpWXr6Zy05pMcfy6p1pL3FUYeXuoI8=; b=feLsvhWGpSm7ftv/Nx6BJ5yMPZ/IdBzN5AMJL68Dx4kdWawb4TtH0ODD5s8blm6E sF6zWv0hu4mUU+T3rMQdTGTJlhu3MkbK7K8FjYmVsfLtv/4EjPk49eAdQ15l7y+Qtxu cz4mVaK/WaPzYHAK/72cUj5691Jz45RzYGeRVf58= X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 From: Jim Keir To: linux-input@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, jkosina@suse.cz Cc: Jim Keir Subject: [PATCH] pidff driver should work correctly with more than one concurrent effect Date: Thu, 26 Feb 2015 09:14:03 +0000 Message-ID: <0000014bc52a127f-0356eeb8-db7b-4e77-b285-0ab07359baf0-000000@email.amazonses.com> X-Mailer: git-send-email 1.9.1 X-SES-Outgoing: 2015.02.26-54.240.8.41 Feedback-ID: 1.us-east-1.Ctoau/OhdNbEZ0dRWf99WcFGfTItdRVqWO0+uFukSRE=:AmazonSES Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The PID driver (usbhid/hid-pidff.c) does not set the effect ID when uploading an effect. The result is that the initial upload works but subsequent uploads to modify effect parameters are all directed at the last-created effect. The targeted effect ID must be passed back to the device when effect parameters are changed. This is done at the start of "pidff_set_condition_report", "pidff_set_periodic_report" etc. based on the value of "pidff->block_load[PID_EFFECT_ BLOCK_INDEX].value[0]". This value is only ever set during pidff_request_effect_upload. The result is stored in "pidff->pid_id[effect->id]" at the end of pid_upload_effect, for later use. However, if an effect is modified and re-sent then this identifier is not being copied back from pidff->pid_id[effect->id] before sending the command to the device. The fix is to do this at the start of pidff_upload_effect. Signed-off-by: Jim Keir --- drivers/hid/usbhid/hid-pidff.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/hid/usbhid/hid-pidff.c b/drivers/hid/usbhid/hid-pidff.c index 0b531c6..1b3fa70 100644 --- a/drivers/hid/usbhid/hid-pidff.c +++ b/drivers/hid/usbhid/hid-pidff.c @@ -568,6 +568,12 @@ static int pidff_upload_effect(struct input_dev *dev, struct ff_effect *effect, int type_id; int error; + pidff->block_load[PID_EFFECT_BLOCK_INDEX].value[0] = 0; + if (old && effect) { + pidff->block_load[PID_EFFECT_BLOCK_INDEX].value[0] = + pidff->pid_id[effect->id]; + } + switch (effect->type) { case FF_CONSTANT: if (!old) {