Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4456370pxf; Tue, 16 Mar 2021 14:05:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8VtDhUeKcj21GSwi3IwNU/UHD2ZO1oSaxI4gPJ+Dh6SNlXkZ/H//PI5FbXaVeTUhdyG9I X-Received: by 2002:a17:906:71c3:: with SMTP id i3mr19777682ejk.391.1615928753615; Tue, 16 Mar 2021 14:05:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615928753; cv=none; d=google.com; s=arc-20160816; b=Wdtj76GGEOlaiLpM0wdvUjFnJYdz4TnMNxcirg6pMBnPdarQ0I0u3Zeu4vJzjtJ5R9 NnSn4bxvHW9nMgWIgT7z2SdorwIwXCJSFS14ee2RaLMRatdXbBFmCQcsIPKj8GwxBATB VZkkw1jXYNuSU37+Jl4d99iYRxz4kUwABAm1HlM3jZoH28cmdNxIvdBg7vhmQPxXK3yX EAGVZ2WF+qbWBHx5+OeC5k+ByYul2wXhAuRzNucMt65VEGnvPWCFLwieBnWfUpWSzSP9 SM7ZLk0XssduMp0pWBwf8+AH4KeaR+CRtXlt51PRuoHNCfZvfWuNITQ0TZ6E1GdPaaeB zjMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:to:from; bh=MTcn44y1zgBFv0lWl7DYrvIgRLQgCtzqFgbLiqAxbZM=; b=d6Z3aRlwa1PC0X6sM+2+3floFPdcg1O7JYwCi7Z1V6qdZAlRwrA+DRB+0IrZkJE8vL BYHTKgLMjZzDf24R4CM91PS5n/60M2TFQ6hPUqhbUxTsJ86i/qgwTogmtFmupAw9Wrtl yxPaakNtDRuoR+5W+yEf2w8VYfu6I4JwqYdZqL3eOtap30Zm4fzEBGxig99BUJoHnftB asDBA7txguAQv65zq7/N8XH8OfRBn78JUMQ9f/VhN76oJUa/db7QTwz/ucN9nezd0YAG bP7acohTAXyDJjQomUTZTu9fqp1UVTb9s+4Qkd0ufvuFU3OOJb5ThBn0ndYP3UT6zYZc lS5g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gs18si15607041ejb.648.2021.03.16.14.04.42; Tue, 16 Mar 2021 14:05:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234178AbhCPRS6 (ORCPT + 99 others); Tue, 16 Mar 2021 13:18:58 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:43562 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236716AbhCPRSo (ORCPT ); Tue, 16 Mar 2021 13:18:44 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: fdanis) with ESMTPSA id A497A1F44DEC From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Danis?= To: linux-bluetooth@vger.kernel.org Subject: [PATCH Bluez v5 0/4] adapter: Fix discovery trigger for 0 second delay Date: Tue, 16 Mar 2021 18:18:32 +0100 Message-Id: <20210316171836.28501-1-frederic.danis@collabora.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org When calling `StartDiscovery` the effective start can take around 10 ms or up to 700 ms. g_timeout_add_seconds() call doesn't ensure the time for the first call of the timer if the delay is less or equal to 1 second. v2: Fix issue found by CI v3: Add a wrapper function for g_timeout_add_seconds and replace calls to it in src/*, profiles/* and plugins/* v4: Fix issue found by CI v5: Fix issue found by CI Frédéric Danis (4): shared/timeout: Add timeout_add_seconds abstraction src: Replace calls to g_timeout_add_seconds by timeout_add_seconds plugins: Replace calls to g_timeout_add_seconds by timeout_add_seconds profiles: Replace calls to g_timeout_add_seconds by timeout_add_seconds plugins/policy.c | 91 ++++++++++++++++++----------------- profiles/audio/a2dp.c | 17 ++++--- profiles/audio/avctp.c | 44 +++++++++-------- profiles/audio/avdtp.c | 61 ++++++++++++----------- profiles/audio/avrcp.c | 13 ++--- profiles/health/hdp.c | 16 +++--- profiles/health/mcap.c | 21 ++++---- profiles/input/device.c | 33 +++++++------ profiles/network/bnep.c | 12 +++-- profiles/sap/server.c | 13 ++--- src/adapter.c | 90 ++++++++++++++++++---------------- src/adv_monitor.c | 14 +++--- src/advertising.c | 28 ++++++----- src/device.c | 60 ++++++++++++----------- src/main.c | 7 +-- src/sdp-client.c | 13 ++--- src/shared/tester.c | 16 +++--- src/shared/timeout-ell.c | 6 +++ src/shared/timeout-glib.c | 27 +++++++++++ src/shared/timeout-mainloop.c | 6 +++ src/shared/timeout.h | 3 ++ 21 files changed, 332 insertions(+), 259 deletions(-) -- 2.18.0