Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp557100pxa; Fri, 31 Jul 2020 21:34:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAqzDPb1NYR/CC8aIRH76L3vSMQ/1CmzYv/0lkqW1AVpDz1OCjk8s6rjlWLCuCY8j0mcCA X-Received: by 2002:a17:906:c20f:: with SMTP id d15mr7335816ejz.117.1596256474642; Fri, 31 Jul 2020 21:34:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596256474; cv=none; d=google.com; s=arc-20160816; b=yVV/c9TCPyMxE6+JTZ5nFPkSd411tqUTFNbkw549w/Bj2t5e3/Zzh0EcisrEmJtQ8J eOic/iPA1M6XQSJaAn1wO7QneOJX3oOQislhQZtbiCYXcPpU6VPiK8UdDVFyRfOXimts Xgc1elwFjEaZpqMn752jlF1t+LpyAtkQRDXqtZDv7QRsqIIuRTXODcRh46sCzL+O9pyx ujBIGTcu5rmWDXkLiNECRQRu1HuCHf/lAxk5LFMAOxhyQRobROdwwJRJ/9sTgM0Y6tgM 1IeDjhUflwa2IPylYrOExL0nr8dsuYqVpyFy32GrnFHd8n4G91wAAGGNUeAxCGTXD3Wd vrvg== 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 :content-language:mime-version:user-agent:date:message-id:to:subject :from:dkim-signature; bh=fjgKFR7N/vEaR7BCiKQYL8ZsqyreanAVMVy0vOXTpAQ=; b=h0J+/9upt+j/nMWrvT1wqarb/BgeTJzTVn2Plim8VUmbhxI61yrP4GWNSis7pwUQAj WipWlx0ajOW2laMVwLY50ccjTR8cO42XBwuNN65B+5fCWL0hiwi8Tfo9pVadQ84iMhRo i/cZxFCaZfJNpNkzY1b5LhhzbnsoqLV7vPqCOg29XbdYpCLJIVEoaTL/u6Wrek2wtd9z MFyAGY0OBCfqCEItNbSgjdY9tW8z6AirF+tw+f5f8mZfjvjRGva244UfIFaYDzsKv9Vx qQLO6Dgo61StxBPc7zNDIaAp8WDY+tArwtvlL28Oiw8j+IbdVlMzPDye5b3FPlpuMnO1 OXww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mnmoran.org header.s=dkim header.b=ZAPChbpM; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p22si5457556eds.169.2020.07.31.21.33.46; Fri, 31 Jul 2020 21:34:34 -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=@mnmoran.org header.s=dkim header.b=ZAPChbpM; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725306AbgHAE2T (ORCPT + 99 others); Sat, 1 Aug 2020 00:28:19 -0400 Received: from hoster906.com ([192.252.156.27]:36534 "EHLO hoster906.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725280AbgHAE2S (ORCPT ); Sat, 1 Aug 2020 00:28:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=mnmoran.org; h=from :subject:to:message-id:date:mime-version:content-type :content-transfer-encoding; s=dkim; bh=RQ6muDbhi5qlTXb9qudsQrmIW aVmnVsaDonl5X/utjo=; b=ZAPChbpMiGx6hefpQ2Qy/6JX6RPdOwkOJLs07tj32 wqvZRZSqy6DMR6zZ2dh8rEX7o6v6qgqVhVk7ISiR/MMvcwNVU1he9PPeQaGaseIc 3MWeps9DvkbsXe2kWInQQR7Zhv5VYJlElC9pb34O94ZxJf4j2z83si6yPKdoMoRv 9A= Received: (qmail 30888 invoked by uid 503); 1 Aug 2020 04:28:17 -0000 Received: from unknown (HELO ?192.168.254.79?) (pop-before-smtp@162.39.210.203) by hoster906.com with ESMTPA; 1 Aug 2020 04:28:17 -0000 From: "Michael N. Moran" Subject: [PATCH BlueZ 1/1] mesh: Add strings for SIG Model IDs. To: "linux-bluetooth@vger.kernel.org" Message-ID: Date: Sat, 1 Aug 2020 00:28:12 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This patch adds a utility function returning a string describing a SIG Model ID and uses this function for in the mesh-cfgclient in the list-nodes command output and in the display of received composition data. --- tools/mesh/cfgcli.c | 3 ++- tools/mesh/remote.c | 5 ++-- tools/mesh/util.c | 64 +++++++++++++++++++++++++++++++++++++++++++++ tools/mesh/util.h | 1 + 4 files changed, 70 insertions(+), 3 deletions(-) diff --git a/tools/mesh/cfgcli.c b/tools/mesh/cfgcli.c index e36c8dca5..f6f465c6c 100644 --- a/tools/mesh/cfgcli.c +++ b/tools/mesh/cfgcli.c @@ -263,7 +263,8 @@ static uint32_t print_mod_id(uint8_t *data, bool vendor, const char *offset) if (!vendor) { mod_id = get_le16(data); - bt_shell_printf("%sModel ID\t%4.4x\n", offset, mod_id); + bt_shell_printf("%sModel ID\t%4.4x \"%s\"\n", + offset, mod_id,sig_model_string(mod_id)); mod_id = VENDOR_ID_MASK | mod_id; } else { mod_id = get_le16(data + 2); diff --git a/tools/mesh/remote.c b/tools/mesh/remote.c index c74f0bec1..ba3e50d3f 100644 --- a/tools/mesh/remote.c +++ b/tools/mesh/remote.c @@ -30,6 +30,7 @@ #include "tools/mesh/keys.h" #include "tools/mesh/mesh-db.h" #include "tools/mesh/remote.h" +#include "tools/mesh/util.h" #define abs_diff(a, b) ((a) > (b) ? (a) - (b) : (b) - (a)) @@ -293,8 +294,8 @@ static void print_model(void *model, void *user_data) if (mod_id >= VENDOR_ID_MASK) { mod_id &= ~VENDOR_ID_MASK; - bt_shell_printf("\t\t\t" COLOR_GREEN "SIG model: %4.4x\n" - COLOR_OFF, mod_id); + bt_shell_printf("\t\t\t" COLOR_GREEN "SIG model: %4.4x \"%s\"\n" + COLOR_OFF, mod_id,sig_model_string(mod_id)); return; } diff --git a/tools/mesh/util.c b/tools/mesh/util.c index 7176cc562..4603a6261 100644 --- a/tools/mesh/util.c +++ b/tools/mesh/util.c @@ -138,3 +138,67 @@ void swap_u256_bytes(uint8_t *u256) u256[i] ^= u256[31 - i]; } } + +const char* sig_model_string(uint16_t sig_model_id) +{ + switch (sig_model_id) { + case 0x0000: return "Configuration Server"; + case 0x0001: return "Configuration Client"; + case 0x0002: return "Health Server"; + case 0x0003: return "Health Client"; + case 0x1000: return "Generic OnOff Server"; + case 0x1001: return "Generic OnOff Client"; + case 0x1002: return "Generic Level Server"; + case 0x1003: return "Generic Level Client"; + case 0x1004: return "Generic Default Transition Time Server"; + case 0x1005: return "Generic Default Transition Time Client"; + case 0x1006: return "Generic Power OnOff Server"; + case 0x1007: return "Generic Power OnOff Setup Server"; + case 0x1008: return "Generic Power OnOff Client"; + case 0x1009: return "Generic Power Level Server"; + case 0x100A: return "Generic Power Level Setup Server"; + case 0x100B: return "Generic Power Level Client"; + case 0x100C: return "Generic Battery Server"; + case 0x100D: return "Generic Battery Client"; + case 0x100E: return "Generic Location Server"; + case 0x100F: return "Generic Location Setup Server"; + case 0x1010: return "Generic Location Client"; + case 0x1011: return "Generic Admin Property Server"; + case 0x1012: return "Generic Manufacturer Property Server"; + case 0x1013: return "Generic User Property Server"; + case 0x1014: return "Generic Client Property Server"; + case 0x1015: return "Generic Property Client"; + case 0x1100: return "Sensor Server"; + case 0x1101: return "Sensor Setup Server"; + case 0x1102: return "Sensor Client"; + case 0x1200: return "Time Server"; + case 0x1201: return "Time Setup Server"; + case 0x1202: return "Time Client"; + case 0x1203: return "Scene Server"; + case 0x1204: return "Scene Setup Server"; + case 0x1205: return "Scene Client"; + case 0x1206: return "Scheduler Server"; + case 0x1207: return "Scheduler Setup Server"; + case 0x1208: return "Scheduler Client"; + case 0x1300: return "Light Lightness Server"; + case 0x1301: return "Light Lightness Setup Server"; + case 0x1302: return "Light Lightness Client"; + case 0x1303: return "Light CTL Server"; + case 0x1304: return "Light CTL Setup Server"; + case 0x1305: return "Light CTL Client"; + case 0x1306: return "Light CTL Temperature Server"; + case 0x1307: return "Light HSL Server"; + case 0x1308: return "Light HSL Setup Server"; + case 0x1309: return "Light HSL Client"; + case 0x130A: return "Light HSL Hue Server"; + case 0x130B: return "Light HSL Saturation Server"; + case 0x130C: return "Light xyL Server"; + case 0x130D: return "Light xyL Setup Server"; + case 0x130E: return "Light xyL Client"; + case 0x130F: return "Light LC Server"; + case 0x1310: return "Light LC Setup Server"; + case 0x1311: return "Light LC Client"; + + default: return "Unknown"; + } +} diff --git a/tools/mesh/util.h b/tools/mesh/util.h index cca07cf96..7e966bc69 100644 --- a/tools/mesh/util.h +++ b/tools/mesh/util.h @@ -27,3 +27,4 @@ uint16_t mesh_opcode_set(uint32_t opcode, uint8_t *buf); bool mesh_opcode_get(const uint8_t *buf, uint16_t sz, uint32_t *opcode, int *n); const char *mesh_status_str(uint8_t status); void swap_u256_bytes(uint8_t *u256); +const char* sig_model_string(uint16_t sig_model_id); -- 2.26.2