Received: from mail-vs1-f67.google.com (mail-vs1-f67.google.com [209.85.217.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 364703542CB for ; Fri, 30 Jan 2026 22:02:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.67 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769810574; cv=none; b=TYzA9xkLWO2GcQAlk5zYkk/tbf7BV0eXw7DLIltGwEOQAuVJBpAw+PwNis4VG0xIvJM1Mp4Sm5U4hOy9Lb+mgGMpmBuQcVDSiSrBSJc8g4twxONeVaotSMb1+SvwjyqiN2pbflzk6c77lOg3bChvn0f9F047HwSW232t8/ETzBg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769810574; c=relaxed/simple; bh=4m/eXjuor5sn/XH/m8iFrQaNnL9rLbxtPRr6zv5fRQ0=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ad+DIkklZ0IrVM6EIBUlWvf+5nyoA0wq+q5e/9rciWdZSHIdZcE1fhxn/WnzSeseR6Fsfyp7LvAMqUZ8grnDjGgmg5NumV+YRmWR29TfZg9YrFKPCNkhq+7AHUZCUpc92XzowO5KcoU5uIlwDCv02MHvQXDI2sbC1vizYXPrzCQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=lcbVWn4x; arc=none smtp.client-ip=209.85.217.67 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lcbVWn4x" Received: by mail-vs1-f67.google.com with SMTP id ada2fe7eead31-5f52b3d98cfso814075137.2 for ; Fri, 30 Jan 2026 14:02:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769810571; x=1770415371; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=rvotALpb6c1UIWkDCkGmFEiFUaIjIkhDJVMLfM+MIK0=; b=lcbVWn4xQ9DQSTquwxrr5eLxf2FoIHkD0BzLD+eb0U7j8bFTMEVwlPx1ssrmwq7G8g zUtmuOxK0V31wyiKud8qAUnJisJfag7hRmRR2diH/RYJ8mZc24VaxLPz2Pd3/erS1U5o ocNAEFtUWk8J6sKSlsXFOnO5rRXhxKk25XDxA3lkRDeKC9J2pkr+99K9PaCyvNHAvYfg cRN4jIW72ogSzetfMlARSvcw4MA8759fkUfq+u8yx7faDyRxDx689D8SPSwnIE3wjVl0 Gn01Tl6vp6Aqjddr9p9DqYGvXsxouR2IJfoFABnhTTDs2jtuXTE+AJd4rFJu5yVyrZqH kA5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769810571; x=1770415371; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=rvotALpb6c1UIWkDCkGmFEiFUaIjIkhDJVMLfM+MIK0=; b=PKtbUxuYRkdZBvP96zQT6eHIzu7Cr2dRPCrsEauvp5AWCxK2+C7Y0KZ5ixa2gJ2XDB k4DZ9aYgNNSRRbuZTekO78wDfVoqsN9l8esg4u5NK6QgagJvI5Y2GGfeKqGxcG8xBREx QMSC8knWKb2f49BBWfs6tAadF7R7MyYEz/mxGqFH/8cPeyvHrgXGTI4RNQS3gYNTt4NM M1vMY4O1wx/oQ5GPZgKx+R30AxKDt1HFQ00J+An6mBJqpezvA6xFrWdfISBSfZdWWBRW NRUmihoZip24d5N6OgpKszaFt/todVSQVszUGlHP8dbcPd3ckeDUqwTk36ULtZHrc1WK bFHA== X-Gm-Message-State: AOJu0Yw9P9kNtS7T3LCnZAhmgbl3+T6YaCnKmc6HQLO7c1xu+HEmmdKs k0FdGYDjGjQRN6Uls+sQ1pGOQAgf9jm8Zs0gXY9klZJz6n3lAo8ZmxD1YOdGognM X-Gm-Gg: AZuq6aJMSsHjl/LkedloQGS3UvLpiWMDcpHpyTrfo3GqI2OAaTOzL0SBWaZw+5qChvC 0eMAAKSKhDgN664DGIgF0jCFajj6gtPFtLNN5sKhC4Ht4RbBq719FaV7Sf86Zmn9KPqCuKMkw0y Vq8L/m+lwcUxGR4hwNz7+Dpy3sDlK7lRpdKopkvst6pLrYlM6pd1SuyYJP1ky9v8YdfPlg1Xbc0 HAC1XxEMWjLyPfGWbCFKNo6bLZ8tbwQftmCRrHMMoEew49rYgncs35IRKi+2wMPOL9Xxg0jRdnG OAgeskXmux0U4NfW9biSDeiil8vOY6b8y4hpTw13pWBJi7N+pnarA9rzWFqip4S9vtM2R4zgWyB tiKaIs5Sz6G3J/ZNxjvgheOLtFt8YfegGJP/mrOS4LFg00vJ7vy/PlHsIfMuC8gs+lxZQ5Ugff0 +wKK542sc8Es0Ua87bXWlg0UPkJTdOq3oMW6BCmYeCVIqnc4nmVgcA1b/sxTl1592kAcSUpL3+Y 0pdLA== X-Received: by 2002:a05:6102:a4b:b0:5f5:7723:28ee with SMTP id ada2fe7eead31-5f8e249d107mr1456822137.11.1769810570606; Fri, 30 Jan 2026 14:02:50 -0800 (PST) Received: from lvondent-mobl5 ([72.188.211.115]) by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-948723adb7csm2404052241.2.2026.01.30.14.02.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jan 2026 14:02:50 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ v3 08/37] doc/bluetoothctl-gatt: Add :Uses: fields and document arguments Date: Fri, 30 Jan 2026 17:01:59 -0500 Message-ID: <20260130220229.1346261-9-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260130220229.1346261-1-luiz.dentz@gmail.com> References: <20260130220229.1346261-1-luiz.dentz@gmail.com> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Luiz Augusto von Dentz Add :Uses: fields to link commands to their corresponding D-Bus API methods, and document command arguments with usage examples. --- doc/bluetoothctl-gatt.rst | 249 +++++++++++++++++++++++++++++++++++++- 1 file changed, 244 insertions(+), 5 deletions(-) diff --git a/doc/bluetoothctl-gatt.rst b/doc/bluetoothctl-gatt.rst index 6c72302ae935..493c7cf3b2c1 100644 --- a/doc/bluetoothctl-gatt.rst +++ b/doc/bluetoothctl-gatt.rst @@ -18,6 +18,10 @@ SYNOPSIS **bluetoothctl** [--options] [gatt.commands] +This submenu interacts with GATT services, characteristics, and descriptors +using the **org.bluez.GattService(5)**, **org.bluez.GattCharacteristic(5)**, +**org.bluez.GattDescriptor(5)**, and **org.bluez.GattManager(5)** interfaces. + Generic Attribute Commands ========================== @@ -30,7 +34,24 @@ encompassing services, characteristics, and handles. This command provides a comprehensive overview of the available Bluetooth attributes, which can be further interacted with using other commands. -:Usage: **> list-attributes ** +:Usage: **> list-attributes [dev/local]** +:[dev/local]: Device MAC address, object path, or "local" to list locally registered attributes (optional, lists all if omitted) +:Example List attributes for specific service: + | **> list-attributes /org/bluez/hci0/dev_00_11_22_33_44_55/service001a** +:Example List attributes for specific characteristic: + | **> list-attributes /org/bluez/hci0/dev_00_11_22_33_44_55/service001a/char001c** +:Example List attributes for service on different device: + | **> list-attributes /org/bluez/hci0/dev_AA_BB_CC_DD_EE_FF/service0020** +:Example List all Generic Access service attributes: + | **> list-attributes 0x1800** +:Example List all Battery Service attributes: + | **> list-attributes 0x180F** +:Example List all Device Name characteristic attributes: + | **> list-attributes 0x2A00** +:Example List attributes using full UUID: + | **> list-attributes 00001801-0000-1000-8000-00805f9b34fb** +:Example List attributes for custom service UUID: + | **> list-attributes 12345678-1234-5678-9abc-123456789abc** select-attribute ---------------- @@ -41,7 +62,25 @@ must select it with this command. This establishes a context for many other commands (read, write, notify, etc.), specifying the attribute they should operate on. -:Usage: **> select-attribute ** +:Usage: **> select-attribute [attribute/UUID]** +:: GATT attribute path, UUID, or "local" to select from local attributes +:[attribute/UUID]: Additional attribute path or UUID when using "local" (optional) +:Example Select specific characteristic: + | **> select-attribute /org/bluez/hci0/dev_00_11_22_33_44_55/service001a/char001c** +:Example Select specific descriptor: + | **> select-attribute /org/bluez/hci0/dev_00_11_22_33_44_55/service0020/char0022/desc0024** +:Example Select service on different device: + | **> select-attribute /org/bluez/hci0/dev_AA_BB_CC_DD_EE_FF/service001a** +:Example Select Device Name characteristic: + | **> select-attribute 0x2A00** +:Example Select Battery Level characteristic: + | **> select-attribute 0x2A19** +:Example Select Client Characteristic Configuration descriptor: + | **> select-attribute 0x2902** +:Example Select Temperature characteristic using full UUID: + | **> select-attribute 00002a6e-0000-1000-8000-00805f9b34fb** +:Example Select custom characteristic: + | **> select-attribute 12345678-1234-5678-9abc-123456789abc** attribute-info -------------- @@ -52,6 +91,17 @@ attribute. This command is useful for understanding the properties and capabilities of an attribute. :Usage: **> attribute-info [attribute/UUID]** +:[attribute/UUID]: GATT attribute path or UUID to get info for (optional, uses current if omitted) +:Example Show information for currently selected attribute: + | **> attribute-info** +:Example Show info for specific characteristic: + | **> attribute-info /org/bluez/hci0/dev_00_11_22_33_44_55/service001a/char001c** +:Example Show info for Battery Level characteristic: + | **> attribute-info 0x2A19** +:Example Show info for Device Name characteristic: + | **> attribute-info 0x2A00** +:Example Show info for Temperature characteristic: + | **> attribute-info 00002a6e-0000-1000-8000-00805f9b34fb** read ---- @@ -61,6 +111,18 @@ beforehand with select-attribute. The optional offset parameter can be used for attributes that allow partial reads. :Usage: **> read [offset]** +:Uses: **org.bluez.GattCharacteristic(5)** method **ReadValue** +:[offset]: Byte offset to start reading from (optional, defaults to 0) +:Example Read attribute value from offset 0: + | **> read** +:Example Read attribute value from offset 0 (explicit): + | **> read 0** +:Example Read attribute value starting from offset 4: + | **> read 4** +:Example Read attribute value starting from offset 10: + | **> read 10** +:Example Read attribute value starting from offset 16: + | **> read 16** write ----- @@ -70,7 +132,25 @@ be selected in advance using select-attribute. Data must be provided in hexadecimal format. Optional offset and type parameters can accommodate specific write requirements. -:Usage: **> write [offset] [type]** +:Usage: **> write [offset] [type]** +:Uses: **org.bluez.GattCharacteristic(5)** method **WriteValue** +:: Hexadecimal data bytes to write to the attribute +:[offset]: Byte offset to start writing at (optional, defaults to 0) +:[type]: Write type - request, command, or reliable (optional, defaults to request) +:Example Write "Hello" to attribute (ASCII bytes): + | **> write "48 65 6C 6C 6F"** +:Example Write binary data to attribute: + | **> write "01 02 03 04"** +:Example Write single byte value: + | **> write "FF"** +:Example Write 2 bytes starting at offset 4: + | **> write "01 02" 4** +:Example Write with write request (default): + | **> write "48 65 6C 6C 6F" 0 request** +:Example Write with write command (no response): + | **> write "01 02 03" 0 command** +:Example Write with reliable write: + | **> write "FF EE DD" 0 reliable** acquire-write ------------- @@ -80,6 +160,9 @@ is useful for applications that need a file descriptor to perform write operations. :Usage: **> acquire-write** +:Uses: **org.bluez.GattCharacteristic(5)** method **AcquireWrite** +:Example Acquire write file descriptor for current attribute: + | **> acquire-write** release-write ------------- @@ -89,6 +172,8 @@ command is necessary to clean up resources after you're done with the write operation. :Usage: **> release-write** +:Example Release write file descriptor for current attribute: + | **> release-write** acquire-notify -------------- @@ -98,6 +183,9 @@ This enables applications to listen for notifications on attribute value changes. :Usage: **> acquire-notify** +:Uses: **org.bluez.GattCharacteristic(5)** method **AcquireNotify** +:Example Acquire notify file descriptor for current attribute: + | **> acquire-notify** release-notify -------------- @@ -106,6 +194,8 @@ Releases the Notify file descriptor obtained with acquire-notify. Ensures resources are freed once notification listening is no longer needed. :Usage: **> release-notify** +:Example Release notify file descriptor for current attribute: + | **> release-notify** notify ------ @@ -116,6 +206,12 @@ command allows applications to be notified of attribute changes without polling. :Usage: **> notify ** +:Uses: **org.bluez.GattCharacteristic(5)** methods **StartNotify**, **StopNotify** +:: Enable or disable notifications for the current attribute +:Example Enable notifications for current attribute: + | **> notify on** +:Example Disable notifications for current attribute: + | **> notify off** clone ----- @@ -124,6 +220,21 @@ Creates a clone of a device or attribute. This can be useful for creating a backup or working with a copy for testing purposes. :Usage: **> clone [dev/attribute/UUID]** +:[dev/attribute/UUID]: Device MAC address, attribute path, or UUID to clone (optional, clones current if omitted) +:Example Clone entire device GATT database: + | **> clone 00:11:22:33:44:55** +:Example Clone another device: + | **> clone AA:BB:CC:DD:EE:FF** +:Example Clone specific service: + | **> clone /org/bluez/hci0/dev_00_11_22_33_44_55/service001a** +:Example Clone specific characteristic: + | **> clone /org/bluez/hci0/dev_00_11_22_33_44_55/service001a/char001c** +:Example Clone Generic Access service: + | **> clone 0x1800** +:Example Clone Battery Service: + | **> clone 0x180F** +:Example Clone Battery Level characteristic: + | **> clone 0x2A19** register-application -------------------- @@ -133,6 +244,18 @@ management of services, characteristics, and descriptors under this application. :Usage: **> register-application [UUID ...]** +:Uses: **org.bluez.GattManager(5)** method **RegisterApplication** +:[UUID ...]: Optional list of service UUIDs to register with the application +:Example Register GATT application without specific UUIDs: + | **> register-application** +:Example Register application with Battery Service: + | **> register-application 0x180F** +:Example Register with Generic Access and Battery Service: + | **> register-application 0x1800 0x180F** +:Example Register application with custom service UUID: + | **> register-application 12345678-1234-5678-9abc-123456789abc** +:Example Register with multiple standard services: + | **> register-application 0x1800 0x180F 0x180A** unregister-application ---------------------- @@ -140,6 +263,9 @@ unregister-application Removes a previously registered application from the Bluetooth system. :Usage: **> unregister-application** +:Uses: **org.bluez.GattManager(5)** method **UnregisterApplication** +:Example Unregister current GATT application: + | **> unregister-application** register-service ---------------- @@ -148,6 +274,24 @@ Adds a new service under a registered application. This command is crucial for defining new services that devices can offer. :Usage: **> register-service [handle]** +:: Service UUID to register (16-bit, 32-bit, or 128-bit format) +:[handle]: Specific attribute handle to assign (optional, auto-assigned if omitted) +:Example Register Generic Access service (auto handle): + | **> register-service 0x1800** +:Example Register Battery Service (auto handle): + | **> register-service 0x180F** +:Example Register Device Information service (auto handle): + | **> register-service 0x180A** +:Example Register Generic Access service at handle 1: + | **> register-service 0x1800 0x0001** +:Example Register Battery Service at handle 16: + | **> register-service 0x180F 0x0010** +:Example Register Device Info service at handle 32: + | **> register-service 0x180A 0x0020** +:Example Register custom service (auto handle): + | **> register-service 12345678-1234-5678-9abc-123456789abc** +:Example Register custom service at specific handle: + | **> register-service 12345678-1234-5678-9abc-123456789abc 0x0050** unregister-service ------------------ @@ -156,6 +300,17 @@ Removes a service from a registered application, effectively ceasing its availability. :Usage: **> unregister-service ** +:: Service UUID or object path of the service to unregister +:Example Unregister Generic Access service: + | **> unregister-service 0x1800** +:Example Unregister Battery Service: + | **> unregister-service 0x180F** +:Example Unregister custom service: + | **> unregister-service 12345678-1234-5678-9abc-123456789abc** +:Example Unregister service by object path: + | **> unregister-service /org/bluez/example/service0** +:Example Unregister another service: + | **> unregister-service /org/bluez/example/service1** register-includes ----------------- @@ -163,14 +318,28 @@ register-includes Marks a service as included within another service, allowing for service hierarchies and complex service structures. -:Usage: **>r egister-includes [handle]** +:Usage: **> register-includes [handle]** +:: Service UUID to register as included service +:[handle]: Specific attribute handle to assign (optional, auto-assigned if omitted) +:Example Register Generic Access as included service: + | **> register-includes 0x1800** +:Example Register Battery Service as included at handle 21: + | **> register-includes 0x180F 0x0015** +:Example Register custom service as included: + | **> register-includes 12345678-1234-5678-9abc-123456789abc** unregister-includes ------------------- Removes an included service relationship, simplifying the service structure. -:Usage: **> unregister-includes ** +:Usage: **> unregister-includes ** +:: Parent service UUID that contains the included service +:: Included service UUID to remove from the parent service +:Example Unregister Battery Service inclusion from Generic Access: + | **> unregister-includes 0x1800 0x180F** +:Example Unregister Device Info inclusion from custom service: + | **> unregister-includes 12345678-1234-5678-9abc-123456789abc 0x180A** register-characteristic ----------------------- @@ -179,6 +348,31 @@ Introduces a new characteristic under a service, specifying its properties and access permissions with flags. :Usage: **> register-characteristic [handle]** +:: Characteristic UUID to register (16-bit, 32-bit, or 128-bit format) +:: Comma-separated list of characteristic properties and permissions +:[handle]: Specific attribute handle to assign (optional, auto-assigned if omitted) +:Example Register Device Name (read-only): + | **> register-characteristic 0x2A00 read** +:Example Register Battery Level (read + notifications): + | **> register-characteristic 0x2A19 read,notify** +:Example Register Heart Rate Measurement (notify-only): + | **> register-characteristic 0x2A37 notify** +:Example Register Device Name (read + write): + | **> register-characteristic 0x2A00 read,write** +:Example Register Battery Level (read + write + notify): + | **> register-characteristic 0x2A19 read,write,notify** +:Example Register Temperature (read + indications): + | **> register-characteristic 0x2A6E read,indicate** +:Example Register Device Name at handle 3: + | **> register-characteristic 0x2A00 read 0x0003** +:Example Register Battery Level at handle 19: + | **> register-characteristic 0x2A19 read,notify 0x0013** +:Example Register custom characteristic with full capabilities: + | **> register-characteristic 12345678-1234-5678-9abc-123456789abc read,write,notify** +:Example Register custom write-only characteristic: + | **> register-characteristic ABCD1234-ABCD-1234-ABCD-123456789ABC write-without-response** +:Example Register with all flags: + | **> register-characteristic 0x2A00 read,write,write-without-response,notify,indicate** unregister-characteristic ------------------------- @@ -186,6 +380,17 @@ unregister-characteristic Eliminates a characteristic from a service, removing its functionality. :Usage: **> unregister-characteristic ** +:: Characteristic UUID or object path of the characteristic to unregister +:Example Unregister Device Name characteristic: + | **> unregister-characteristic 0x2A00** +:Example Unregister Battery Level characteristic: + | **> unregister-characteristic 0x2A19** +:Example Unregister custom characteristic: + | **> unregister-characteristic 12345678-1234-5678-9abc-123456789abc** +:Example Unregister characteristic by object path: + | **> unregister-characteristic /org/bluez/example/service0/char0** +:Example Unregister another characteristic: + | **> unregister-characteristic /org/bluez/example/service1/char1** register-descriptor ------------------- @@ -194,6 +399,29 @@ Adds a descriptor to a characteristic, further defining its behavior and access controls. :Usage: **> register-descriptor [handle]** +:: Descriptor UUID to register (16-bit, 32-bit, or 128-bit format) +:: Comma-separated list of descriptor properties and permissions +:[handle]: Specific attribute handle to assign (optional, auto-assigned if omitted) +:Example Register Client Characteristic Configuration: + | **> register-descriptor 0x2902 read,write** +:Example Register Characteristic User Description: + | **> register-descriptor 0x2901 read** +:Example Register Characteristic Presentation Format: + | **> register-descriptor 0x2904 read** +:Example Register CCCD at handle 5: + | **> register-descriptor 0x2902 read,write 0x0005** +:Example Register User Description at handle 21: + | **> register-descriptor 0x2901 read 0x0015** +:Example Register custom descriptor: + | **> register-descriptor 12345678-1234-5678-9abc-123456789abc read,write** +:Example Register custom read-only descriptor: + | **> register-descriptor ABCD1234-ABCD-1234-ABCD-123456789ABC read** +:Example Register Valid Range descriptor: + | **> register-descriptor 0x2906 read** +:Example Register External Report Reference: + | **> register-descriptor 0x2907 read** +:Example Register Report Reference: + | **> register-descriptor 0x2908 read** unregister-descriptor --------------------- @@ -201,6 +429,17 @@ unregister-descriptor Removes a descriptor from a characteristic, simplifying its behavior. :Usage: **> unregister-descriptor ** +:: Descriptor UUID or object path of the descriptor to unregister +:Example Unregister Client Characteristic Configuration: + | **> unregister-descriptor 0x2902** +:Example Unregister Characteristic User Description: + | **> unregister-descriptor 0x2901** +:Example Unregister custom descriptor: + | **> unregister-descriptor 12345678-1234-5678-9abc-123456789abc** +:Example Unregister descriptor by object path: + | **> unregister-descriptor /org/bluez/example/service0/char0/desc0** +:Example Unregister another descriptor: + | **> unregister-descriptor /org/bluez/example/service1/char1/desc1** RESOURCES ========= -- 2.52.0