Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp669117ybg; Wed, 10 Jun 2020 10:27:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyV2vx7xSrja/a2jZz5/pl3qxNmRBKBnmJOT3oxtFQ+XRHLCzydOGn/7dSuvz7riAcpH3Yd X-Received: by 2002:aa7:c541:: with SMTP id s1mr3448591edr.167.1591810057172; Wed, 10 Jun 2020 10:27:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591810057; cv=none; d=google.com; s=arc-20160816; b=iaLdHeNhpH4g2H0HiH4xaPx7QBssYjA3IE/oer29k/HnKeqz3mMK/+Hzn51GueRsd4 bBKP51sz5gjBGohLu83jklXvGrSDCAhOuLyBTCOIcomW49aJDB+TQEePK/nrJMJQ6FpA AhCm8UfyYw2wy7AnwZe17aeHNT/7+/aTqVvBmxH5++lgaF8254KpyOVuV3aP8TOy7r81 PnKlBA/8IN63tm013JCSB+qaY3GRfNugIH8eNd7GqnTx7o72zRZNr+him5r6t/W+XAfd HiJ4x/j6R3orfLdSF7W2JVUG+xmx/39MScLkr8Zj9dMMKNlTVK0zQzFEkCkjgDkP3DIH TtTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=QlXMUy5UUGFIOXojRPT71MxZfIeUTx5Cvdt/cyo0blU=; b=kV+vjjp8l5XvLnk8zA5maQ2+1pzRCn3Awv5RYmulj3SZ0iumcYc3U/KtY5y25yazM9 +UinOyDlCBdxZ/sbx5hNYKOxCFxi3xhytXXJPF7mIBPUu74aG38unG5DIvQ4o7ldY09R eEC7EE7HbMUWfSYLSXPW2J4CAcMbZFwd145aYFLJvYczrdo/S/puEQfrwHtQDfFTSTcQ HYZITfw3P8a/jbB0VO/t1LJEcDR6YNimCI7Tt+hrBc4rrKE1I6/3NK8YDzmx/R+Qyzjh q5sZflei7sc/0/NUYwiYqv4AKboA8btPx9qVw3/6JsQxexEwFI2tclPIIaNaTsHk61tr Q2aA== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id oy12si377763ejb.654.2020.06.10.10.27.13; Wed, 10 Jun 2020 10:27:37 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729378AbgFJRLZ (ORCPT + 99 others); Wed, 10 Jun 2020 13:11:25 -0400 Received: from mga07.intel.com ([134.134.136.100]:8721 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728251AbgFJRLZ (ORCPT ); Wed, 10 Jun 2020 13:11:25 -0400 IronPort-SDR: MdR85bDVdjDnusPTA9SUCRqu6LSKOFOh/Rxk5HofeLriXM33yu41OPLl7q6kX3OgjElyOA42Mp nTfyrF9tbHnw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jun 2020 10:11:24 -0700 IronPort-SDR: pyiN9RHEw8cvPFu4X6sg2Qc5pBtgKtx+7d48p2MfTemUzs7wHABu4gt9py6CCtZdiDMQwBHgAf LBKOPtcyCsBQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,496,1583222400"; d="scan'208";a="259340084" Received: from unknown (HELO ingas-nuc1.sea.intel.com) ([10.254.72.48]) by fmsmga007.fm.intel.com with ESMTP; 10 Jun 2020 10:11:24 -0700 From: Inga Stotland To: linux-bluetooth@vger.kernel.org Cc: brian.gix@intel.com, Inga Stotland Subject: [PATCH BlueZ v3 2/5] mesh: Make "Busy" and "InProgress" to be distinct errors Date: Wed, 10 Jun 2020 10:11:18 -0700 Message-Id: <20200610171121.46910-3-inga.stotland@intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200610171121.46910-1-inga.stotland@intel.com> References: <20200610171121.46910-1-inga.stotland@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This separates "Busy" and "InProgress" error codes: MESH_ERROR_IN_PROGRESS maps to org.bluez.mesh.Error.InProgress MESH_ERROR_BUSY maps to org.bluez.mesh.Error.Busy Minor API change: UpdateAppKey() returns "InProgress" error instead of "Busy" --- doc/mesh-api.txt | 2 +- mesh/dbus.c | 3 ++- mesh/error.h | 1 + mesh/manager.c | 11 +++++------ 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/doc/mesh-api.txt b/doc/mesh-api.txt index 24cface22..e85f0bf52 100644 --- a/doc/mesh-api.txt +++ b/doc/mesh-api.txt @@ -654,7 +654,7 @@ Methods: org.bluez.mesh.Error.Failed org.bluez.mesh.Error.InvalidArguments org.bluez.mesh.Error.DoesNotExist - org.bluez.mesh.Error.Busy + org.bluez.mesh.Error.InProgress void DeleteAppKey(uint16 app_index) diff --git a/mesh/dbus.c b/mesh/dbus.c index bf0f73bd9..83ae22c9f 100644 --- a/mesh/dbus.c +++ b/mesh/dbus.c @@ -56,7 +56,8 @@ static struct error_entry const error_table[] = { ERROR_INTERFACE ".NotAuthorized", "Permission denied"}, { ERROR_INTERFACE ".NotFound", "Object not found"}, { ERROR_INTERFACE ".InvalidArgs", "Invalid arguments"}, - { ERROR_INTERFACE ".InProgress", "Already in progress"}, + { ERROR_INTERFACE ".InProgress", "Operation already in progress"}, + { ERROR_INTERFACE ".Busy", "Busy"}, { ERROR_INTERFACE ".AlreadyExists", "Already exists"}, { ERROR_INTERFACE ".DoesNotExist", "Does not exist"}, { ERROR_INTERFACE ".Canceled", "Operation canceled"}, diff --git a/mesh/error.h b/mesh/error.h index f3e0f5476..2809915b0 100644 --- a/mesh/error.h +++ b/mesh/error.h @@ -27,6 +27,7 @@ enum mesh_error { MESH_ERROR_NOT_AUTHORIZED, MESH_ERROR_NOT_FOUND, MESH_ERROR_INVALID_ARGS, + MESH_ERROR_IN_PROGRESS, MESH_ERROR_BUSY, MESH_ERROR_ALREADY_EXISTS, MESH_ERROR_DOES_NOT_EXIST, diff --git a/mesh/manager.c b/mesh/manager.c index 2be471088..8ef681366 100644 --- a/mesh/manager.c +++ b/mesh/manager.c @@ -60,7 +60,7 @@ static void scan_cancel(struct l_timeout *timeout, void *user_data) struct mesh_io *io; struct mesh_net *net; - l_debug("scan_cancel"); + l_debug(""); if (scan_timeout) l_timeout_remove(scan_timeout); @@ -249,11 +249,10 @@ static struct l_dbus_message *add_node_call(struct l_dbus *dbus, return dbus_error(msg, MESH_ERROR_INVALID_ARGS, NULL); if (!l_dbus_message_iter_get_fixed_array(&iter_uuid, &uuid, &n) - || n != 16) { - l_debug("n = %u", n); + || n != 16) return dbus_error(msg, MESH_ERROR_INVALID_ARGS, "Bad device UUID"); - } + /* Allow AddNode to cancel Scanning if from the same node */ if (scan_node) { if (scan_node != node) @@ -263,7 +262,6 @@ static struct l_dbus_message *add_node_call(struct l_dbus *dbus, } /* Invoke Prov Initiator */ - add_pending = l_new(struct add_data, 1); memcpy(add_pending->uuid, uuid, 16); add_pending->node = node; @@ -554,7 +552,8 @@ static struct l_dbus_message *update_subnet_call(struct l_dbus *dbus, } /* All other phases mean KR already in progress over-the-air */ - return dbus_error(msg, MESH_ERROR_BUSY, "Key Refresh in progress"); + return dbus_error(msg, MESH_ERROR_IN_PROGRESS, + "Key Refresh in progress"); } static struct l_dbus_message *delete_subnet_call(struct l_dbus *dbus, -- 2.26.2