Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2568614imu; Thu, 29 Nov 2018 07:02:35 -0800 (PST) X-Google-Smtp-Source: AFSGD/UQzQz36rC4dN1qpSzfydj5YfDJ8uwQnQj3jAClM+dMtcachGsMa6JwHg5sbyX7yXuTp5no X-Received: by 2002:a63:e20a:: with SMTP id q10mr325515pgh.206.1543503755694; Thu, 29 Nov 2018 07:02:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543503755; cv=none; d=google.com; s=arc-20160816; b=Un2/pWhMvKTWIzAOKiQ/kg3UM1bACFyhQrOSbphBpFst/WpSiA6Hgvg/vrbvnfDnK9 zKLjaXr96bXDwpPs4tw2oYlajLhAybdkVqh0iqqBntf+BohLlXPBOXGnFD+itvUd9Mjf Koq36RvwrABW8as8AlHPG0ZdnwIRRd1Z6JlE4B0HYgdEHGpjWdNKG4muQimOrzodYcu5 av/xiwpRxsAa6guptt/7uLGZNn+dkFLIjWFAae9uxz/E8n7ZA7rAI14sbi6I2DkPpMg/ px6Z+OGOGGN1ceC/yT0qBZ4HUZ2O5MlJJU5NBEnuWTWxyaFVdkN2qgyPrd4BZfXJpknQ 9bOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=w0sULhpPnpVo4tngQGRWHrpHNaxVN7+PTK+XeYEGjbI=; b=RR3ZpbS5elZcio6YFGeNHI/F3lD4uFpr+Mv2a16qVzZFV+SrGdsl1W4T4lb6h5IizG pyLAY47rYDuCVOxojGefaIc/vE1UAxvkdBGCuhB63tby0THwPcWsJWKpsdEV90YU7ZKn PpCPOsTCf8c6XeYJ9ImQ85dH2HBdGgd7yIh/NoYPzqxV3f6E58cHcgSt1u/oHpMYhKDq ysdqr90LStoMy+fdZQHWgOXYfCtq3lmomgfCgNf/Ju1dFs58b/B2H3uBMsvh8sCfKgLp voVFdaQjWlRQOHuzZJC8LnEHTQqyBfLeFB7MInlrQ4qI1dAuLg5Tt1R0F4lr+LQn7z7D IGRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tyWE4RCa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f21si2127096pgb.371.2018.11.29.07.02.12; Thu, 29 Nov 2018 07:02:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tyWE4RCa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730707AbeK3BXt (ORCPT + 99 others); Thu, 29 Nov 2018 20:23:49 -0500 Received: from mail.kernel.org ([198.145.29.99]:46156 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729304AbeK3BXr (ORCPT ); Thu, 29 Nov 2018 20:23:47 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4A0C821104; Thu, 29 Nov 2018 14:18:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543501096; bh=lUE29AWK9xaBKInqKEo4xq9tnLFSwCFBIQ7ysw74Lak=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tyWE4RCatQZ3Pmd+sJoRDslEwl/reuOpigAzY6ahBR0MyJsV+8wqiycInFBx/3IVh Spjy2i6dxiDXqYesP0Y3n8Jv02h3KgDnubad4xR/mBnm5XRN5im7UXmI8OV7+lVoyZ D2/cEejPZ9pRgmswI+KwKcVwdzt/O0TFpqcvI1iE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Rojtberg , Dmitry Torokhov , Sasha Levin Subject: [PATCH 4.4 34/86] Input: xpad - update Xbox One Force Feedback Support Date: Thu, 29 Nov 2018 15:11:59 +0100 Message-Id: <20181129140112.930836165@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181129140109.832117862@linuxfoundation.org> References: <20181129140109.832117862@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 2a6d7527b35cf987260800807e328d167aef22ac ] There's apparently a serial number woven into both input and output packets; neglecting to specify a valid serial number causes the controller to ignore the rumble packets. The scale of the rumble was also apparently halved in the packets. The initialization packet had to be changed to allow force feedback to work. see https://github.com/paroj/xpad/issues/7 for details. Signed-off-by: Pavel Rojtberg Signed-off-by: Dmitry Torokhov Signed-off-by: Sasha Levin --- drivers/input/joystick/xpad.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index 88de7b17bf7d..bfe94216621f 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c @@ -350,6 +350,7 @@ struct usb_xpad { struct urb *irq_out; /* urb for interrupt out report */ bool irq_out_active; /* we must not use an active URB */ unsigned char *odata; /* output data */ + u8 odata_serial; /* serial number for xbox one protocol */ dma_addr_t odata_dma; spinlock_t odata_lock; @@ -925,7 +926,10 @@ static int xpad_start_xbox_one(struct usb_xpad *xpad) /* Xbox one controller needs to be initialized. */ packet->data[0] = 0x05; packet->data[1] = 0x20; - packet->len = 2; + packet->data[2] = xpad->odata_serial++; /* packet serial */ + packet->data[3] = 0x01; /* rumble bit enable? */ + packet->data[4] = 0x00; + packet->len = 5; packet->pending = true; /* Reset the sequence so we send out start packet first */ @@ -1000,17 +1004,18 @@ static int xpad_play_effect(struct input_dev *dev, void *data, struct ff_effect case XTYPE_XBOXONE: packet->data[0] = 0x09; /* activate rumble */ packet->data[1] = 0x08; - packet->data[2] = 0x00; + packet->data[2] = xpad->odata_serial++; packet->data[3] = 0x08; /* continuous effect */ packet->data[4] = 0x00; /* simple rumble mode */ packet->data[5] = 0x03; /* L and R actuator only */ packet->data[6] = 0x00; /* TODO: LT actuator */ packet->data[7] = 0x00; /* TODO: RT actuator */ - packet->data[8] = strong / 256; /* left actuator */ - packet->data[9] = weak / 256; /* right actuator */ + packet->data[8] = strong / 512; /* left actuator */ + packet->data[9] = weak / 512; /* right actuator */ packet->data[10] = 0x80; /* length of pulse */ packet->data[11] = 0x00; /* stop period of pulse */ - packet->len = 12; + packet->data[12] = 0x00; + packet->len = 13; packet->pending = true; break; -- 2.17.1