Received: by 2002:ab2:4a89:0:b0:1f4:a8b6:6e69 with SMTP id w9csp186173lqj; Wed, 10 Apr 2024 07:44:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUwerdGBoAYMh9yXecejsuhm+0UuoNiMrHSE1/4OZFHWuSBvo1/gFKOzN0WBRXh4oxobjXX4uBXYWJfAgLv4fetlUBl4oPiTEwCAkNf1A== X-Google-Smtp-Source: AGHT+IF7YFDWLFDPm7S6RfdoHtxRXxLgarYVXiGaXlebdT2Wo33qxHHwFk1fWUhz2UnvX5JMUFrm X-Received: by 2002:a17:903:248:b0:1e4:51ab:fffb with SMTP id j8-20020a170903024800b001e451abfffbmr3687093plh.25.1712760253541; Wed, 10 Apr 2024 07:44:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712760253; cv=pass; d=google.com; s=arc-20160816; b=DwmFQn1cu9TP36cSvYqK4m9EZkG3BmmrUmV/lwfW5GpEGyAikKn4kcbfdRVx15wMx2 +zhPUrFiMr6C62fCosGEgeTyeAp15SZKM8lVa1d1CCJqk11W/A4aESwMvJNFdeczZcaP CjoneA8TRkqMwoaHjnLZnsz3diksUVbq63UCBAwNoeqeT1hh5kRD4vO5nIiHEZ1HerdW x75pFEgmOURHuSbnIqDXYHclTXmJz+YDbAeVNVb337kX/xYKh0hmEZF+EXWv6GkFs5AF 50zmW+WASRrKWQ2Ukuof3GwSIgZJ9xJ93yktsaSIXqehbvVN8wj3qcGyXTweU8qZ5G/+ h3rg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:to:from:dkim-signature; bh=Wl+SppwAKGBp8KZCd6/T4Y1i/PcNDdL3WeE9JQ5bmM0=; fh=4lGQI6056MBa4/oovMyIYaKLn+Wz/24RGvUivMmQP8E=; b=mTodyq3zofBhtN8mIjHHdy5IGizdrYFXAxj4KiHOlnixmpMjvLoo+mOmNjJXbVJ/sj wavi/wpaGjiTb/O844ypKr+Wty1k4Vetq79BuTrcwURWMHklDFdDdv757ng/ynVQwSBp k1geJnL8RSB57WDm7AxFeCy8aSLhnp/z0MOw82fr6J/0bNnJFDNelouGX/eF24BARnLX zU09nqHsJsMv8yZPJ/6yLDB1zbJDqwn4RuthPY4USJ2P8X0XplDlGW+NJSSpkD5L9Sdf ORl3VziD1cw1057kjILTR7yy2lUamKiqipV0xqco2iKR1Vp8JGZlS4MFT40Xlv16Rr27 CqwA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ZQHbNmpH; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-bluetooth+bounces-3446-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-3446-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id w5-20020a170902e88500b001e244c871cbsi10868276plg.462.2024.04.10.07.44.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 07:44:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-3446-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ZQHbNmpH; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-bluetooth+bounces-3446-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-3446-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 4D880B2877E for ; Wed, 10 Apr 2024 14:08:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 61827179667; Wed, 10 Apr 2024 14:02:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZQHbNmpH" X-Original-To: linux-bluetooth@vger.kernel.org Received: from mail-oi1-f169.google.com (mail-oi1-f169.google.com [209.85.167.169]) (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 50F5217964E for ; Wed, 10 Apr 2024 14:02:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712757734; cv=none; b=oO26qzbExwwNX8qvPVmsKdA0TBCLfG/voODMQwIKLUmRP2Cr9oZnD52pHKBtFArbuA99aVwW6PlQXWcprotyQ2PupGEDSfL8BTHXUUAN5y4VgeQfC3rYzi5AS6mvrxRez4FTJNLUYBDpBl45S1PdSzMG+IdjejIwUxCYhefmImw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712757734; c=relaxed/simple; bh=9aJoy5YWJ+2dlXqHyIFDhuX6VFc2cSpxJgETMwfMlRQ=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=guldXeQtMpc4b+ns70BqJE/FRgpM2ORKoBKu/Re05dIwexAoOLs2GZ9ak3GqFMUT+2J7jy+NGDUZp0tJlxo27yfNb63k20xTi5ucEpLwy4ZFLP7j1ntfkFlQcyVkATHr1BLYc6ovEcTw8lwrXzmNdrh2h4eZYcVCU4Uac/cea2w= 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=ZQHbNmpH; arc=none smtp.client-ip=209.85.167.169 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 Received: by mail-oi1-f169.google.com with SMTP id 5614622812f47-3c397193878so3581234b6e.3 for ; Wed, 10 Apr 2024 07:02:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712757731; x=1713362531; 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=Wl+SppwAKGBp8KZCd6/T4Y1i/PcNDdL3WeE9JQ5bmM0=; b=ZQHbNmpHLnqJvOc9DNlmcCwedfaU969NfwdjdefhR4rJgc8qyFzc1y9Ve2izyTna5u ytPRT+8sGE+Iykiu4uGG8sKpOmL2L1L67b7+n0ge5+6mn1H+mowx3h7vUOto8qnXCg/G QgVXiOFsAcKpBME6mL6eW7B49WlyReJsPhyZuVnY+AIPCmHvzE8twJFtPFbrb552Ii97 krMB8qmEM5B90e1GlkqIDIro0QXjjfU/6FJw3FIk6pEqK2irYP1eK/olviienQyZpfVL nCr9Vu+FIEKOk1UoMrFenQU4hyyFWyVRuLTfRDYDiQ7S+FP1OKjzRLnzAIgE7WRT9FEp wL9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712757731; x=1713362531; 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=Wl+SppwAKGBp8KZCd6/T4Y1i/PcNDdL3WeE9JQ5bmM0=; b=at1UPIjgG/kYxe5T/xSKIFQAjwX778NjZHbY67/nn3aQ0t80VJtKhWGh522H0zLUbo p6jwOdBn3zgeTBrYba/p8Jh+dj1VtxYzRnee86lamiUsUP106wdQzUQfpf7ZsZxu82d8 7ZCic+3xr/vMk54jH4AILfI1ZcSmP4gHWTN8UKqLvBWuUcUt23zoqIShECYV55JvgTfM t3lVpfr8SsGVw8xHlTNW95hakK78VZaTmbXjGqy6v3DWGtCXeI0EwRqBTgIOSLRMBr4T pWAf/4eXBbZjuPZM/nz6TIxf7bIb5PND2zB4Ei+exHPXdcBcZBN7YxYAe2FmLTHOd+eU VC4g== X-Gm-Message-State: AOJu0Yx/TgH44PGIJU73z9HMlhpgUXAkGlqz0fXkLnmj0PNBikXPiMqR 9miYYNQcowf3Mwbsl9eS2CZ597T8djABKs3lqb4zXo0g9JNMpauzY6ufYdRY X-Received: by 2002:a54:451a:0:b0:3c5:fee2:76b9 with SMTP id l26-20020a54451a000000b003c5fee276b9mr2612941oil.57.1712757729504; Wed, 10 Apr 2024 07:02:09 -0700 (PDT) Received: from lvondent-mobl4.. (107-146-107-067.biz.spectrum.com. [107.146.107.67]) by smtp.gmail.com with ESMTPSA id k21-20020ab07555000000b007e3199adc5dsm1382051uaq.0.2024.04.10.07.02.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 07:02:08 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ v3 2/4] hog-lib: Make use of bt_uhid_replay Date: Wed, 10 Apr 2024 10:02:03 -0400 Message-ID: <20240410140205.4056047-2-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240410140205.4056047-1-luiz.dentz@gmail.com> References: <20240410140205.4056047-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 Content-Transfer-Encoding: 8bit From: Luiz Augusto von Dentz This makes use of bt_uhid_replay to replay the GET/SET_REPORT messages recorded during the first time the device is created. --- profiles/input/hog-lib.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/profiles/input/hog-lib.c b/profiles/input/hog-lib.c index 8071e1364b10..0291adb6eb23 100644 --- a/profiles/input/hog-lib.c +++ b/profiles/input/hog-lib.c @@ -856,12 +856,14 @@ static void set_report(struct uhid_event *ev, void *user_data) --size; } + if (hog->attrib == NULL) { + err = -ENOTCONN; + goto fail; + } + DBG("Sending report type %d ID %d to handle 0x%X", report->type, report->id, report->value_handle); - if (hog->attrib == NULL) - return; - hog->setrep_att = gatt_write_char(hog->attrib, report->value_handle, data, size, set_report_cb, @@ -1726,6 +1728,11 @@ bool bt_hog_attach(struct bt_hog *hog, void *gatt) "handle 0x%04x", r->value_handle); } + /* Attempt to replay get/set report messages since the driver might not + * be aware the device has been disconnected in the meantime. + */ + bt_uhid_replay(hog->uhid); + return true; } -- 2.44.0