From patchwork Fri Feb 9 18:52:35 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: 771614 Received: from mail-ua1-f53.google.com (mail-ua1-f53.google.com [209.85.222.53]) (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 C81465465C for ; Fri, 9 Feb 2024 18:52:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707504762; cv=none; b=BWewJzwJXUsXXb1nSNMvPOephZ6/8MxR6tfHRWu9qKbTM/gA11qyXXr5WSy8yctFZ4bYp82jfW63MjyllBaF3N9ArZ6nQwTtyryYA718cgyD4/mvXky726KMQkOqeYtKJesSAzdEc2YF/T/VM/dcQg8jL4NFLunFBERjJmN9Ga0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707504762; c=relaxed/simple; bh=RoATdOmJbDk9lrGtQq/f7oUJyMn08wYFoa+EP3m5fKc=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=NMyxBA2ey0z0sv/vH5RaNxyMV4tO8vRF+0B33rX34NMfaq7GWUyP2Kg9f6EOk0Y3SU/9J1gZxmC875PBDTWNHWC3iuEl3t5NzmnlBAbJeM1CzpxQgAlCqK8sLYmmFY95XNM/C8X45BHH+Nyt3lilNbD1+aAAU2w0sO1EoiinSLM= 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=BtcUlJTQ; arc=none smtp.client-ip=209.85.222.53 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="BtcUlJTQ" Received: by mail-ua1-f53.google.com with SMTP id a1e0cc1a2514c-7d2a67daa25so566695241.0 for ; Fri, 09 Feb 2024 10:52:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707504759; x=1708109559; 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=BtcUlJTQtV/+JroAhefQbUYOkzwWD2BB0p3u8eeJoBSr8IAq9huQ15i9jLHNa+yj91 OTCVBzb3LRixsQjpMS/sRHzVhh+eTv+WyHSjB9B+txlgZ6sgb6aRUZEi1Tjpyc9FdaGD qp8PHB7LkBI7Wm4J+aJpz69nRSe65qQgKLzyhJM9vlAYnjv+7FWbJ2oArQC0XT2CwI5t vffeK+/HYNqCnkW0q4g9kN9rqZ7GNHodSDOAmFz3eyqZwV6D9pd4S9YRt3nIsYdgleps zmnxkhokJ1aiMzC1NXOjjGYyy0B6mmtdEWNnapWJYu3itORDMPcUpLApFPdq2MZ5BAW7 s42g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707504759; x=1708109559; 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=nXr5oqLw/mZ4AFJwFNITRFHJfVlYC+n1k6KDXZuxbD8raDssVFssaXfAuIdtIW/zyV gfpFa7mGI87Axvj2eau4j2f+8kpwNkB41+/QPzBXPlByLGeun9mAzHrdJxLIKWRcdG/e ONxHTwHZlxs6aWfraGSzDBYVJsepecEIUVJLcBNNj6C1NMavhvMicCNRvXw10u5rDBRT 5jEsccnuCKRAjymGf6kB8l/r9vA8GlIaSYNUS39Sumja5LabZbzh2LY9qvNgClrDPTEm NikQYkrlEmW29jb5C5Sdb/d7Pndpq9RyDlVMFaIo5u3FjM66S+CjOQSb4FJubK0Q27F+ Jhgw== X-Gm-Message-State: AOJu0YwoKKxV6t2q8g2LaE48H9eHrGsVPoHbkjb1ZEhcZp4ZQJzKH3eS JUZW6XtNkLKk1vIl0R/m5MCvtfuPm+uOFxEENHoTiz/APU1T/rE9LWNmwukU X-Google-Smtp-Source: AGHT+IFiXSE7Utyg6aNtB/pl1eosFeffdoSR0r1oGy+CwS/yKo+5TolcP1NwUp6YGEtWcgXR+/a1/g== X-Received: by 2002:a67:f811:0:b0:46d:30af:ed32 with SMTP id l17-20020a67f811000000b0046d30afed32mr277029vso.10.1707504758968; Fri, 09 Feb 2024 10:52:38 -0800 (PST) Received: from lvondent-mobl4.. (071-047-239-151.res.spectrum.com. [71.47.239.151]) by smtp.gmail.com with ESMTPSA id p7-20020ab06247000000b007cea1ac338esm116989uao.27.2024.02.09.10.52.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 10:52:38 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ v2 1/3] hog-lib: Don't destroy UHID device on detach Date: Fri, 9 Feb 2024 13:52:35 -0500 Message-ID: <20240209185237.3611995-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 Fri Feb 9 18:52:36 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: 771373 Received: from mail-ua1-f43.google.com (mail-ua1-f43.google.com [209.85.222.43]) (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 A28937E770 for ; Fri, 9 Feb 2024 18:52:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707504764; cv=none; b=Vrl0iXV/l9nKiHTSvrOmwI/6fBeEJW5YQKsTreSNGmtwe8Ci+PGiNdtCryRhjgpefpp6/LwjVqKbCsscI/xw1IoxfeFVdcsTZQ/pq8GmVnmExTlAc2Vhuep9eTmDd8YY0jkHKDSZVGWvwwBA3rXZfFhMExPfiaXSUWCSAf7ji/M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707504764; c=relaxed/simple; bh=beeQn/gyfJ47So4yCSma52+M11bk3Rx1U42gIB+DhDU=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=C9lqF8KPVXFQznlOpwZTgsnxQtURcKSWkYP5pgJhjV8cYZKuXy3UQ1XANGGi6DjPkDxwY+PQUMnI3QY+1SSvQTj4vQZa6AMZjft1OeC4fdI9cCuo5bcjzyERQufG9auF85MqHzwLhwu1JxOZD6Sx8KlxRucKB+wNGQ8BUTiUTV4= 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=nmNQ/495; arc=none smtp.client-ip=209.85.222.43 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="nmNQ/495" Received: by mail-ua1-f43.google.com with SMTP id a1e0cc1a2514c-7cedcea89a0so531588241.1 for ; Fri, 09 Feb 2024 10:52:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707504761; x=1708109561; 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=Qo5zYZ+TMVl73Tg60+3Tg0r7qMMUMusb+RfFhPG0uT8=; b=nmNQ/4955cvgU2FAJ8rhO3+pcmQzn9dIvdIP9fWGvNBiLis3IIciXNh5agp6iLeIBD KTfnAUoflmhis3Y9hQI9gyuRYP5Pj//UX1yxrcF64XvMciE4pBHEhtTefus2u9Cpkho4 Iu0LtMP5zWth2xIFs8MQIT8C/djdqGYSW0nCbCBUfeX1baJV/YkYDWaSUawrMw9B43eA ASi1UElVcIdLFRBQx9Da/BJDMbftWk/lLNcNNw4JEBH8HsVuA6IhUtMme95nRNNypamQ 0eRt+CU2OoL6GgcAdkRp/N8WRdz9TALKMJUgRQqD4Gzvp9M5DAwDnVoOPpM7gtO29/Gy i3gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707504761; x=1708109561; 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=Qo5zYZ+TMVl73Tg60+3Tg0r7qMMUMusb+RfFhPG0uT8=; b=ro149EysII1Ce/4d5WBeIBW6IImziqibn43EPL7u8OD9PxH35Vlj9G2QdAoFBLjiWR HsgAATKIM5D1kKO/oevyLIJidMb+KNWFHyI789yytDZtoAHAFJfiD+wOs3bPTVBKXGm+ SZlkHwZFiQY0h+fGeTpM4ZYd43iAMnQRIOytzQJ+gwRBsRX5c2rVNbXYDX4l37jLLEtl SNt7kmBpxuzy/in7fYXyqd0xh13XlqmXtRRWCAzx3SpsJ0MdzkFc5Pm7gJjcu9bUFB70 nGBTtmsHcCvzwAU6sLEF4bfma4FOa19yZqeP4zM9548slkj/YejjgMdlLOb+L0oVdXHv aw7Q== X-Gm-Message-State: AOJu0YxC7UVwpdkGBAZMXgn50+7MyUv1LVwuPz7GyDcVs+mEh+1khyfe 7WSdyGD1zw23nNW10GYNOpE39wZa8X0rQWl454/jNjALok8JyZeEvZFlpgkw X-Google-Smtp-Source: AGHT+IET7Kcds+046R5B2GYUKEMtMTQMcePCboWKdTYoGppjF4ybIZROG9NgHdXmEhn6FMK5BP93QQ== X-Received: by 2002:a05:6102:2a61:b0:46d:2443:6ea9 with SMTP id hp1-20020a0561022a6100b0046d24436ea9mr329545vsb.7.1707504760794; Fri, 09 Feb 2024 10:52:40 -0800 (PST) Received: from lvondent-mobl4.. (071-047-239-151.res.spectrum.com. [71.47.239.151]) by smtp.gmail.com with ESMTPSA id p7-20020ab06247000000b007cea1ac338esm116989uao.27.2024.02.09.10.52.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 10:52:39 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ v2 2/3] input.conf: Make UserspaceHID defaults to true Date: Fri, 9 Feb 2024 13:52:36 -0500 Message-ID: <20240209185237.3611995-2-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240209185237.3611995-1-luiz.dentz@gmail.com> References: <20240209185237.3611995-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/input.conf | 2 +- profiles/input/manager.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 Fri Feb 9 18:52:37 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: 771613 Received: from mail-vs1-f46.google.com (mail-vs1-f46.google.com [209.85.217.46]) (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 969EF80C16 for ; Fri, 9 Feb 2024 18:52:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707504766; cv=none; b=oNDsOv3+7tvdnwn4Q8lrvFTL++aGjiUjFqYACFA6xcYra2+Ug6hsZYCmqf6wVd+IW1IsU82K3ItpIo4kPX1nQL6ZoIeURk6nVbWYaGj5ieB3Rdq+V6QL5XSntsRbTAbRBbGbMPM+eBC0yhY5cGl65NKQf1bHYcj3ejZrD/0Z828= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707504766; c=relaxed/simple; bh=uzbeowmsqMyqR8KQNlK9MHyvUjfxt90fzjcZvxyqjKs=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=przAk0xMQbts2LoPm308YSK0wAPNryoSCrdVmZ7uSw+qtT9E8WPXf/JcOeB3Jsr47d6LoUCcbjdt1usolRmaW38TyfbhN6v7wQKhbT6SYLg2jr2ZWc+35ORxlvcI5/AMX9F8QXxAPRmgu3eVH2+HfNwJtRamudrFxfVw4qin+AM= 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=OtSNDuZh; arc=none smtp.client-ip=209.85.217.46 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="OtSNDuZh" Received: by mail-vs1-f46.google.com with SMTP id ada2fe7eead31-46d11cbd695so119495137.1 for ; Fri, 09 Feb 2024 10:52:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707504763; x=1708109563; 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=yGMt13bRWEMviYhVwNqdVkz+Vb+Djz4PNPK+Zs4W+CE=; b=OtSNDuZhqi0EOcl3so0C3G/qXcOo5qfUGrWm8D9GRfCKXzb31unciPDrSiga6TI9J0 ZeFw3YN0r9illq7Jm2mFf2tnWn7tLtGaYWx+R7g8vVc7KjMmVejKDQBbGb2L2IZRWnva R58HTiXnSoFkNSh2bik2OYMW+oJiYzK5NgDXKsH2kBOPae/8/OeFjtr3gS0+zgHD7EZg yHKiFbKmp5ZWkbTMWpATQdbaAUztsjDGKtI0/n0XIHBKta1CvLuk70z/hfDsWSBb1U+L COBUItnCQAu//eNbUq3CCLTdhdZyrpKLiPKQKZqmT6Ha5wQ74k+vHqoYm1Rvo6eYcmCp ZI3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707504763; x=1708109563; 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=yGMt13bRWEMviYhVwNqdVkz+Vb+Djz4PNPK+Zs4W+CE=; b=InDFdCEkjxHjcMdFbenFA4+IvbV4+rjr15NOKFw8BxWyx1Ewqf0CimIfVi1YpwONg/ 97D5H86pY6Z1E+vEbCQOU4sG5qFYMRkPuVAJZCr+zRp7NdYiz645T8eGe+sPRwFGZrU2 1wyBRtEPD8/b5Rk/tEVovevXWcw2ZJ+Bzu6NjREGrG9VzedhXVovMa4qFzblMEDDiUGG dJ4nbt/E/GDKj+eBGb3n7LB0eCc22grrqkXaUfjNZ5B+ly95p6d59ybKOIH9MNEps/Vr oeY3KSSYZhgH9Dml3+ITSqcVRdloz4VfpaVRAW/vLZ0AYoOkwwU8GwbkCkqOlXMsvBqJ aKOA== X-Gm-Message-State: AOJu0Yy1Zg7nE+fsvAFLz62HfdmG7NX8Fvx6fSbWVi1ILdAxhMk9eVLW MJ559f6wnUqjbSyXnmpdRJhrwKHwNMLK+FuRzicNVIHNnnMHzBBfe+hYWA1A X-Google-Smtp-Source: AGHT+IGIa8zLnnRyceI86Pp4rE+r2UW3T4l9RLnVpTuFEacqDccuwBIAjF2H/mHg1YNna9nEX3mQkw== X-Received: by 2002:a05:6102:ccc:b0:46d:54f6:736c with SMTP id g12-20020a0561020ccc00b0046d54f6736cmr294737vst.1.1707504762827; Fri, 09 Feb 2024 10:52:42 -0800 (PST) Received: from lvondent-mobl4.. (071-047-239-151.res.spectrum.com. [71.47.239.151]) by smtp.gmail.com with ESMTPSA id p7-20020ab06247000000b007cea1ac338esm116989uao.27.2024.02.09.10.52.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 10:52:41 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ v2 3/3] input/device: Don't destroy UHID device on disconnect Date: Fri, 9 Feb 2024 13:52:37 -0500 Message-ID: <20240209185237.3611995-3-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240209185237.3611995-1-luiz.dentz@gmail.com> References: <20240209185237.3611995-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 6c64ff1c1c52..9aea9e48891e 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));