Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp217503lqp; Wed, 22 May 2024 02:24:30 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUdKcXjsRHryKsD6mMGXh7j9Gd2ZnM9ZrVqXoILtxRJTi0759abtxW+7K4P1mb3Mv7QTOPZC1BXshoJc0eaPkfmkaV5jsd6+aJ2LjkAzA== X-Google-Smtp-Source: AGHT+IHuR6GIGuGDFgKZ3Bxn/iko1qK6gElNk6KUEiP6mTWa4mAunzSpFyd8MIevkqrJmMo9CCs1 X-Received: by 2002:a17:902:cf05:b0:1f3:2d51:17a with SMTP id d9443c01a7336-1f32d5104c7mr4015245ad.18.1716369870368; Wed, 22 May 2024 02:24:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716369870; cv=pass; d=google.com; s=arc-20160816; b=b/ackOeeKooJlRvYazCZInYiUv5k6b8BgC1WReLl9IilcenJd5l1ETN4JYW4rmJ9pc b3GwcCbiY3yYOeD6tfkQaXjclTZbmRuWUMk9pAhm/4Vr0ZFpHgAaoFJmMvvSR+iLbmND IEFbO6mE4iqnMHfr1eV1g6cuxa05Pq8Is1sXsjoqFQzp2JvpPQBLlWK4Nkcaj+l8BikR URlTiR0wFOk/o1/ILF2x3ULFvZ7ZrySKbCuOtcUxCftKbh0f7DlexqQ2QCZlkzRjxEQA KUHzYr10LHefcaFZZ7D+1re4/HaKUBl3kVuAgJZpztt0ug/0pTkNxRhzg2cw0c+c1p4C fYhA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:message-id:date :subject:cc:to:from:dkim-signature; bh=RwMGp8RoTylMfwZCt8jxh3g8ipDYLlZV8k6iQyzxZPQ=; fh=QWoUV1vMsbdvK97EaNDv9qAdcRDJPIdEjconmyQNhU0=; b=Hz03lYzLLPoz7EgPzuuazFI36KZBhUw+FSnJjowDy3zWnqRQ3yMYy9jYS8up+0BEqA w3r8KHwgfbQfHZeRGT/YgikCWPHEnyccsgWpZ6CnULxa3XGlGbL5JvF3ulErEhcl53c1 vFA4m+4Uf/ha52PBejqstBpFFqoVubt2Eu6Ef1qAtEXf2/HECbk4YbT3Xm6bGO/pgyXs YYCwt2ReJ0n8QHY3vLUrnabj3DFXkwIY2tgga7b/OThQE+39jclt8g5kigq7Bsl7rHDM SJIm3pElRFVlCEHv/xWXZKatoQjbEDGF2Fdn336L6J7tZQt0SxhtZjALcBfv6jAnDDeI phTQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=WQ+Fxc3H; arc=pass (i=1 spf=pass spfdomain=163.com dkim=pass dkdomain=163.com dmarc=pass fromdomain=163.com); spf=pass (google.com: domain of linux-kernel+bounces-185986-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-185986-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d9443c01a7336-1f3143aabd0si18037285ad.565.2024.05.22.02.24.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 02:24:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-185986-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=WQ+Fxc3H; arc=pass (i=1 spf=pass spfdomain=163.com dkim=pass dkdomain=163.com dmarc=pass fromdomain=163.com); spf=pass (google.com: domain of linux-kernel+bounces-185986-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-185986-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 00A7B281FB3 for ; Wed, 22 May 2024 09:24:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3275D811FB; Wed, 22 May 2024 09:24:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b="WQ+Fxc3H" Received: from m16.mail.163.com (m16.mail.163.com [117.135.210.2]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DAE2280C03; Wed, 22 May 2024 09:24:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=117.135.210.2 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716369857; cv=none; b=uGSW3OIY4mDdDK+5usfXQbtfPuOQCAFnRZhS3qCYr0vgQ/upRUV9/AtebnnOBQ3FLwHlBBYg8cG6rUxRZYHcPh2tJ0+yGDpLgh17zTmZMwI7ruCnBsqGN/ImeynnFii4E4QjneggZnBNMt9N7n2IFcgylOnjCasaelwysZ/jomY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716369857; c=relaxed/simple; bh=kzzkB8V8z296o4CBEK4CUuCnDBnubxduo8Qf8Pgb+Q8=; h=From:To:Cc:Subject:Date:Message-Id; b=BLX0OiXpW2D+OaJ8yzHYTnbsolwIB/WvYezfrAM7j9jcbHn1r2zbrX9r0ZEE4maEB5to+sARsv83m/S5MLozbwtRuOvDft22H5ArdewI5K3tjJdYuB8wo8WyHfAwqeZjj/8MxqoBeBSQMBT/Zjy2hTjpkJgMrdhodMQEoRCDG/g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com; spf=pass smtp.mailfrom=163.com; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b=WQ+Fxc3H; arc=none smtp.client-ip=117.135.210.2 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=RwMGp8RoTylMfwZCt8 jxh3g8ipDYLlZV8k6iQyzxZPQ=; b=WQ+Fxc3H1Ad3e8rRfmPDVsHGLx0R6GHpYj 4RPfzhP2IWZ/a0ki6td49eK8ib8mvtHxoq/ZHDctZBoKRm9MNhCdXdaTFVYdUyiM Wgt34mwhIQP5kjO+mFxxjFgzFoZbWWDMTWtmnpYhQTKAE1ZJ4sYJmRSA5Kiq+fad aslXbzh7U= Received: from localhost.localdomain (unknown [111.48.58.10]) by gzga-smtp-mta-g2-3 (Coremail) with SMTP id _____wD3f0VzuU1mWW3nAw--.29954S2; Wed, 22 May 2024 17:23:00 +0800 (CST) From: huanglei814 To: jikos@kernel.org, bentiss@kernel.org Cc: linux-usb@vger.kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, huanglei Subject: [PATCH] HID: usbhid: enable remote wakeup for mouse Date: Wed, 22 May 2024 17:22:57 +0800 Message-Id: <20240522092257.19373-1-huanglei814@163.com> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID:_____wD3f0VzuU1mWW3nAw--.29954S2 X-Coremail-Antispam: 1Uf129KBjvdXoW7Gw1ktw1UAF4fKry7ur4DJwb_yoWktFX_Kw 4UuaykG3WfX3Z7Ka45KrWrtryakw4j9rWxWF1Iyr1fX3y2vws8Wr4DZr1qgw1a939rZa48 Crs8Kr4Fvr1vkjkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IU8VHq7UUUUU== X-CM-SenderInfo: xkxd0wxohlmiqu6rljoofrz/1tbiLBjm9mXAmD8koQAAsj Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: From: huanglei This patch enables remote wakeup by default for USB mouse devices. Mouse can used to be wakeup devices, but the correct place to enable it depends on the device's bus; no single approach will work for all mouse devices. In particular, this covers only USB mouse (and then only those supporting the boot protocol). Signed-off-by: huanglei --- drivers/hid/usbhid/hid-core.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index a90ed2ceae84..7ed3ab36426d 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c @@ -1189,6 +1189,15 @@ static int usbhid_start(struct hid_device *hid) device_set_wakeup_enable(&dev->dev, 1); } + /* enable remote wakeup by default for all mouse + * devices supporting the boot protocol. + */ + if (interface->desc.bInterfaceSubClass == USB_INTERFACE_SUBCLASS_BOOT && + interface->desc.bInterfaceProtocol == + USB_INTERFACE_PROTOCOL_MOUSE) { + device_set_wakeup_enable(&dev->dev, 1); + } + mutex_unlock(&usbhid->mutex); return 0; -- 2.17.1