From patchwork Thu Jun 15 18:25:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Greer X-Patchwork-Id: 9789797 X-Patchwork-Delegate: sameo@linux.intel.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1208060325 for ; Thu, 15 Jun 2017 18:25:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0B04D284B0 for ; Thu, 15 Jun 2017 18:25:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F3CBC28620; Thu, 15 Jun 2017 18:25:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9959B284B0 for ; Thu, 15 Jun 2017 18:25:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751677AbdFOSZf (ORCPT ); Thu, 15 Jun 2017 14:25:35 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:33781 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753011AbdFOSZb (ORCPT ); Thu, 15 Jun 2017 14:25:31 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 97B1320A94; Thu, 15 Jun 2017 14:25:19 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute3.internal (MEProxy); Thu, 15 Jun 2017 14:25:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=animalcreek.com; h=cc:date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=6A/ Hmn91jWkHx0xDUjuvlIc2b4qyjjFlI8DR0A5LKqc=; b=lcLS0cHTU8qeWTrOG3C 8w92TBrmjP6SIrdZGQZCZXyoQ4hV+4unZ7QflswVcSnIyPky5qGnBEs2lXGbmn9S ZNFsdIbQYl6UMHFrxTZBBozk6CPnDsbGLv+y867ZviZD6/oRNCZ1YNUkDbcHwaYV tZoBxDrFul1OerPQdrlKTZEI= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=fm1; bh=6A/Hmn91jWkHx0xDUjuvlIc2b4qyjjFlI8DR0A5LK qc=; b=R/19u+w4FlOAFxW1ytxn05Z45MAfsQRYFMXnkNwr+YmSm9mcmR9D8BWvo +A5XxP99QEpVKhrtguZQA3pHtFcXh+kXiD85ZOklLSHSSrx80WjUebAPNkcYJhqH gqC7mWpEHeBOe3rSLXRNcr18N+7SaluXKYTO8tVvAj1wZyS+HnIDEl1T2jw9V+yL En23Mi4Y2bi3v0l3sg9GzeLLtF4sb6wxkrqINCQDoMAkc2dtb7POJTu6cm2cevLC HvgQCmzdB5NMnoimm74lsatw61AbDwV3ES6US7OBTZdNJODZJ4JLHeXYMYRZb3vu 0ZD7W6FPnWVJTq9kRMJhHIfkoJmAA== X-ME-Sender: X-Sasl-enc: GJkQ00HodwMHid001kMCVXTrjBHToFb0Ue7zboi8IvZT 1497551119 Received: from blue.animalcreek.com (ip68-2-81-12.ph.ph.cox.net [68.2.81.12]) by mail.messagingengine.com (Postfix) with ESMTPA id 0D0E57E98F; Thu, 15 Jun 2017 14:25:19 -0400 (EDT) Received: from blue.animalcreek.com (localhost [127.0.0.1]) by blue.animalcreek.com (Postfix) with ESMTP id DD3B6A20575; Thu, 15 Jun 2017 11:25:17 -0700 (MST) From: Mark Greer To: Samuel Ortiz Cc: linux-wireless@vger.kernel.org, linux-nfc@lists.01.org, Mark Greer Subject: [PATCH 11/23] adapter: Do not poll when there is an active tag Date: Thu, 15 Jun 2017 11:25:04 -0700 Message-Id: <20170615182516.4508-12-mgreer@animalcreek.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170615182516.4508-1-mgreer@animalcreek.com> References: <20170615182516.4508-1-mgreer@animalcreek.com> Organization: Animal Creek Technologies, Inc. Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When there is an active tag and a request to start polling is received by neard, it will discard the currently registered tag and requests that the kernel start another poll. The kernel receives this request and returns EBUSY because there is already an active tag. neard receives this failure and reports it to the poll requestor. At this point, the tag is active but neard no longer has any knowledge of it. Fix this by returning EBUSY when there is an active tag and a new poll request is received. Signed-off-by: Mark Greer --- src/adapter.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/adapter.c b/src/adapter.c index eb1a407..9e3e75e 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -358,6 +358,9 @@ static DBusMessage *start_poll_loop(DBusConnection *conn, return __near_error_failed(msg, ENODEV); } + if (g_hash_table_size(adapter->tags) > 0) + return __near_error_failed(msg, EBUSY); + dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &dbus_mode, DBUS_TYPE_INVALID);