From patchwork Mon Feb 12 17:39:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 13553824 Received: from mail-vk1-f175.google.com (mail-vk1-f175.google.com [209.85.221.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 585B53E49E for ; Mon, 12 Feb 2024 17:39:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707759555; cv=none; b=ONbmqY7qb52i9n+Xjb9T6oc0StesWrlZYVrxDkTsB7LmWkQPmISnqu0PLgpzoFMru2gGy/knQqcnhSZaaS4iu9KBh8yW7uLMu2XZDTQ7Xm8kizHL1N09vdo5csMFLmSp/XCJ13Mq1573Qx134DNB11XIPpZZTCnj9QlcWF50YPU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707759555; c=relaxed/simple; bh=RoATdOmJbDk9lrGtQq/f7oUJyMn08wYFoa+EP3m5fKc=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=t+cxqMNWWOCRKz6pbYH/K6rvCcJj5rqV25xpjQejSpJ+TG3uqmdV9Y8iakM4OaO/UnWdroVQmDYZq3JvjwxAnt9sYcqj8Wle28Z4iJsPfCuqjdcTLqKJ4QnwtUG9OccuZGbB9OskjVZsF82dEjfPl3YgANdmnROOrBdHYfLXBFE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=kt1jxjGb; arc=none smtp.client-ip=209.85.221.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kt1jxjGb" Received: by mail-vk1-f175.google.com with SMTP id 71dfb90a1353d-4c0215837e2so551499e0c.1 for ; Mon, 12 Feb 2024 09:39:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707759552; x=1708364352; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=c2q7tQ1TG4hNxpIKUh7oxpZsvECnxvXqaKYzpr2ZN7o=; b=kt1jxjGbV9BZfnks5Hj/n57tdcRW0mIc6reieLaE5/Ez7/PvBoAD0T/DT2grJBUHzl 6x5RQox4v8uV4nW9P/Pye8fWTBg0cZkMymf7SijOZyVeqzSq6JvxjEvbwvG2FDdaYpK2 NuURkOy36yTXL8LfexdQwKUsUt6XKoOyDLO9zTucEo+I7iB/0hgcFlW+5v85/rrfUyeb sHxQEc0uQYiv2gv11Wc0XOAn+qjHhSe2gpqmyKClMBVggwWcIiuw4FBxnTGh0DJatBMM MKoRw8YC0t64sA9ctrYcIY8HDE2inAa7ySN+2TW0pZH/BM2EQRI8e5v8IghqfPxOvppa RKdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707759552; x=1708364352; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=c2q7tQ1TG4hNxpIKUh7oxpZsvECnxvXqaKYzpr2ZN7o=; b=Hb9WpsDiV+hMuHiwzms7B6sq00/v8Af10m4TqIh6bmQkevQF3/SbM7BsS7UJGhvBst sIHu1b4Z1Q3csTFyAztE90I2s4/MQ9cwIVpcwYM7EIvwKOUfDv0oIDjCIEjWBjrVEyri UwZGeW9oJO+UjJve5ssvdAatCDR8UqTIPY+4ywos+py+hNeMkYpusTNJ+AvDipe6Ju5a znxcYYO3nK6egHJr0FUbgnwzglOb59tUpE+43sV1BkG4NcqAqaqnf0l73Xiy6jZE+z0j rOB4rQ4F5E0qvaMf1sopta1yUGGOCyHGjNd9sKeb6xgzz+xSDTbw2jReiBDQBzNk//TK D8AQ== X-Gm-Message-State: AOJu0YyN5iXpvoCqGO37ezgViicqcctOSFYig4N3VHCpnXBiZQaZsoXa 8hwKfGxxdA9SbSd8NPf4UMYieklpV3IG0Mh2K8sBXbqrGTbPwzYfGBuZQnRG X-Google-Smtp-Source: AGHT+IEOlDggjePO1O1TtO9BX8vQK3wg7Jg5ZN4VJvxxkWnXREmbEFx3y+3HYW8OEo7DEtza8eOtqw== X-Received: by 2002:a1f:db81:0:b0:4c0:2747:acce with SMTP id s123-20020a1fdb81000000b004c02747accemr3401948vkg.9.1707759551978; Mon, 12 Feb 2024 09:39:11 -0800 (PST) Received: from lvondent-mobl4.. (071-047-239-151.res.spectrum.com. [71.47.239.151]) by smtp.gmail.com with ESMTPSA id eu6-20020a0561221c8600b004b75720e155sm767686vkb.12.2024.02.12.09.39.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 09:39:11 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ v3 1/3] hog-lib: Don't destroy UHID device on detach Date: Mon, 12 Feb 2024 12:39:08 -0500 Message-ID: <20240212173910.4061556-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Luiz Augusto von Dentz This makes bt_hog_detach not to destroy UHID device which means the device node don't need to be recreated in case of reconnections which speeds up the process. Fixes: https://github.com/bluez/bluez/issues/737 --- profiles/input/hog-lib.c | 48 ++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/profiles/input/hog-lib.c b/profiles/input/hog-lib.c index 7ff1ede3db35..67492a63eca3 100644 --- a/profiles/input/hog-lib.c +++ b/profiles/input/hog-lib.c @@ -1309,11 +1309,35 @@ static bool cancel_gatt_req(const void *data, const void *user_data) return g_attrib_cancel(hog->attrib, req->id); } +static void uhid_destroy(struct bt_hog *hog) +{ + int err; + struct uhid_event ev; + + if (!hog->uhid_created) + return; + + bt_uhid_unregister_all(hog->uhid); + + memset(&ev, 0, sizeof(ev)); + ev.type = UHID_DESTROY; + + err = bt_uhid_send(hog->uhid, &ev); + + if (err < 0) { + error("bt_uhid_send: %s", strerror(-err)); + return; + } + + hog->uhid_created = false; +} + static void hog_free(void *data) { struct bt_hog *hog = data; bt_hog_detach(hog); + uhid_destroy(hog); queue_destroy(hog->input, free); queue_destroy(hog->bas, (void *) bt_bas_unref); @@ -1823,29 +1847,6 @@ bool bt_hog_attach(struct bt_hog *hog, void *gatt) return true; } -static void uhid_destroy(struct bt_hog *hog) -{ - int err; - struct uhid_event ev; - - if (!hog->uhid_created) - return; - - bt_uhid_unregister_all(hog->uhid); - - memset(&ev, 0, sizeof(ev)); - ev.type = UHID_DESTROY; - - err = bt_uhid_send(hog->uhid, &ev); - - if (err < 0) { - error("bt_uhid_send: %s", strerror(-err)); - return; - } - - hog->uhid_created = false; -} - void bt_hog_detach(struct bt_hog *hog) { GSList *l; @@ -1879,7 +1880,6 @@ void bt_hog_detach(struct bt_hog *hog) queue_remove_all(hog->gatt_op, cancel_gatt_req, hog, destroy_gatt_req); g_attrib_unref(hog->attrib); hog->attrib = NULL; - uhid_destroy(hog); } int bt_hog_set_control_point(struct bt_hog *hog, bool suspend) From patchwork Mon Feb 12 17:39:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 13553825 Received: from mail-vk1-f172.google.com (mail-vk1-f172.google.com [209.85.221.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CDC793E49E for ; Mon, 12 Feb 2024 17:39:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707759558; cv=none; b=o3C7YjCpr9Frq4TjFQIV1n7pwhmHZtEFukF4q6nQhdk3ErAXLlwSEfiai5W95hYt9Z2bH5m+4WX7Yn6FjUTxUJ7xRQ8g4II9T5OSmuQ8mQrtT682PlJ57Ek3TF3tWLHPatEt8kjQI1/aeMoWKmjlcdSGDfjwMrQiDZCwpLwwluI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707759558; c=relaxed/simple; bh=tlcdzbs0oR5C626fh8DYyDQnu2AI7UqREAWt2ZI0cDU=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NQiHNF68Z9eCodlABYPndynbkYquY/flfvHSOIcIGFuNJU3l8X+FJc5TEM4DGq0id2nWf6O6y5maHBIwwYjeK66M56CMpETIBkjR4aQjk8feNSY7wlGPEkj4ps2cXfyVFp08pzBKfD5pYiX/chnrG5v/hlLfKNiQ2yowkmA0//A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Qg8tGcXC; arc=none smtp.client-ip=209.85.221.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Qg8tGcXC" Received: by mail-vk1-f172.google.com with SMTP id 71dfb90a1353d-4c02dfa01a8so574176e0c.1 for ; Mon, 12 Feb 2024 09:39:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707759554; x=1708364354; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=yh63fJ8pNe/oEDQPYXk6yQ116ueCGKRbDhPhdpyok80=; b=Qg8tGcXChBE3o0Y3p3BxeR+KD5/JhUWIycbljFIjQfjkoX5KpbH1BkBR1jT3hsptfW 4LwPb3xSb9sIo3FNkBnb6v6usWi3FDAqG3EXrMvTXysYWAM8UBpE+UWjoyioEWHi4Tc2 4xWauDpeeTRJ/pbqO7osq5MhHr+KF1DiKGXIaChb0rYNk1Ffu1MCjadkU39xHYnm+xP8 GvIZIELODk5Mv8YQUnDeuOC14saWOBuUP0ZYXPaz8Zeg68LK2dKl+GCgbfARfaoMKPoD D9k94ERDnrh99Y36bCUcFEKI/WiZTGifAQFVqTVOS9imR+AeprBR0PfanwgJwkSiPaBk /Fgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707759554; x=1708364354; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yh63fJ8pNe/oEDQPYXk6yQ116ueCGKRbDhPhdpyok80=; b=KOf62KWx9sY1ZxeVMETpmZ9CuvG0Y1G9ea+NoWsIdR1qFjvJERJsQXVAgMNFf1Hf71 g6mcwZkVO4nLLNfiE3jUPkCFsNy1ybc6GfVjxcsJm0+UIFnt1bHZsUscPJTxaK/+R4Lo 5LmDwXcjKoUs2TzBNgV2dALCIanC6f4Fm9g/G+gxY5Udw4Bz6H8xV3MI4rBqfVUOgojQ hLfoJudTtiP6/a0fTyqNmySXCJcjANHa12BEgfz5eMFDfXSjGwCC1pJg+NYmAyza/yX6 y3oPkgGglhbZa5DImCHLSP0pMxViOINVAsQXEPYgxi2kZEuExuKEY45PaYhQnDvjux4D Vp5w== X-Gm-Message-State: AOJu0Yxdt0/ZLEm7QM2NQOOj7cJq5fjSo/FcbwDLtxvdxFvORTH/kwb4 PFOWMQoZrNHfQFxGWSqP29vVmQ4UZxlBUg3lrMrr3uLC+nQcWN0BAzPlmixm X-Google-Smtp-Source: AGHT+IEKrN5TKwLge5qNxzJ33a+ETzpPVn8Sv/8Hfi8k7NJS4hUxC9eX0twrCyiseVJG2MCPggE3Mw== X-Received: by 2002:a1f:dac2:0:b0:4c0:37a4:dbbd with SMTP id r185-20020a1fdac2000000b004c037a4dbbdmr3183885vkg.13.1707759554396; Mon, 12 Feb 2024 09:39:14 -0800 (PST) Received: from lvondent-mobl4.. (071-047-239-151.res.spectrum.com. [71.47.239.151]) by smtp.gmail.com with ESMTPSA id eu6-20020a0561221c8600b004b75720e155sm767686vkb.12.2024.02.12.09.39.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 09:39:12 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ v3 2/3] input.conf: Make UserspaceHID defaults to true Date: Mon, 12 Feb 2024 12:39:09 -0500 Message-ID: <20240212173910.4061556-2-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240212173910.4061556-1-luiz.dentz@gmail.com> References: <20240212173910.4061556-1-luiz.dentz@gmail.com> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Luiz Augusto von Dentz This makes UserspaceHID defaults to true so the plugin has more control over the input device lifetime. --- profiles/input/device.c | 2 +- profiles/input/input.conf | 2 +- profiles/input/manager.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/profiles/input/device.c b/profiles/input/device.c index 6c64ff1c1c52..ff7e3482d0eb 100644 --- a/profiles/input/device.c +++ b/profiles/input/device.c @@ -81,7 +81,7 @@ struct input_device { }; static int idle_timeout = 0; -static bool uhid_enabled = false; +static bool uhid_enabled = true; static bool classic_bonded_only = true; void input_set_idle_timeout(int timeout) diff --git a/profiles/input/input.conf b/profiles/input/input.conf index d8645f3dd664..00a34eb63de1 100644 --- a/profiles/input/input.conf +++ b/profiles/input/input.conf @@ -9,7 +9,7 @@ #IdleTimeout=30 # Enable HID protocol handling in userspace input profile -# Defaults to false (HIDP handled in HIDP kernel module) +# Defaults to true (Use UHID instead of kernel HIDP) #UserspaceHID=true # Limit HID connections to bonded devices diff --git a/profiles/input/manager.c b/profiles/input/manager.c index 92789a003c89..69ed646727d5 100644 --- a/profiles/input/manager.c +++ b/profiles/input/manager.c @@ -83,7 +83,7 @@ static int input_init(void) config = load_config_file(CONFIGDIR "/input.conf"); if (config) { int idle_timeout; - gboolean uhid_enabled, classic_bonded_only, auto_sec; + gboolean uhid_enabled = TRUE, classic_bonded_only, auto_sec; idle_timeout = g_key_file_get_integer(config, "General", "IdleTimeout", &err); From patchwork Mon Feb 12 17:39:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 13553826 Received: from mail-vk1-f176.google.com (mail-vk1-f176.google.com [209.85.221.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 10C1E3EA78 for ; Mon, 12 Feb 2024 17:39:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707759560; cv=none; b=fbpXLzc3Uq06uSnbpMmiOSe6xysrhmeeV3DyRLtSSE+lkZ1mGwYL5h0lZpPC4BWyd2wMbAQa+SkzMc0ItOv1tGXeJHJacgINMC0koYp1p8fgfH0E0Vd/TDRozdm8x1BxyPTRivc4Gbq/AAuDrWem/7ZCOH8pUzaRZMSHrwPATCs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707759560; c=relaxed/simple; bh=RvyDHGhYb9qRK0GozMLCph6YUdvW3Eq/zyPgZ+7nXgk=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kjeESdyuKEQplIIYe9AwCtIqDOEwlpu2Jv47VCGoyw5ENKBXXAFfI0NfGlTWPQqWp0TlfWBc0N5SCNPskk3PqL+6vKf07bV4j0yMUChTGpthj5+wUl7qh3r+NKP2qBzYfg4ezebsDC1eNdnog5gGjFPxKH4XkpaW3IsDycldiAw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=SR0dUbaH; arc=none smtp.client-ip=209.85.221.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="SR0dUbaH" Received: by mail-vk1-f176.google.com with SMTP id 71dfb90a1353d-4c01ca67504so457380e0c.2 for ; Mon, 12 Feb 2024 09:39:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707759557; x=1708364357; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=+Csi8k2wIa0lbwvBcpJhV1MNaSFF2B9iPCf3jqUMKa8=; b=SR0dUbaHwy3hDtvk/TwrCCI0yYzUt+De/GFKPzuDeiNqimeJnAJMKRWfSb82g0ftsy MQOof9D443BVCCD/1RswMalWcEWQaI841uY4bU831tLWDCE3F2c4GB4g9sv7DHSL6oIJ zSihHzzCcmMs2elSc35+SMTMVGmDIr5s9vd4jpEYpSvDJrOCvLhusAdeQ0MC0cTLzvUW jVHOQ8rYpqZP7b7joxabWiMjq4sZqLrGAlQ6ezjStqlnNDbaZ5sg35wPQVIAZFdBvQCA pqEN40ZSKdKKRSqLIUgomCzOnVpTJHYGnswrn/U+zulsQP6DZJ4ZxfbgHrAZnoIjjK1g NUCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707759557; x=1708364357; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+Csi8k2wIa0lbwvBcpJhV1MNaSFF2B9iPCf3jqUMKa8=; b=GqVa4SEeK9caOb1nOpyO7H7NzI7kLNMIj8SQugmeEhUSBPYxk/aJGmyEhNrF8DAVXS thwpqvzL2bTh1aehvcFr0lsTcbhOKNKQI9BYqDRC8E2VEQFRBLzyu+IGqpste/pD2pf+ 2ImDVMKDNKEFm9YwJn4Ec/blkd/6DklpRObcMKc3Qc95QqGzw4nuIzPjXojB9AI0N/ZO kfzebc0oCBOrkxcahR/ZNeVF8NgjbB5b+L0Ydx5p7KnGu4Lwd+PbDDEqbnGskBkj6SIG MhKopVQR7PejhotCzPUyZDqybWBBgyvtDESXqISL0XGzkPj3iRQwsnobpHa5lMKGF2z1 JpuQ== X-Gm-Message-State: AOJu0Yx+GbYCbVQbadta1RQxNorqyplHacjdv+bDqLIEZkCXmeUSN91C zGsSpV8+sD7rP14CM2D6xl6156gB6kwMa2bkWa6VPl8ek7GKCMwUNlRD0PKg X-Google-Smtp-Source: AGHT+IEThrkCiWVjrHvvW8DGwJ1e3aDRbBTz8Vx2iC0DdQE7DhzZjXod4+5eb9mlyEVOZmGexwRd7w== X-Received: by 2002:a1f:4d43:0:b0:4b6:d63c:ca8f with SMTP id a64-20020a1f4d43000000b004b6d63cca8fmr2483939vkb.16.1707759556735; Mon, 12 Feb 2024 09:39:16 -0800 (PST) Received: from lvondent-mobl4.. (071-047-239-151.res.spectrum.com. [71.47.239.151]) by smtp.gmail.com with ESMTPSA id eu6-20020a0561221c8600b004b75720e155sm767686vkb.12.2024.02.12.09.39.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 09:39:14 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ v3 3/3] input/device: Don't destroy UHID device on disconnect Date: Mon, 12 Feb 2024 12:39:10 -0500 Message-ID: <20240212173910.4061556-3-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240212173910.4061556-1-luiz.dentz@gmail.com> References: <20240212173910.4061556-1-luiz.dentz@gmail.com> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Luiz Augusto von Dentz This makes classic HID behave like HoG which keeps the UHID device around while disconnected so it doesn't have to be recreated on every reconnection. --- profiles/input/device.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/profiles/input/device.c b/profiles/input/device.c index ff7e3482d0eb..08bdb30f1f3e 100644 --- a/profiles/input/device.c +++ b/profiles/input/device.c @@ -985,6 +985,10 @@ static int uhid_disconnect(struct input_device *idev) if (!idev->uhid_created) return 0; + /* Only destroy the node if virtual cable unplug flag has been set */ + if (idev->virtual_cable_unplug) + return 0; + bt_uhid_unregister_all(idev->uhid); memset(&ev, 0, sizeof(ev));