From patchwork Wed Oct 26 01:26:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Wood X-Patchwork-Id: 9395781 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EA7DC60231 for ; Wed, 26 Oct 2016 01:26:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9649829758 for ; Wed, 26 Oct 2016 01:26:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8A6792975A; Wed, 26 Oct 2016 01:26:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C7E5429758 for ; Wed, 26 Oct 2016 01:26:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754631AbcJZB0b (ORCPT ); Tue, 25 Oct 2016 21:26:31 -0400 Received: from host18.canaca.com ([66.49.204.205]:40974 "EHLO host18.canaca.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754149AbcJZB0b (ORCPT ); Tue, 25 Oct 2016 21:26:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mungewell.org; s=default; h=Message-Id:Date:Subject:Cc:To:From:Sender: Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=jXOaQZgm390yD9B6XoJKhlv7z79tHZMdi6APgvKBaAg=; b=IcniF6PdQt2s3lATMESLiQuf1e ULbJXmLlkl0j/h4yTcDr7y5n6/upt1GY5tM3pVGMvPlc5Fl17QyxXfX/VH7ZxIP0DT6hX4c7Qbw5S /JZUH0SrM4vmzj/pc11WGdyqGp20AXHzGaO93gaqFFDZeFjdGQz7tqWh6O7k8B9T6QmbhmrcXzw8I jcZ6fBI+/mEz/or3j21B2N/Q0kM2ZkUBPNbe0qySzSd3QJKE5OKZVk/yui6OR6+5MtpeCHWeVHuCM NWJhiW7v1xXTwA/Ob6R7WAq63zOxi2xz7AsmADw7b0plxt6/FI3DCfCIiixRSi2z3mBlliuFH+V96 zOKgtCnA==; Received: from 199-7-159-40.eng.wind.ca ([199.7.159.40]:33365 helo=localhost.localdomain) by host18.canaca.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-SHA256:128) (Exim 4.87) (envelope-from ) id 1bzCz5-0006a1-GN; Tue, 25 Oct 2016 21:26:28 -0400 From: Simon Wood To: linux-input@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Jiri Kosina , Edwin Velds , Elias Vanderstuyft , Michal Maly , Simon Wood Subject: [RFC] HID:hid-lg4ff: Delay to allow wheels to center after plug-in Date: Tue, 25 Oct 2016 19:26:12 -0600 Message-Id: <1477445172-2682-1-git-send-email-simon@mungewell.org> X-Mailer: git-send-email 2.7.4 X-OutGoing-Spam-Status: No, score=-1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - host18.canaca.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - mungewell.org X-Get-Message-Sender-Via: host18.canaca.com: authenticated_id: gitsend@mungewell.org X-Authenticated-Sender: host18.canaca.com: gitsend@mungewell.org X-Source: X-Source-Args: X-Source-Dir: X-From-Rewrite: rewritten was: [simon@mungewell.org], actual sender does not match 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 A number of wheels (G27/etc) do a little full right/full left 'dance' when first plugged in. This patch inserts a delay so that this 'dance' is completed before we disable (set to zero) the autocenter spring. A side benefit is that the DFGT was confused without the delay, and is now correctly being set to 900' rotation mode. Side Effect - and the reason I am sending as RFC. This 8s delay seems to have an effect on other wheels connected at the same time. With 3 wheels on a hub, and then the hub connected to PC. The wheel on the right in video below waits for G27 to complete this 8s, before it will do it's 'dance' and register with the system. https://www.youtube.com/watch?v=xCVpCw_yGgA I don't know if this is a problem, or if someone here has suggestions on a better way to implement the delay... --- drivers/hid/hid-lg4ff.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/hid/hid-lg4ff.c b/drivers/hid/hid-lg4ff.c index af3a8ec..3eee920 100644 --- a/drivers/hid/hid-lg4ff.c +++ b/drivers/hid/hid-lg4ff.c @@ -1248,6 +1248,8 @@ int lg4ff_init(struct hid_device *hid) /* Check if autocentering is available and * set the centering force to zero by default */ if (test_bit(FF_AUTOCENTER, dev->ffbit)) { + wait_queue_head_t wait; + /* Formula Force EX expects different autocentering command */ if ((bcdDevice >> 8) == LG4FF_FFEX_REV_MAJ && (bcdDevice & 0xff) == LG4FF_FFEX_REV_MIN) @@ -1255,6 +1257,14 @@ int lg4ff_init(struct hid_device *hid) else dev->ff->set_autocenter = lg4ff_set_autocenter_default; + /* insert a 8s delay to allow DFGT/G25/G27/G29 wheels to return to center position*/ + if (lg4ff_devices[i].product_id == USB_DEVICE_ID_LOGITECH_DFGT_WHEEL || + lg4ff_devices[i].product_id == USB_DEVICE_ID_LOGITECH_G25_WHEEL || + lg4ff_devices[i].product_id == USB_DEVICE_ID_LOGITECH_G27_WHEEL || + lg4ff_devices[i].product_id == USB_DEVICE_ID_LOGITECH_G29_WHEEL) { + init_waitqueue_head (&wait); + wait_event_interruptible_timeout(wait, 0, msecs_to_jiffies(8000)); + } dev->ff->set_autocenter(dev, 0); }