From patchwork Tue Aug 16 04:10:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cameron Gutman X-Patchwork-Id: 9282581 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 08B036086A for ; Tue, 16 Aug 2016 04:10:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EAC1028B9F for ; Tue, 16 Aug 2016 04:10:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DF8D328BB5; Tue, 16 Aug 2016 04:10:24 +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_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 7E42928BB2 for ; Tue, 16 Aug 2016 04:10:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751586AbcHPEKW (ORCPT ); Tue, 16 Aug 2016 00:10:22 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:33112 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751425AbcHPEKW (ORCPT ); Tue, 16 Aug 2016 00:10:22 -0400 Received: by mail-pf0-f193.google.com with SMTP id i6so4772344pfe.0 for ; Mon, 15 Aug 2016 21:10:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=JJnK3u/xlzh+wwZ1hWPQL9A9sqkP/v0XJw14q3PdgBo=; b=w5t5lqCejXRdQ0VkFVUpm15ERMRUFlhojZXPee33PUrcvYjECKfadbu7JsZk6MnH2z zIE979GJ5pqNS4KiTVGjOmuvETdlIv7yB2QHW3jtkgQ8spT+KRpC0tVQKs3ElXzhtD3w IEgDDTAzC8Aa9GDwyHm0ru1eppt6evBqZBEFvNU1Xwk9xyMbEuS8KykzI2FvZdDaYxTw yi/pzzQ1hUtuo+vz7KivIkIaVaSSXSRC7mHdeMF/4ASSDk4dci+VoL6dUXSPt0DTpoIc irqaw/UwtkjExTnjY4GEDanp0cUTpS+67aK7ri4NsD3m8pRGIPeMW2ijXwHZa4Kp65XY OG7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=JJnK3u/xlzh+wwZ1hWPQL9A9sqkP/v0XJw14q3PdgBo=; b=lJJxmthx0JA6VPIEbYEeG9YOMRZehc/2jyqCkuiDiqRZwRtrAz7Yh1b6RhI0/2EY2M pR2tpPnMjXbhbo+F6IetuCRo5KvS+qq6lAGe1XvZK82kql3TPtLTGVnBOWbKpcK3SYTi B1y8IUkIQ6fcZ69SuK9G4lT81n49iN/WKICZ66bIdk1lYbrammHdTgB6UriGPRD5zGX6 jCaGPkbOolpI6I0CFHTjjbjj5PmwUq5CrKaeWbYYgNm+HIeuAKpsnMQnNLGlnZkcV5hV bbtRlu1KvIiBiQ4K7udHI+3qtqdoEimI8KZUXhxXAM+mvch17jFCEAGPwlJLWKN1roIw AH/A== X-Gm-Message-State: AEkoous/3xc5qyC7EstXG0IuoPUwYxL+Y9zLCKKaont2yny+c6nZctoA8XzhzA2IdGZSFw== X-Received: by 10.98.80.220 with SMTP id g89mr140832pfj.12.1471320621294; Mon, 15 Aug 2016 21:10:21 -0700 (PDT) Received: from localhost.localdomain (c-24-16-1-64.hsd1.wa.comcast.net. [24.16.1.64]) by smtp.gmail.com with ESMTPSA id 15sm34819577pfz.36.2016.08.15.21.10.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 15 Aug 2016 21:10:20 -0700 (PDT) From: Cameron Gutman To: dmitry.torokhov@gmail.com, rojtberg@gmail.com Cc: linux-input@vger.kernel.org Subject: [PATCH v2 4/4] Input: xpad - fix Xbox One rumble stopping after 2.5 secs Date: Mon, 15 Aug 2016 21:10:16 -0700 Message-Id: <1471320616-13110-5-git-send-email-aicommander@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1471320616-13110-1-git-send-email-aicommander@gmail.com> References: <1471320616-13110-1-git-send-email-aicommander@gmail.com> 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 Unlike previous Xbox pads, the Xbox One pad doesn't have "sticky" rumble packets. The duration is encoded into the command and expiration is handled by the pad firmware. ff-memless needs pseudo-sticky behavior for rumble effects to behave properly for long duration effects. We already specify the maximum rumble on duration in the command packets, but it's still only good for about 2.5 seconds of rumble. This is easily reproducable running fftest's sine vibration test. It turns out there's a repeat count encoded in the rumble command. We can abuse that to get the pseudo-sticky behavior needed for rumble to behave as expected for effects with long duration. By my math, this change should allow a single ff_effect to rumble for 10 minutes straight, which should be more than enough for most needs. Signed-off-by: Cameron Gutman --- drivers/input/joystick/xpad.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index 42723ba..8954643 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c @@ -1078,9 +1078,9 @@ static int xpad_play_effect(struct input_dev *dev, void *data, struct ff_effect packet->data[7] = 0x00; packet->data[8] = strong / 512; /* left actuator */ packet->data[9] = weak / 512; /* right actuator */ - packet->data[10] = 0xFF; - packet->data[11] = 0x00; - packet->data[12] = 0x00; + packet->data[10] = 0xFF; /* on period */ + packet->data[11] = 0x00; /* off period */ + packet->data[12] = 0xFF; /* repeat count */ packet->len = 13; packet->pending = true; break;