Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4649256imw; Tue, 12 Jul 2022 11:40:46 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vtwZySSJn9pwAVDoD+clyK0hMYLrEEcF79YKNh3RIgeItS1kHSuXmxfim5IGGtbXtYT6Yf X-Received: by 2002:a17:902:e887:b0:16c:32e4:6434 with SMTP id w7-20020a170902e88700b0016c32e46434mr19244437plg.51.1657651245836; Tue, 12 Jul 2022 11:40:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657651245; cv=none; d=google.com; s=arc-20160816; b=P5ggwBlrV+yUvThc9dRlQvocNqVBDSQZ5delZ0MU6+5ms2N1iWiJ7urXQCLMjTCAHi h4Xpe+5216ghQIy1snM+w4mdp6a9DZNrBc/PDOt177jQP6iTkAODnMf6L4ov2lBklFL9 QftVhDYw0nS08MSIwl9MVJkBqgjb/lR34t/1ly7oQagsQYDVjKxEit2VrU3i1GuSivf9 7hJAAuVFBfq2FCMzPlai+wF0vK0fn2ugBVXE+bpuPhwJcodcL1RHm17tEglqzQWuAz33 MOHUiV2SmLDZ8UWqo75T0Tcc7hhgNLBaBtz/8DQEeydrvcl5WoHoeSH+DeyXE6SAWVcl F4sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=dup+uwY3XFwHXrwD/dYtv/4PGIz7Zfa98eTRBqsQ5Qw=; b=MfGGtWwoPWr3RslzQq9MiqiPShZZmzUe2RQQyTaMELRbbm5nHlnM/zFbSN/V+FePq2 OhvzvzOLsEtF++rroNEQWXt807MUeQCRWdP81O+MD+UrqvVbr82+W2s2VwhhEUWdpGOq i3ISq1/auDbnuVfF+epUF2DMywG55lDch0FRS0jmwo4MaqeajasK/YQR5QYfko0MbmLD s3BL/E7EwdemjF2Tc21SPqDgcvIMxKXazkiaUXhkpik1mgLIBZpTW6m5H1VW/+0vnWx7 15FZO3bxYGyNRjkTSE1lic3puLDCM39JFbxznLF8S8yxRazZUAsZEHxkclgaQ7n8wotJ LNNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=N1uk0PVI; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ru11-20020a17090b2bcb00b001efe3523e3asi16428695pjb.133.2022.07.12.11.40.24; Tue, 12 Jul 2022 11:40:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=N1uk0PVI; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230050AbiGLSdQ (ORCPT + 99 others); Tue, 12 Jul 2022 14:33:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229800AbiGLSdP (ORCPT ); Tue, 12 Jul 2022 14:33:15 -0400 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4ED29C84F9 for ; Tue, 12 Jul 2022 11:33:14 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id r9so7381003lfp.10 for ; Tue, 12 Jul 2022 11:33:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=dup+uwY3XFwHXrwD/dYtv/4PGIz7Zfa98eTRBqsQ5Qw=; b=N1uk0PVINDYsGsMWswXbcHvPAoJQuzAAD7XuNo3aBULPvz9h1S6Jvtjm8up3y13nsY 3tpmMH9CpSA+Ycwh3sn9TdcWf5lekftGAAH/pfiCuReCgNeuq8lQjEkN74meebc16bJ7 PT/s7RCEZbBfJ0igUIT4E0/vvlScUik3LhXKplgZ+ovepasck0/4eownX2SvXcTq2zvA hLMUW0pzHUdlP6IioyO4h/BikaXNZOiqmzPpLhk0C0KzuaD7kSTCn39VK/NHarJ0weg+ akG4yNBtBoNYFk5HAFgdFg7tK5/zdaG5l7QLeANO4+8tTji5UpSpzoV/nmdBrSaO4W3d zXQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=dup+uwY3XFwHXrwD/dYtv/4PGIz7Zfa98eTRBqsQ5Qw=; b=npdshfTEZV0bUZkn4prylcCcVRrjacbF0LCjxItjr1LZck8oui2WeiAcyIT5FugBHB mhx6vfWDW7+ddnyuCKlCH5KXrkzclNPhgcJiDOb4GH6Ui3JUunm8nQXtacEcHttlPaCF WRffv3FuRLbNhj6KThiezEmamU27/yIczDX9CR1EJAR3/OVDj2oh9FG8w9oUuEfxeK5P 3SwUYPYC02aZdvt4ftygBnCHBxT3GDu5I/dP27ONc8qmXdOxZs9AYKyomGwv9pnrdfpx l7L4i4ides5M5b2Pl4j3sV1P5UQ4ZCL0/flcOA00XFBYSaVWFboBYsIaau+qdkEFE2cY 117w== X-Gm-Message-State: AJIora/wir+vpVSPHCvYLpDS+YcQtUPagjSeD+5HmsT8bG4MKoZN6dNO +XqKUUkh+OE5DLuuTCGL9MWTyKO0v9UsbfH+vJY= X-Received: by 2002:a05:6512:1048:b0:489:ddda:d2a3 with SMTP id c8-20020a056512104800b00489dddad2a3mr7602572lfb.57.1657650791966; Tue, 12 Jul 2022 11:33:11 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Luiz Augusto von Dentz Date: Tue, 12 Jul 2022 11:33:00 -0700 Message-ID: Subject: Re: How does bluetoothctl work from the command line with gatt? To: John Klug Cc: Linux-Bluetooth MailingList Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi John, On Tue, Jul 12, 2022 at 11:09 AM John Klug wrote: > > How does one do the following in bluetoothctl from a script and command line that one would do in gatttool as follows: > > # gatttool -i hci0 -b $bd_addr -u 2a29 --char-read > handle: 0x0017 value: 54 65 78 61 73 20 49 6e 73 74 72 75 6d 65 6e 74 73 > # gatttool -i hci0 -b $bd_addr --char-desc | grep -i aa22 > handle = 0x002f, uuid = f000aa22-0451-4000-b000-000000000000 > # gatttool -i hci0 -b $bd_addr -a 0x002f --char-write-req -n 01 > Characteristic value was written successfully > > > For instance: > > # bluetoothctl connect CC:78:AB:7E:87:07 > Attempting to connect to CC:78:AB:7E:87:07 > Connection successful > # bluetoothctl gatt.select-attribute 2a29 > # bluetoothctl gatt.read > No attribute selected > # bluetoothctl gatt.select-attribute f000aa22-0451-4000-b000-000000000000 > # bluetoothctl gatt.acquire-write > No attribute selected > # bluetoothctl gatt.write 0x01 > No attribute selected You will probably need to wait for the daemon to resolve the services which will then export the attributes as D-Bus objects that can be accessed by bluetoothctl, note that some services are handled internally by bluetoothd (e.g. GAP and GATT services) which perhaps is the case of 0x2a29, although we don't currently have any D-Bus property for Manufacturer like we do for name (org.bluez.Device1.Name). -- Luiz Augusto von Dentz