Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp5400144pxu; Tue, 22 Dec 2020 16:35:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJx1YE/T/HfGgfbjBKIzSYJun1UiMKthj8JXcmLljX+ThLFnM9lhQQ7q7TzOF1hgMdeQNWUG X-Received: by 2002:a50:f307:: with SMTP id p7mr22501247edm.368.1608683708566; Tue, 22 Dec 2020 16:35:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608683708; cv=none; d=google.com; s=arc-20160816; b=Yzr7fAr7escl9wZjEtsud+ay2G5zVkI5PKYpp3o5dFglKa8AnNhpHD47qf6R8nrcxM nXtYqNZS50+dZOkb9GfixGYnBFjtfUk9DvIGLFujEFySmmFqf7nlvMUDVdrRW2h+mdDl lmEZK/efdChZ35nYe6DpF2Nrc3sJVOjNaCuYZXqkPHVhqFhB/JUTlGgLho1XezlQxNc7 d6nOffCZCI6pjU70u+foID33PYN465opbmRDxvXnIV9gU4ewFj6X81paMhft/Ygrzkhs osTaV+bmD75C++C+/BPs/nU2eDeYeUdcwmCUt2oqL15BdDT8ziYuuOmRe1cklt/MA1+V Iz5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:subject:message-id:date:from:mime-version :dkim-signature; bh=AczVIt4rKkWxgHRY6Pli8wC1ntZ5Dqn8zf7cOqXQQQs=; b=LzFCtYSHZB/RiSUzHxi/W9qSwpLYJs3ageQo/fd4QLIRGDDnngpw/BXZeCGks9oePq aTuZ5vIVESq1srRtdyWLW56m8rzCyKzNeLGyInmbdi+4tEZ0LauElcjoz5ANE5F/btqS lEdQczE6Fhc6IplcGOQaxVTRBXIshe1kovHr6pXnzPkF0NYl4S3jTk8t5H8bJsOgB1CV E+otcQ8lptKKAhaCyHXYebdYMEueFOlViAgFtCwZT5VfuoXzpwtxycymbM2ac8Xjpx73 ptH6BCJ3pV5YacKzshNqCzZSE8Upgmlh1UvUH66Oz4r5JC1BDLjVgxE74Kyx1cSZw+4v HOFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=eTXEe+vr; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h12si10866067eje.122.2020.12.22.16.34.45; Tue, 22 Dec 2020 16:35:08 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=eTXEe+vr; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725852AbgLWAdk (ORCPT + 99 others); Tue, 22 Dec 2020 19:33:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725833AbgLWAdj (ORCPT ); Tue, 22 Dec 2020 19:33:39 -0500 Received: from mail-ot1-x336.google.com (mail-ot1-x336.google.com [IPv6:2607:f8b0:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2D0AC0613D3 for ; Tue, 22 Dec 2020 16:32:59 -0800 (PST) Received: by mail-ot1-x336.google.com with SMTP id 11so13586309oty.9 for ; Tue, 22 Dec 2020 16:32:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=AczVIt4rKkWxgHRY6Pli8wC1ntZ5Dqn8zf7cOqXQQQs=; b=eTXEe+vryKI2hg5CdxG9B0j75ov2iTKbHi8dE5/C6QDmG1Vv1r0J9YojpLoIOHquUu DYOjPyTITFiPokNitvAB1AoouAbwkUGjy2Gc+thFuNuhcouR5iBLmS/zE9enYSI38Nta /uaP95h82H706CzNP9KG+bre7u6UjArjbZJjOE9QWMvX6fwldLwXsAoxR8m8/YqGF2JM YKTCSejs5qch2bammUloGrqt50+AvUoXx0+449yMJdYilFD+aVxBrkGNwxE0axIgVcOK mI7ui6WfKf65IVqb7EjcONOawVzjc435OMrcaUg+KIEc4sQnGbxaE3FFyyFP2cAJbbvh s+OA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=AczVIt4rKkWxgHRY6Pli8wC1ntZ5Dqn8zf7cOqXQQQs=; b=ZJo+HPqc6sDT69esP5MPQfTnBIcLgzjdh19LrxN+6UCKl/9ByylmMEVCWWpiMVpP4z 7vwWqkK3mRsL99tkkQC5G5Im6z6iiZs/tDpg1hEhtXOKD+56tOQpcDciDHlTGrI4ckhc uw0oCkxJ8iTeD8VeKW9QUhuyCUBA0xnA/3PQc9ZCVfC0K8S3n9+8xkui2nuaWL4GkrOc FWIAedIUQ6Rh9IadAwpvO9kavaG1Fndq6a5k0mXTd/QY7SDdprM+f6Hu9dyn5UNCiUte 1iV1NP+11fg9JS/XehBCqQovfNf+lsxzNRX3tUNDskOd3b6IWoxngZ6VX8hy0yX0Cvgw fsTQ== X-Gm-Message-State: AOAM530BHvDx32Mvh01MHjO99uqLR4i+ca6RJ8GtS3hXyIasiLNL8Pdl O+4sQDlxr1ac3h3s7KOftmzsXz4lhc3QeepdLZARlIGQzoo= X-Received: by 2002:a9d:664f:: with SMTP id q15mr17011389otm.40.1608683578729; Tue, 22 Dec 2020 16:32:58 -0800 (PST) MIME-Version: 1.0 From: KeithG Date: Tue, 22 Dec 2020 18:32:48 -0600 Message-ID: Subject: Request for help with btmgmt To: linux-bluetooth@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org I am developing a RPi based audio player. We are trying to add bluetooth capability to this player. We use alsa and not pulse-audio, so we need a bit more granular info to get it to run. I have written a script which is designed to be triggered by udev when a BT device is added or removed. This script will then use bluetoothctl to get the capabilities of the device and also add or remove it from a dynamic database list of MACs in redis. I have a simple script working as I want from the cli. The key command I am using is 'btmgmt con' which is the only command I have found that tells me what MACs are currently connected. I can run this command from the command line as root. I can set the setuid bit of btmgmt and also get it to run as a user (http in this case). I cannot, ever, get this command to run when triggered from udev. I get no response and no error. 1) Why is this particular command (query attached BT MACs) not part of bluetoothctl? Is there a security issue? 2) Why can I not run 'btmgmt con' in a script (bash or php) triggered by udev when the device is added or removed? 3) is there a 'better way' for me to know what device MAC addresses are attached? I have not found another simple way to get this info. What I am doing in the script is: if an audio source is attached, I want to run a bluealsa-aplay service. When an audio sink is attached, I want to re-set my audio output to the bluealsa device. If it is not an audio device, I do not care, but do keep track of what is attached in my database so that the next time the script runs that it is not queried and is 'known'. Thanks for the help. Keith