Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1745579ybh; Tue, 14 Jul 2020 06:20:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx23pEAffr3Js4I3v+6Ey1B66iqRbAA5gwr/kI85n51qQLdYSIpyt73PiEzblMI7xdOjei1 X-Received: by 2002:a17:906:328d:: with SMTP id 13mr4481658ejw.71.1594732853148; Tue, 14 Jul 2020 06:20:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594732853; cv=none; d=google.com; s=arc-20160816; b=dXcDeXZZX5tSMYUX5VvfwTMOD9u7ucOXj+WxiD+dUPMhcyVBxgcBRoXb/WO5PA4/EG rKALdUyExf+UbmuuhwPO3Rw3l4HohoW6D/K0aYGod6fgCJAYN57jAUSgzL7G1u6yVDc8 08hnNzKnys0055T9xmYlG7a2xSedDK/2GmMeJ2SUUwa+02uCXwgtWzlIJJhu45ux0t5Q fwGe3Vlcheem6fQYe6qLlOkhjVO/YWWIu18G9Vg7WjC+NLEb+Pnt0U3dTJacAvZem0YH YLd89ETkvnHsV4hL/kjMnTWN+c7dhSq5WGmEDJ76qJN38jkeKAVlvfA4I5uHtiJ43CU9 3kqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature; bh=atV/pZ7JkkoCHCqCH7YrLmed7HvXWTGJvT/haeToYcc=; b=RE8hfQze/mFeozZjttiqUH4e/x0ehQisDMYxk/Wp+3tizbmxKUktrWGsCAzqL2uQkN GXP0s6PHeTVmpHt2HhPx77iomuJD4InAOj5Kn8Xc2GqpVO6LKvoLABkiggoIH1QrouYx 2WlwaGxAMBTI1AQWndh/sDoZKanhtcUmNX1DKsZ/g1+2sKK+nDIWZpNkBmuT99PdXGgt 17gku9zF0D0OLKYP3O0nrLvVJ2tbMftyEPsCoptb6rDkZXofn9mgmi975uGuUyC3cFaT vczPaXrwtotUP9pRWfEZ1z6cC7ps++j6Q4WOb2da8saEeOsUhtO80koyZRiH7tKLnNE4 8L6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=a6xFUfrZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qp26si6611974ejb.118.2020.07.14.06.20.28; Tue, 14 Jul 2020 06:20:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=a6xFUfrZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728350AbgGNNRo (ORCPT + 99 others); Tue, 14 Jul 2020 09:17:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:42506 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727858AbgGNNRn (ORCPT ); Tue, 14 Jul 2020 09:17:43 -0400 Received: from pobox.suse.cz (nat1.prg.suse.com [195.250.132.148]) (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 9F95E22203; Tue, 14 Jul 2020 13:17:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594732663; bh=AYUTme/0NKI8o/8pYHxaWMD/z47b+ayOmouJUcj+GVI=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=a6xFUfrZ71TQzOZrLO+XjCUFwb34IzEV7AAwHajseJzUS5RTxVPxWp9Ep0iBHppqd CmkW3M2hub/Wpy+nV8GVKLfCBNIARoQietzr++A+tZ7rIbOrhhrgV+jyTQrLrcB1fx qUIq36ao8TJfHdKOeW2C24vW4gktsJRCuJ5FEYl4= Date: Tue, 14 Jul 2020 15:17:39 +0200 (CEST) From: Jiri Kosina To: Darren Hart cc: Grant Likely , LKML , linux-input@vger.kernel.org, Grant Likely , Darren Hart , Benjamin Tissoires , stable@vger.kernel.org Subject: Re: [PATCH] hid-input: Fix devices that return multiple bytes in battery report In-Reply-To: Message-ID: References: <20200710151939.4894-1-grant.likely@arm.com> User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 10 Jul 2020, Darren Hart wrote: > > Some devices, particularly the 3DConnexion Spacemouse wireless 3D > > controllers, return more than just the battery capacity in the battery > > report. The Spacemouse devices return an additional byte with a device > > specific field. However, hidinput_query_battery_capacity() only > > requests a 2 byte transfer. > > > > When a spacemouse is connected via USB (direct wire, no wireless dongle) > > and it returns a 3 byte report instead of the assumed 2 byte battery > > report the larger transfer confuses and frightens the USB subsystem > > which chooses to ignore the transfer. Then after 2 seconds assume the > > device has stopped responding and reset it. This can be reproduced > > easily by using a wired connection with a wireless spacemouse. The > > Spacemouse will enter a loop of resetting every 2 seconds which can be > > observed in dmesg. > > > > This patch solves the problem by increasing the transfer request to 4 > > bytes instead of 2. The fix isn't particularly elegant, but it is simple > > and safe to backport to stable kernels. A further patch will follow to > > more elegantly handle battery reports that contain additional data. > > > > Applied and tested on 5.8.0-rc4+ (aa0c9086b40c) with a 3Dconnexion > SpaceMouse Wireless (tested connected via USB). Observed the same > behavior Grant reports before the patch. After the patch, the device stays > connected successfully. > > Tested-by: Darren Hart Applied, thanks. -- Jiri Kosina SUSE Labs