Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp1677675ybg; Thu, 4 Jun 2020 16:25:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz3tlfvggKOXOhdiva3RSLsTUeC3lZlLtnvFAgpSe+phZlKATNNkd+0kUc2Y74GYWrcyWkg X-Received: by 2002:aa7:d6d0:: with SMTP id x16mr6809666edr.175.1591313144913; Thu, 04 Jun 2020 16:25:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591313144; cv=none; d=google.com; s=arc-20160816; b=X1zkoQAoBPwW4dp1/uy/GD0xJ8ne2zykaVhgEGLw7UMMkNYMWfttzM4JsCOeON5IG+ zq/RRqVjifNANsE0JjOE8wAUzwVB8fo+8+c0LYmsFKzAaI4eREkYogKrxh0Vv91XiAss Gtf0fYDzlSsCndneyyKNnDiTrEC0CgPUAIT6B7RnvJ/gjqrBAnl51ZA8L4nZ2/1H1i4K M2C1ZbILtyzcnwd3DlVR8/HQVolq8oSnDZbzg6lyrCkHFCSRlYsuU2I8I7mTpZRsAQ0A 0QGPMe02u/zr7IdBiWopxVZa3hdfPfrMtOc03ZyBFFSPuYl8TNAdIv9dXwV9x0l9MkD3 1/Wg== 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 :message-id:date:subject:to:from:dkim-signature; bh=AjJYkSqHlqxm9056DK7+9jQYT0wjv+YVZ5QLLE5KAGM=; b=jptiH4/tYcSQgIEeatTIKHnNjbzSiVJZmg5IiHEviHic/aSdUEwDTUAwdVuvu7lNnd SsuvPcGvgzwPWgsodqr2QVO8431moccZoIsV/inzwuz4jFH358CRaFC/58+pbqqhcVJl en1tNL2e1CG+eGjXccj0FMAunZXwC1aYKPGreG+R5LNAWLp0i1gMAtsDFUkfK0RPexxF Qmnz3TmTXKkEJPpFSrzVbWDLeUPHLrOPUf0M/nknXa8I5BWBjcf650NvBUcfiWYiFAG7 Eq0TBesBBy+kccOJJo1FPPieaQXDsbqItqXVBi4xLLj/+KGJy2xzms1OXM9KcYXT0tV2 1CDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VYLa7vCV; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d16si2413498ejp.131.2020.06.04.16.25.17; Thu, 04 Jun 2020 16:25:44 -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; dkim=pass header.i=@kernel.org header.s=default header.b=VYLa7vCV; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725934AbgFDXYo (ORCPT + 99 others); Thu, 4 Jun 2020 19:24:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:59782 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725863AbgFDXYn (ORCPT ); Thu, 4 Jun 2020 19:24:43 -0400 Received: from pali.im (pali.im [31.31.79.79]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3F5B0206A2; Thu, 4 Jun 2020 23:24:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591313083; bh=0tx9kpBc+f0HEiwsJThcotQHTTp9JdJkreVr9mEpIpQ=; h=From:To:Subject:Date:From; b=VYLa7vCVWYPmgg7o/bcJYDULx16j12CnIRVKZgCP4MgKyMflhG/UE5TnWJzc5YHQk 8daf+cDrA7FcpDpncNAEwZOQYbzGIYaFkHaZckFNWtmbuC6kXDrAgBVuEuhpmaG1h8 UplbgvnLdEQCmxJYfo2qb98qDyFcdaFLOKaClpjw= Received: by pali.im (Postfix) id 80E07F88; Fri, 5 Jun 2020 01:24:41 +0200 (CEST) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: linux-bluetooth@vger.kernel.org, Luiz Augusto von Dentz Subject: [PATCH] sap: Improve error messages Date: Fri, 5 Jun 2020 01:24:33 +0200 Message-Id: <20200604232433.4951-1-pali@kernel.org> X-Mailer: git-send-email 2.20.1 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 When bluetoohd daemon is starting, it prints following error messages: bluetoothd[19117]: profiles/sap/server.c:sap_server_register() Sap driver initialization failed. bluetoothd[19117]: sap-server: Operation not permitted (1) Initialization is failing because sap server is enabled only when bluetoothd daemon is started with --experimental option. And "Operation not permitted" is result of returning error code -1. This patch improves error messages. When --experimental option is not used then bluetoothd prints more explaining error message. And in case function sap_init() fails then -EOPNOTSUPP "Operation not supported" is returned instead of -EPERM (-1). --- profiles/sap/server.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/profiles/sap/server.c b/profiles/sap/server.c index 5de682a33..99ff80297 100644 --- a/profiles/sap/server.c +++ b/profiles/sap/server.c @@ -1353,9 +1353,14 @@ int sap_server_register(struct btd_adapter *adapter) GIOChannel *io; struct sap_server *server; + if (!(g_dbus_get_flags() & G_DBUS_FLAG_ENABLE_EXPERIMENTAL)) { + error("Sap driver is disabled without --experimental option"); + return -EOPNOTSUPP; + } + if (sap_init() < 0) { error("Sap driver initialization failed."); - return -1; + return -EOPNOTSUPP; } record = create_sap_record(SAP_SERVER_CHANNEL); -- 2.20.1