Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2896268lqp; Mon, 25 Mar 2024 12:17:28 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWeTizH3CZn7BfHBtx3OGfmeXUmWm0LJ013/G09C8twJEDxbKHquzqhl7mSZsMx/jBJxOAyItBBqAsC72kqpV1Ww+tSLTarlMWwEc9ejQ== X-Google-Smtp-Source: AGHT+IFzTrtq9/ih90ci5Md0mUvDc39GoAPS6dFdtHnQycEqQ0rWRX5x+JVz7vOCL78bjqTwQt4j X-Received: by 2002:a17:902:ec8f:b0:1e0:73d:9172 with SMTP id x15-20020a170902ec8f00b001e0073d9172mr10295852plg.23.1711394248396; Mon, 25 Mar 2024 12:17:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711394248; cv=pass; d=google.com; s=arc-20160816; b=rR4W35bdNOvBmU8UxvRwJEAxPsYK6kL0KpVf+Nw7tpBpD47O9ycPEoSC3d5hlQNGic iNY7f2Iw25Jq7RBkqpyaQiHjkiD7Op0+j0VkAXNbtxhL/k0j01FWL6SeMp0SoYndjnG9 V7HLqFlcdr+BZB+TfK6Rtc7tW3VbeSaGL9vWo9bdKTLohhCi2UjB7N+/hu3X6sb0qUHy sEE1I1zfJjaY54SlQmrCROeBo877LaCRRqyaJbk0ll8q/bpwwYRx3PIbJb3ts0ynMTmR Xd29dB8ek0LaJ4e5tA+/PnpY4E5VIiChBkrd3EbviKOunXUPMLI1e+ioeFhrloiDHyEr ZVhA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:subject:message-id:date:from:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:dkim-signature; bh=j/hhnXXyoP79Jf7ZPC/HKUdhyV3cIkzLRkKvGi9Nugs=; fh=4lGQI6056MBa4/oovMyIYaKLn+Wz/24RGvUivMmQP8E=; b=RIsv8lmChhR8NKV6/HJ9Q+2YGNSVYJ25RIOkpwBJztM/JLkavqrxwe0Kyl1byRDLKL K81vXHJJTbjWJ2WvbAJdxyZDrKfYosjUqy9GchjVtMFwXzgBUtbk1NhEM60aetRW8wq9 m02fDGh/zEMxDaU3jnQoyau3NbzaEbtBzIQ+eWWNsOwVk5VMJBduto2eunxL2PGgq4cG lI7Z/Yw9uvDJSTGrscNTV79Ri0Pfj+0+mcQ74Uy9snCLkXN5WmC8BoRYQPi/tmWHIj5f J7dF9pbHDjvK95FFWuiE+UtfT3/7L0evx9ACfHBREULYy3yhDuL0yhSiL0wuFGnu/S4w s/sw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=RsB0rGQO; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-bluetooth+bounces-2764-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-2764-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id j1-20020a170902c08100b001e0cdccf682si1305666pld.330.2024.03.25.12.17.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 12:17:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-2764-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=RsB0rGQO; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-bluetooth+bounces-2764-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-2764-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id A63D92E222E for ; Mon, 25 Mar 2024 19:07:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6AE6511198; Mon, 25 Mar 2024 19:06:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RsB0rGQO" X-Original-To: linux-bluetooth@vger.kernel.org Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.173]) (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 66266D27A for ; Mon, 25 Mar 2024 19:06:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711393615; cv=none; b=VTBu+z+NTXkSRudGlujeAh9bl1W52Li1UwLdcyhMAoJ8nO1K760QNB6+rqSlD14XycYzlAWhBAhbML/Do24Mh/vvAICfu8AzpaPsDzG4iwyfKyiF7iZX+ptUeNpN9Nb8Cpqyij4/d1t04O0ipVwYie3UFk1Gqgh9yhz+j5OcQLQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711393615; c=relaxed/simple; bh=upXl6DWwI+BYQ1ee4lbEsBXIZN47l5SoVcymkibaoPg=; h=MIME-Version:From:Date:Message-ID:Subject:To:Content-Type; b=b/CqOQg0CjiHSz+LSdD8pvFNC3m1s/TChoRcVPg1aNO6Mbv01JiyXIxajKnS/xrwJiOk8Wfenaq4YtvZWjNG0oZCeTB1j4tno7Fj1eBPxEXQ3zbEACYg9cxw+/Tlga2hKT6786VImbEghxAOv6qpE9AZkdD/ZvvwGInCMT5ExJU= 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=RsB0rGQO; arc=none smtp.client-ip=209.85.215.173 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 Received: by mail-pg1-f173.google.com with SMTP id 41be03b00d2f7-5dcc4076c13so2933793a12.0 for ; Mon, 25 Mar 2024 12:06:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711393613; x=1711998413; darn=vger.kernel.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=j/hhnXXyoP79Jf7ZPC/HKUdhyV3cIkzLRkKvGi9Nugs=; b=RsB0rGQOtHOUyenksut3UOB5ytA4NhEO655xWnGjnoB8F6lydFF2RMnQOeL3/KLjzL 93+Z0Mbwj6QOkvx/l51/afS1ymvnzW00S9fi6APIyGe/s8ilqBWfZ1Io8YYCGFYVLAbA P7z2Y/gf60+KdKpouLLDjhIv6im49jw16MRYhCZKYL4z0R8gJ3kNLuae/bM1HkOsFQWe eS3SE778cd675sZ/BR2mtiyHFFHqTDC55/ejEdYW7n19SMdKh6eF7oJwFeHKwM+SM7m1 U/4HXt7QmYRuhBY5rPAP9yZElwrFeyH18VQpdkGOW+JKmNVglgh2cGyq88ysqRhAYYk9 gv/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711393613; x=1711998413; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=j/hhnXXyoP79Jf7ZPC/HKUdhyV3cIkzLRkKvGi9Nugs=; b=j31TFmNhKz3sYaUk4cNKkeOKZ0q31LKRETvBkCUdLVBM/2vPpmaTdarWcWTaz/IbT2 Auk442F6Wv0fmR7RCSg5xI/QVvBEApy1kwL+DCQ/g5edJH0vFwUXA1dYNu4W/m8CXAOX g1/v5eEwfsDsOVstATH2jnKXl4GgbvG5u160dWDzeM95nacRnz4zZwLYApyhMfxw/AhW 9aFJGDo1FxwUPyTcMFNPhKzzh/L1eVxV2c6K6rCdYHgGBwNBuZA3YXPRlXpm1MLslo2t B1PWR7Fr50ibTsyDUSFKOE3UGH8JNlQInufIrjyHPYroUYF84K5x2CIkIyZtYrxOwZ5/ XZGQ== X-Gm-Message-State: AOJu0YzaTaG0OFWv/WpIXRsdCbePa+Mq2z8zGslJF4faWtzSId4APZrL s5FaUZiumdxMdxUkT6t3cjF45oyDovS3VzZE8iYQcmLaOKpVcA+VWaJvQ77ibPXRqLXP0MmY+ox J+IyYP/d5/cP0PxvhO4uGyPwfLY7LWIvMZe8k5Q== X-Received: by 2002:a17:90a:a590:b0:29c:570d:7f5d with SMTP id b16-20020a17090aa59000b0029c570d7f5dmr11269557pjq.9.1711393613410; Mon, 25 Mar 2024 12:06:53 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Chris Genly Date: Mon, 25 Mar 2024 12:06:42 -0700 Message-ID: Subject: How do I used bluetoothctl's gatt menu to make an RFCOMMM discoverable? To: linux-bluetooth@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Hi All, I have a very simple application that I've spent way too much time on. I have a Raspberry pi 5, I've created a bluetooth serial port using rfcomm. Now I want this new serial port to be announced by the rpi5. Conceptually simple. I've spent time going through the bluetooth spec, and reading the serial port profile spec. It took some time to track things down. I can't say I understood everything, but I enjoyed it. The bluetoothctl gatt menu looks like it has exactly the capability I want. But I've had a very hard time understanding how to use it. I haven't been able to find good explanations or many examples of how to use it. (1) Can anyone point me to examples and documentation of bluetoothctl's gatt? Maybe I just haven't tried the right search terms and there is a trove sitting out there. I tried looking the bluez user mailing list. http://news.gmane.org/gmane.linux.bluez.kernel As referenced from here https://www.bluez.org/development/lists/ But I'm getting server not found. The list at marc.info works. I tried reading the sourcecode for bluez/client. But It's hopeless. I learned a few things, but the effort is too high to find what I need. I found blues/client/scripts. That was helpful, but there aren't enough examples to answer the questions I have. I've found a number of docs like this: https://ubuntu.com/core/docs/bluez/reference/accessing-gatt-services but they don't go into how to create gatt entries. From the serial port profile doc, https://www.bluetooth.com/specifications/specs/serial-port-profile-1-1/, I want to declare the following information. ServiceClassIDList(0x0001) ServicClass0 UUID 0x1101 == SerialPort ProtocolDescriptorList(0x0004) Protocol0 0x100 == L2CAP Protocol1 0x3 == RFCOMMM ProtocolSpecificParameter0 1 == channel # ServiceName(0x0000) String "MySerialPort" From experimenting, I gather the gatt menu uses a nested strategy. - Start with register-service - continue by adding a characteristic with register-characteristic. You can't add a characteristic unless you have a service. - If the characteristic is a list, add entries to it using register-descriptor. Again, you can't add a descriptor unless you're working on a characteristic. I tried version #Version 5.66 register-service 0x1101 #(Serial port profile) #It asks it if this a primary service, I answer yes. # Here I'm trying to start the service class ID list. register-chacteristic 0x0001 read #Ooops, it is showing SDP. # [NEW] Characteristic (Handle 0x0000) # /org/bluez/app/service0/chrc0 # 0x0001 # SDP # And it's asking for a value. What is the value for? # (2) What I'm I misunderstanding here? # Now I want to add a descriptor to the list. register-descriptor 0x1101 read # [NEW] Descriptor (Handle 0x0000) # /org/bluez/app/service0/chrc0/desc0 # 0x1101 # Serial Port # [/org/bluez/app/service0/chrc0/desc0] Enter value: # (3) Do I want to specify 0x1101 again, it was already # used in register service? # (4) And again, what is the value it is asking for. # I would then go on to add other characteristics, but there # is no point in continuing without understing better. # If this had all worked, I would do register-application # And the service would be available for other bluetooth # devices to see. (5) I also don't understand when to use acquire-write, release-write and write. Pointers to docs? (6) Are there any other steps I have to do? Do you see other glaring misconnections I have? I think bluez is quite an amazing project. Thanks