From patchwork Mon Feb 12 22:31:44 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: 772461 Received: from mail-vk1-f181.google.com (mail-vk1-f181.google.com [209.85.221.181]) (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 C7D721FD7 for ; Mon, 12 Feb 2024 22:31:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707777112; cv=none; b=kiYQ37EGa5Ukc8ypZCGMQoqpdXm+Tp9fDOA3rLQhnoRc5AADPk7nNIvmnziX8CYoDxAr1Mi0Azhp4P0tQhetq/pVshcGZOIRAIEo805m5/Fh21VE57IERisbG3XegdrrSTktfXBSkwx4mktssgK7AiKg6ygJ99jeHJlEbJoHCyA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707777112; c=relaxed/simple; bh=RoATdOmJbDk9lrGtQq/f7oUJyMn08wYFoa+EP3m5fKc=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=lYBF+PFeUTIl+VYsuUr2jreG9q2jz+zZXqGJ/w8zkwP7fPTgwrejqzlEzkvg4rbAeqJ2UU4MAvdReXozr+IgF44PouMU4O5eKpnu5+LBjQZ48kYF2g6GD2rBtiee+m/ND/0/MZYUCk3aLjxEAbVLnJ216lovqfKbwVu9yZJDOoE= 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=Ksi6cHu1; arc=none smtp.client-ip=209.85.221.181 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="Ksi6cHu1" Received: by mail-vk1-f181.google.com with SMTP id 71dfb90a1353d-4c01ca67504so569141e0c.2 for ; Mon, 12 Feb 2024 14:31:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707777108; x=1708381908; 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=Ksi6cHu16xf/xQhUxp9sEUpnKtdmpWaTSOk/3vtUTM2zrBr30+TyCqRPoGJpIl/YUX F1RrfX5J4VekPE2cvJnCN7Axhf/06YSDwk0i1PQDic5ok9tf14HR2AcEZkFGfzT/6V0J 4j4AS7+ZMBgD558s8TFZmgOf2QEQ1HOBhYAB3eD3AnG8TqiImLiYp1l4dbIqgo7bQ1BR Rk6d0smaVbvpiP/BSvPJjdGyK4htCuFFhQ1TRzMpcfC9+sRXjuFMh4UDZqj4knogs9mQ eeLcMYNOsZfFZOIdBHNVTsvfrG4I8u4ccjXqiBCbri4EN+94Wc4Bvvxmvqj1wuFSPyPX zJwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707777108; x=1708381908; 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=lABr5/DxS/uWQlBRi59HrEjHaEZNHSzCYdGdGctP0hIIUc70Y9b+rDD+l+UuM+mCRd o+6Whupx2s4hKGbax103pElhRgYqhQO2tXFMiDCKd+kB3YwncOev1d33El2Ytd+vt5GH unI9uBMejMMaw92zRH8KYoBb1sItqRxZtj9HsxBtNn9psHM4kC0nWoVNc9GqJtEoBm1Z kBdO9lLAtpIpuQm0bSgaENFkQoOF+LVA44GT/ZaBfSmrntVPZSgMTdej87qCSif0rsFE JyfA7Uzn16gk+zOnbZX8t6pEqvtVVrEJ/s8t/F0QNZY/AjMw8TjAiwXshAA9Tbqbl18x UwqA== X-Gm-Message-State: AOJu0YzOTf6mVdnu3tCSBBjJFLuikS1GPV6xzOqGWNSablm1qNOdTdzn PZmr+9P2K0Z2sy1QggU0g/9RNqyJO+W3tADBQ4+YiZa0UELisk9TF7Fd2JDk X-Google-Smtp-Source: AGHT+IFoJkDo6eiM/FSfKICoUMzxjfVkma9RjZ7JMJY8yGLdpoHABc266vy4ffDEUBzamz3qHSclfw== X-Received: by 2002:a1f:6201:0:b0:4c0:1bb6:33c with SMTP id w1-20020a1f6201000000b004c01bb6033cmr3618398vkb.12.1707777108416; Mon, 12 Feb 2024 14:31:48 -0800 (PST) Received: from lvondent-mobl4.. (071-047-239-151.res.spectrum.com. [71.47.239.151]) by smtp.gmail.com with ESMTPSA id z13-20020ac5c18d000000b004c0460eeea3sm840483vkb.43.2024.02.12.14.31.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 14:31:47 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ v4 1/3] hog-lib: Don't destroy UHID device on detach Date: Mon, 12 Feb 2024 17:31:44 -0500 Message-ID: <20240212223146.4142264-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 22:31:45 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: 772110 Received: from mail-vk1-f179.google.com (mail-vk1-f179.google.com [209.85.221.179]) (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 3ECCA3FB2E for ; Mon, 12 Feb 2024 22:31:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707777114; cv=none; b=X5iEGr6hFXG4vP+SEp887OmJ0lsYlQYsyHAHedP5VoWz3y30Y2CwNld0z0OZ8+5QIn0nHxjkODCsWh9Iucc5+S8CoQm3bgljjunu0d43jYswUyTqKsRtyQNAQ6vmaRKJ4UXwv4k8VlKmgvi44qb270qviG8ActBa9sanQWcmy/A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707777114; c=relaxed/simple; bh=j13zusx1iNy1VSpCf0/7Uh5Vuxv9p4qo5PlC9S9RetM=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eFv2vpt0enWND2TvOCRLVp095Fs9nwCNFWrRZloHGxOwMFezyefOGLJ1lp/k2SreW64Uh9GYVMVp6TqlMuAqwLIMSmfqAmkAMBau/MnVnCLNLi4HuZbra4kRr+P5eojnlpWnpsS4OLqWtTGdWkH0/LjeSFcpCnx7F8yqnmWIBZw= 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=llliLZ2G; arc=none smtp.client-ip=209.85.221.179 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="llliLZ2G" Received: by mail-vk1-f179.google.com with SMTP id 71dfb90a1353d-4c0819bf523so644875e0c.1 for ; Mon, 12 Feb 2024 14:31:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707777111; x=1708381911; 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=4kAGhHA/F4F4m8PaN/GFfvTrWCN3YPm3thn164WVswE=; b=llliLZ2GqkOkMJz/U3aX5rSeK7Ga7Fg3R2F3vYsh2RZrnBrCC/E3XGzHz1qSBSyK+Q S9U5avaHPwyAiqZMnmPbyAmeZlpgvjuG2u/Fp/sFi4rvox4W0zxoq0HhSWfnlSdHk1W2 rTTR3Xa91N8H3w8OyylluFB9gjV+KzCI97MTzGqhbQLVcUt3NTUZV3DpCxR7I04I4YE3 oIuuEtceaem5khVGoz6nE01Q7/XYfFB/wcbBdNE77Xp7D43yhx+aGO8ec8IGrdXOO0Lz IXpEeOe+YldtvkgKqUiPe7BmrwkEpR+rbXgX32SSvJclROhjZEdEiIfuCQdLYoDoVk8e 37Lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707777111; x=1708381911; 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=4kAGhHA/F4F4m8PaN/GFfvTrWCN3YPm3thn164WVswE=; b=mcyvQwsDYM0l/NQIdFlf0OmrMPxQi2ib+Oz4Xih2QxbU1k+MIyb7oAozBw2Psy2wo9 AApS72OwX2h69nzOxJpKHvC6+de2Tx7pDXZd7Bpf4DNu5mqPU1BQFbGXQwHF/BoNYxN0 kUEssdZAqv/QlwLLJInxDYD0kastoUvl1HtOZczUia+QqdOE/75Rh3u74iBWKQaQ2Mgc PgzAlHimjvYMyzF9U4fbASNTGZJalye+aY2k1BxRYc1aLbSbsrflU9/JRTgRyvF1r1UR 0Z9aNYHbckb5xSAc3wqNBqdm153BK7kGzKSsXYFxX1aoJe7JIoT7QiC2ic62DKAsms9v wnqw== X-Gm-Message-State: AOJu0YzU/heo4e+h765px8MO7zOLufu8qw39bNk0tQ76LL4qf3gPqfIW xov4IZn35FMx6btkOagtG9xEFJVHfy4lAQaGEG4F1Eewc89MaZpE3xilPdOg X-Google-Smtp-Source: AGHT+IGyijZh5LhAGLAJr9H+rh0MI4BgZfK1i1FooL68nL6fejHS3zDBKjMpin53ExsJDqXj6AftYg== X-Received: by 2002:a1f:4b41:0:b0:4b9:e8bd:3b2 with SMTP id y62-20020a1f4b41000000b004b9e8bd03b2mr883533vka.2.1707777110935; Mon, 12 Feb 2024 14:31:50 -0800 (PST) Received: from lvondent-mobl4.. (071-047-239-151.res.spectrum.com. [71.47.239.151]) by smtp.gmail.com with ESMTPSA id z13-20020ac5c18d000000b004c0460eeea3sm840483vkb.43.2024.02.12.14.31.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 14:31:48 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ v4 2/3] input.conf: Make UserspaceHID defaults to true Date: Mon, 12 Feb 2024 17:31:45 -0500 Message-ID: <20240212223146.4142264-2-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240212223146.4142264-1-luiz.dentz@gmail.com> References: <20240212223146.4142264-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 +- 2 files changed, 2 insertions(+), 2 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 From patchwork Mon Feb 12 22:31:46 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: 772460 Received: from mail-vk1-f178.google.com (mail-vk1-f178.google.com [209.85.221.178]) (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 7D1264E1C5 for ; Mon, 12 Feb 2024 22:31:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707777117; cv=none; b=e4zJC5cXARj3qrVkhrAluqKASliO4sjKtjB97CdvCaizLG9/Kk6HpY5gOklIdm/hwWp4rGwyL7Acku0WZUFpFZlGn3l6RsLAJYSWHsB1O37K+IzgQTpSU7L6JwFxmQM+YhQ0rTgAjKYdl+GUiACbt8JhRlzHYDQqAtBG2QZWqxM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707777117; c=relaxed/simple; bh=RvyDHGhYb9qRK0GozMLCph6YUdvW3Eq/zyPgZ+7nXgk=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jPjyivZxILLCneUqJqXcJ3mJ576Sc2bVGPNCjnngOjjFcyzKG3ecMd96PQCBPcgJ8UoWssJcB+ubJqCyy+g+ohPPAiLtQcl49CAjg5A5AMMrG51EAB/d5LwP91rygQ5HqiglH1ZmrUmMsiY6aS7p0zsT1kvwoAlv6WuZQh/5fV8= 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=P2d5AxaU; arc=none smtp.client-ip=209.85.221.178 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="P2d5AxaU" Received: by mail-vk1-f178.google.com with SMTP id 71dfb90a1353d-4c022adaa88so556369e0c.0 for ; Mon, 12 Feb 2024 14:31:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707777113; x=1708381913; 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=P2d5AxaUTun+8RD760aP9OKiJButKGyytVj4MEo6U9RwO8JaKY+vRZ1240fTPJrvM7 AOQRYk739XrqO+p2FuwRDByK8wHa+cBLNEwb0d3o4QnzjTOKdfwqmOd/0jlaSdeTVbQg +UIxw39f2QI+XfTXwErM+l6fxDodUITyPgTyqs5wSJSPOQxZE4cnA5NE7QbxsIZJsDOR +mKNgifJDRlwyZuFJ9p/cyVXDVOMNf92u7T6/vxdEvuVoKEW0KoC/31tNAp+PKrU7yfJ Ex3jtN22otm+JZDXY7okHMRYiSgKz9cci6aOK4CaoIxU4vDpl7CRttbZzC00UJkSlXZS lg6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707777113; x=1708381913; 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=GvXu/DX8iDD/FFP95M39mXH8phN6AHm7FoxNLPeX6iSXB74M9fKPVUuCiMlZdASkuS yr1hzgHSqtt1yWbpYxrqHk/ocWh4W1NpkPIqGHps/DY/Qd1a47w/XwHrHTgKWtvNfSla UmjDNqTlji1A/WgH0Uor/1iAy0D5qIMQnoUyvAYPgxT8G56obzwiOEWX05m/8OPQOadr SM9BwHfRLSRgbDg9yyeSVHuGiYIZHId3MmcrsJXMYXL2Ssi2FUPfgCNAqhY5/dOhEJvX Za4ZuwmzHIbHAGcU8aUZM2qjLJGy8OeLFS5DSC4VAJjGAN+8ObhwVOTLNWP6qR93tl/z BMfg== X-Gm-Message-State: AOJu0YyaMxeSiOa3WkLsdFtaM2Xcw/Dv9KK+WL1mdwMA+GEFylw2lxtp sGBBO7WNrEItA9s0SYXT5PeZSJZ0yjMvcG/bhjqiPVZWlTGU3uOhiaQyIRJS X-Google-Smtp-Source: AGHT+IH2V0qVuHLon28jvuIIXYA+ZaEhb8ZShwP7zquYPFd9lxWHDhTiBng7RbUVl9itXkgtZ4mNaQ== X-Received: by 2002:a1f:4d43:0:b0:4b6:d63c:ca8f with SMTP id a64-20020a1f4d43000000b004b6d63cca8fmr3027769vkb.16.1707777113205; Mon, 12 Feb 2024 14:31:53 -0800 (PST) Received: from lvondent-mobl4.. (071-047-239-151.res.spectrum.com. [71.47.239.151]) by smtp.gmail.com with ESMTPSA id z13-20020ac5c18d000000b004c0460eeea3sm840483vkb.43.2024.02.12.14.31.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 14:31:51 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ v4 3/3] input/device: Don't destroy UHID device on disconnect Date: Mon, 12 Feb 2024 17:31:46 -0500 Message-ID: <20240212223146.4142264-3-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240212223146.4142264-1-luiz.dentz@gmail.com> References: <20240212223146.4142264-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));