Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2516900imu; Thu, 29 Nov 2018 06:17:46 -0800 (PST) X-Google-Smtp-Source: AFSGD/U3dntrbztZP3t9kNduXzTxsqAl2zzvL+ySBcr2esfSLXmONuLvqyZOIGw/EMXpBbrHNttF X-Received: by 2002:a17:902:2a66:: with SMTP id i93mr1604836plb.113.1543501066562; Thu, 29 Nov 2018 06:17:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543501066; cv=none; d=google.com; s=arc-20160816; b=BGo16iZH16cEuhu9Pl9oV2O034mLnC/CM3rmO7Y1dKTgORCEGfHzcMgzgW7I6f6IU5 5qPSWZu7W4u7FOrmQp4lW7DumjH+l2aC66/2MG0f/pzLT33/SizUi8UxnH4A8M2F6fyV +P+hheTdK7HWXpGGdbRXuYuTUJdJxE9O4X+uiYcopmrnWOsQuaM+EDTKbHYSuIJB+7sP lLPeEsz309q0bS5vo9YWEKx+kNzPLKxrmsqIpBbScgdXJbf4pDltzGJAkb7mENOAFWms +uUKgH0MK3H97FRAsUKJKMfjV35SLRQOw8tywnyzHKnYP6QlODYyJoW+YKTOCr0avS+Y LFkg== 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=2byoyf4S9pjkgIgq3/oF/sZox2vY4l04h0JiIgLeruM=; b=V/qy/ZIUFhZm8GXckKSQ/2y5jBbJDZmIchJJ76B8BT8O/dkJirgpfpXQQDulwEeORe zqFXvQuSqeKImFp30MbV/W+8YZsae1pdztSJP0eOyw7iR6lCh+mwphSC8JEH/ou4+mLd XdFKjTTOtV4dTTHjw/BgY4XMaTgyz0ItEzrFbGR7RXf6amP25di/rCPpzJ7HfFCdPvNY 2KJr/Cg/aE5SUYH1GXGkolUDKOHWhQlIiz0fuYc5tUjtZ4Nq+Hpgx+RC1j5+HWPaE7IA ubo/mOwbTwbEzH1dUHRavroQoZM0xXmk+CzhM/JYa9tDhFKhiK7ta2/8MQXlmtM9vKJy NI1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=13+6ngLt; 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 x128si2296336pfb.128.2018.11.29.06.17.31; Thu, 29 Nov 2018 06:17:46 -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=13+6ngLt; 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 S1729886AbeK3BVk (ORCPT + 99 others); Thu, 29 Nov 2018 20:21:40 -0500 Received: from mail.kernel.org ([198.145.29.99]:43054 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729873AbeK3BVj (ORCPT ); Thu, 29 Nov 2018 20:21:39 -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 DEE14205C9; Thu, 29 Nov 2018 14:16:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543500969; bh=ePe6se3aIngbGt4c5ZisjZ88TrdZx3R/G+go6mq/juU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=13+6ngLtzEMozHn4nHSy/lX6hhgPe9f4mCDfCteUFJBhT8vBRj6WgBwQUxGd7tdbV 5FNlOw1DoA8QOR9GHbMFDi5KFuu9l+NXtSw6TlTszN2pJdeWRtrT7RO6HYMNGoquJe 75IpIS7ks9MWFYRpFp+UAoKcUWis4GYwsCGEsU94= 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 3.18 37/83] Input: xpad - update Xbox One Force Feedback Support Date: Thu, 29 Nov 2018 15:11:55 +0100 Message-Id: <20181129140139.950307616@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181129140138.002176596@linuxfoundation.org> References: <20181129140138.002176596@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 3.18-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 f2af62d18746..68197239e327 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