V2 of CSIP client role
Subsystems (3)
v2 cover V2 of CSIP client role
Version 2 Fixed few checkpatch warnings.
Sathish Narasimman (6):
lib/uuid: Add CSIS UUIDs
main.conf: Add CSIP profile configurable options shared/csip: Add initial code for handling CSIP
profiles: Add initial code for csip plugin monitor/att: Add decoding support for CSIP
tools: Add support to generate RSI using SIRK
Makefile.am | 1 + Makefile.plugins | 5 + configure.ac | 4 + lib/uuid.h | 7 + monitor/att.c | 73 ++++++ profiles/audio/csip.c | 319 ++++++++++++++++++++++++ src/btd.h | 9 + src/main.c | 113 +++++++++ src/main.conf | 24 ++ src/shared/csip.c | 554 ++++++++++++++++++++++++++++++++++++++++++ src/shared/csip.h | 44 ++++ tools/advtest.c | 80 +++++- 12 files changed, 1231 insertions(+), 2 deletions(-) create mode 100644 profiles/audio/csip.c create mode 100644 src/shared/csip.c create mode 100644 src/shared/csip.h
Signature · 1 line
2.25.1
PATCH v2 1/6 lib/uuid: Add CSIS UUIDs
This adds Coordinated Set Identification Service UUIDs which will be used by Coordinated Set Identification Profile.
--- lib/uuid.h | 7 +++++++ 1 file changed, 7 insertions(+)
lib/uuid.h +7 -0
@@ -186,6 +186,13 @@ extern "C" {#define MEDIA_CP_OP_SUPPORTED_CHRC_UUID 0x2ba5#define MEDIA_CONTENT_CONTROL_ID_CHRC_UUID 0x2bba +/* Coordinated Set Identification Profile(CSIP) */ +#define CSIS_UUID 0x1846 +#define CS_SIRK 0x2B84 +#define CS_SIZE 0x2B85 +#define CS_LOCK 0x2B86 +#define CS_RANK 0x2B87 + typedef struct { enum { BT_UUID_UNSPEC = 0,
Signature · 1 line
2.25.1
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=697909
---Test result---
Test Summary:
CheckPatch FAIL 4.52 seconds GitLint PASS 2.28 seconds BuildEll PASS 32.57 seconds BluezMake PASS 972.94 seconds MakeCheck PASS 12.35 seconds MakeDistcheck PASS 174.27 seconds CheckValgrind PASS 284.50 seconds bluezmakeextell PASS 111.44 seconds IncrementalBuild PASS 4761.00 seconds ScanBuild WARNING 1165.50 seconds
Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[BlueZ,V2,2/6] main.conf: Add CSIP profile configurable options WARNING:STATIC_CONST_CHAR_ARRAY: static const char * array should probably be static const char * const #119: FILE: src/main.c:151:
+static const char *csip_options[] = {
/github/workspace/src/src/13051896.patch total: 0 errors, 1 warnings, 199 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
/github/workspace/src/src/13051896.patch has style problems, please review.
NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
[BlueZ,V2,3/6] shared/csip: Add initial code for handling CSIP WARNING:PREFER_DEFINED_ATTRIBUTE_MACRO: Prefer __packed over __attribute__((packed)) #668: FILE: src/shared/csip.h:16:
+#define __packed __attribute__((packed))
/github/workspace/src/src/13051897.patch total: 0 errors, 1 warnings, 605 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
/github/workspace/src/src/13051897.patch has style problems, please review.
NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
[BlueZ,V2,4/6] profiles: Add initial code for csip plugin ERROR:INITIALISED_STATIC: do not initialise statics to 0 #404: FILE: profiles/audio/csip.c:295:
+static unsigned int csip_id = 0;
/github/workspace/src/src/13051901.patch total: 1 errors, 0 warnings, 337 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
/github/workspace/src/src/13051901.patch has style problems, please review.
NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
##############################
Test: ScanBuild - WARNING
Desc: Run Scan Build
Output:tools/advtest.c:106:9: warning: The left expression of the compound assignment is an uninitialized value. The computed value will also be garbage
rsi[5] &= 0x3f; /* Clear 2 msb */
~~~~~~ ^1 warning generated.
---
Regards,
Linux Bluetooth
PATCH v2 2/6 main.conf: Add CSIP profile configurable options
In reply to Sathish NarasimmanThis introduces option to configure main.conf that can be used to configure co-ordinated set identification profile.
--- src/btd.h | 9 ++++ src/main.c | 113 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/main.conf | 24 +++++++++++ 3 files changed, 146 insertions(+)
src/btd.h +9 -0
@@ -86,6 +86,13 @@ struct btd_defaults {struct btd_le_defaults le; }; +struct btd_csis { +uint8_t sirk_type; +uint8_t sirk_val[16 ]; +uint8_t cs_size; +uint8_t cs_rank; +}; +struct btd_avdtp_opts {uint8_t session_mode;uint8_t stream_mode;
@@ -135,6 +142,8 @@ struct btd_opts {enum jw_repairing_t jw_repairing;struct btd_advmon_opts advmon; + +struct btd_csis csis_defaults; };extern struct btd_opts btd_opts;
src/main.c +113 -0
148 lines not on this page · raw message
src/main.conf +24 -0
@@ -247,6 +247,30 @@ # Default to 3 #Channels = 3 +[CSIP] +# CSIP - Co-ordinated Set Identification Profile +# SIRK Types which determines the value type for CsisSirkValue +# Possible values: +# 1 - Plain text +# 2 - encrypted +#CsisSirkType = 1 + +# CSIP - Co-ordinated Set Identification Profile +# SIRK - Set Identification resolution key which is common for all the +# sets. They SIRK key is used to identify its sets. This can be any +# 128 bit value. +# Possible Values: +# 16 byte hexadecimal value +#CsisSirkValue = 861FAE703ED681F0C50B34155B6434FB + +#CSIP - Size +#Total no of sets belongs to this Profile +#CsisSize = 1 + +#CSIP - Rank +#Rank for the device +#CsisRank = 1 + [AVDTP] # AVDTP L2CAP Signalling Channel Mode. # Possible values:
Signature · 1 line
2.25.1
PATCH v2 3/6 shared/csip: Add initial code for handling CSIP
In reply to Sathish NarasimmanThis adds initial code for Coordinated Set Identification Profile.
--- Makefile.am | 1 + src/shared/csip.c | 554 ++++++++++++++++++++++++++++++++++++++++++++++ src/shared/csip.h | 44 ++++ 3 files changed, 599 insertions(+) create mode 100644 src/shared/csip.c create mode 100644 src/shared/csip.h
Makefile.am +1 -0
@@ -233,6 +233,7 @@ shared_sources = src/shared/io.h src/shared/timeout.h \ src/shared/bap.h src/shared/bap.c src/shared/ascs.h \ src/shared/mcs.h src/shared/mcp.h src/shared/mcp.c \ src/shared/vcp.c src/shared/vcp.h \ + src/shared/csip.c src/shared/csip.h \ src/shared/lc3.h src/shared/tty.h if READLINE
src/shared/csip.c new file +554 -0
554 lines not on this page · raw message
src/shared/csip.h new file +44 -0
44 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v2 4/6 profiles: Add initial code for csip plugin
In reply to Sathish NarasimmanThis adds initial code for csip plugin which handles Coordinated set identification Profile and Coordinated Set Identification Service.
--- Makefile.plugins | 5 + configure.ac | 4 + profiles/audio/csip.c | 319 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 328 insertions(+) create mode 100644 profiles/audio/csip.c
Makefile.plugins +5 -0
@@ -131,3 +131,8 @@ if VCP builtin_modules += vcp builtin_sources += profiles/audio/vcp.c endif + +if CSIP +builtin_modules += csip +builtin_sources += profiles/audio/csip.c +endif
configure.ac +4 -0
@@ -207,6 +207,10 @@ AC_ARG_ENABLE(vcp, AS_HELP_STRING([--disable-vcp], [disable VCP profile]), [enable_vcp=${enableval}]) AM_CONDITIONAL(VCP, test "${enable_vcp}" != "no") +AC_ARG_ENABLE(csip, AS_HELP_STRING([--disable-csip], + [disable CSIP profile]), [enable_csip=${enableval}]) +AM_CONDITIONAL(CSIP, test "${enable_csip}" != "no") + AC_ARG_ENABLE(tools, AS_HELP_STRING([--disable-tools], [disable Bluetooth tools]), [enable_tools=${enableval}]) AM_CONDITIONAL(TOOLS, test "${enable_tools}" != "no")
profiles/audio/csip.c new file +319 -0
319 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v2 5/6 monitor/att: Add decoding support for CSIP
In reply to Sathish NarasimmanThis adds decoding support for CSIS attributes
--- monitor/att.c | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+)
monitor/att.c +73 -0
@@ -1733,6 +1733,73 @@ static void pac_context_notify(const struct l2cap_frame *frame)print_pac_context (frame); } +static void csip_rank_read (const struct l2cap_frame *frame) +{ +uint8_t rank; + +if (!l2cap_frame_get_u8 ((void *)frame, &rank)) { +print_text (COLOR_ERROR ,"CSIP Rank: invalid size" ); + goto done; + } +print_field (" CSIP Rank: %u" , rank); + +done: +if (frame->size) +print_hex_field (" Data" , frame->data, frame->size); +} + +static void csip_lock_read (const struct l2cap_frame *frame) +{ +uint8_t lock; + +if (!l2cap_frame_get_u8 ((void *)frame, &lock)) { +print_text (COLOR_ERROR ,"CSIP LOCK: invalid size" ); + goto done; + } +print_field (" CSIP LOCK: %u" , lock); + +done: +if (frame->size) +print_hex_field (" Data" , frame->data, frame->size); +} + +static void print_csip_size (const struct l2cap_frame *frame) +{ +uint8_t size; + +if (!l2cap_frame_get_u8 ((void *)frame, &size)) { +print_text (COLOR_ERROR ,"CSIP SIZE: invalid size" ); + goto done; + } +print_field (" CSIP SIZE: %u" , size); + +done: +if (frame->size) +print_hex_field (" Data" , frame->data, frame->size); +} + +static void csip_size_read (const struct l2cap_frame *frame) +{ +print_csip_size (frame); +} + +static void csip_size_notify (const struct l2cap_frame *frame) +{ +print_csip_size (frame); +} + +static void csip_sirk_read (const struct l2cap_frame *frame) +{ +if (frame->size) +print_hex_field (" SIRK" , frame->data, frame->size); +} + +static void csip_sirk_notify (const struct l2cap_frame *frame) +{ +if (frame->size) +print_hex_field (" SIRK" , frame->data, frame->size); +} +static void print_vcs_state (const struct l2cap_frame *frame) {uint8_t vol_set, mute, chng_ctr;
@@ -2413,6 +2480,12 @@ struct gatt_handler {GATT_HANDLER (0x2b7d , vol_state_read,NULL , vol_state_notify),GATT_HANDLER (0x2b7e ,NULL , vol_cp_write,NULL ),GATT_HANDLER (0x2b7f , vol_flag_read,NULL , vol_flag_notify), + +GATT_HANDLER (0x2b84 , csip_sirk_read,NULL , csip_sirk_notify), +GATT_HANDLER (0x2b85 , csip_size_read,NULL , csip_size_notify), +GATT_HANDLER (0x2b86 , csip_lock_read,NULL ,NULL ), +GATT_HANDLER (0x2b87 , csip_rank_read,NULL ,NULL ), +GATT_HANDLER (0x2b93 , mp_name_read,NULL , mp_name_notify),GATT_HANDLER (0x2b96 ,NULL ,NULL , track_changed_notify), GATT_HANDLER(0x2b97, track_title_read, NULL, track_title_notify),
Signature · 1 line
2.25.1
PATCH v2 6/6 tools: Add support to generate RSI using SIRK
In reply to Sathish NarasimmanThe patch helps to generate Resolvable set identifier adv data. which can be used as ADV data during advertisement.
It will be used to identify the device as part of setmember for Coordinated set identification profile.
Example:
$<path to advtest/>advtest -i "761FAE703ED681F0C50B34155B6434FB"
SIRK: 761FAE703ED681F0C50B34155B6434FB
RSI: 0x71 0xcb 0xbc 0x7e 0x01 0x84
Random: bccb71
Hash: 84017e
---
tools/advtest.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 78 insertions(+), 2 deletions(-)tools/advtest.c +78 -2
@@ -13,6 +13,13 @@#include <config.h> #endif +#include <stdlib.h> + +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <unistd.h> +#include <getopt.h> #include "lib/bluetooth.h"
@@ -32,6 +39,9 @@ "\xe1\x23\x99\xc1\xca\x9a\xc3\x31"#define SCAN_IRK "\xfa\x73\x09\x11\x3f\x03\x37\x0f" \ "\xf4\xf9\x93\x1e\xf9\xa3\x63\xa6" +#ifndef MIN +#define MIN (x, y) ((x) < (y) ? (x) : (y)) +#endif static struct mgmt *mgmt;static uint16_t index1 =MGMT_INDEX_NONE ;
@@ -43,13 +53,73 @@ static struct bt_hci *scan_dev;static void print_rpa (const uint8_t addr[6 ]) { -printf (" Address: %02x:%02x:%02x:%02x:%02x:%02x\n" , +printf (" RSI:\t0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n" , addr[5 ], addr[4 ], addr[3 ], addr[2 ], addr[1 ], addr[0 ]);printf (" Random: %02x%02x%02x\n" , addr[3 ], addr[4 ], addr[5 ]);printf (" Hash: %02x%02x%02x\n" , addr[0 ], addr[1 ], addr[2 ]); } +static size_t hex2bin (const char *hexstr,uint8_t *buf,size_t buflen) +{ +size_t i, len; + + len =MIN ((strlen (hexstr) /2 ), buflen); +memset (buf,0 , len); + +for (i =0 ; i < len; i++) +if (sscanf (hexstr + (i *2 ),"%02hhX" , &buf[i]) !=1 ) +continue ; + + +return len; +} + +static bool get_random_bytes (void *buf,size_t num_bytes) +{ +ssize_t len; +int fd; + + fd =open ("/dev/urandom" ,O_RDONLY ); +if (fd <0 ) +return false; + + len =read (fd, buf, num_bytes); + +close (fd); + +if (len <0 ) +return false; + +return true; +} + +static void generate_rsi (char *val) +{ +uint8_t sirk[16 ], hash[3 ]; +uint8_t rsi[6 ]; + +hex2bin (val, sirk,sizeof (sirk)); + +get_random_bytes (&rsi[3 ],3 ); + + rsi[5 ] &=0x3f ;/* Clear 2 msb */ + rsi[5 ] |=0x40 ;/* Set 2nd msb */ + + crypto =bt_crypto_new (); +if (!crypto) { +fprintf (stderr,"Failed to open crypto interface\n" ); +mainloop_exit_failure (); +return ; + } + +bt_crypto_ah (crypto, sirk, rsi +3 , hash); +memcpy (rsi, hash,3 ); + +print_rpa (rsi); +} + +static void scan_le_adv_report (const void *data,uint8_t size,void *user_data) {
@@ -351,9 +421,11 @@ static void usage(void)printf ("\tadvtest [options]\n" );printf ("options:\n" "\t-h, --help Show help options\n" ); +printf (" \t-i <128bit SIRK>, Generate RSI ADV Data\n" ); }static const struct option main_options[] = { + {"hash" , no_argument,NULL ,'i' }, {"version" , no_argument,NULL ,'v' }, {"help" , no_argument,NULL ,'h' }, { }
@@ -366,11 +438,15 @@ int main(int argc ,char *argv[])for (;;) {int opt; - opt =getopt_long (argc, argv,"vh" , main_options,NULL ); + opt =getopt_long (argc, argv,"i:vh" , main_options,NULL );if (opt <0 )break ;switch (opt) { +case 'i' : +printf ("SIRK: %s\n" , optarg); +generate_rsi (optarg); +return EXIT_SUCCESS ;case 'v' :printf ("%s\n" ,VERSION );return EXIT_SUCCESS ;
Signature · 1 line
2.25.1
This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:
Hello:
This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:
Quoted 11 lines · On Tue, 22 Nov 2022 08:55:24 +0530 you wrote:
Version 2 Fixed few checkpatch warnings.
Sathish Narasimman (6):
lib/uuid: Add CSIS UUIDs
main.conf: Add CSIP profile configurable options shared/csip: Add initial code for handling CSIP
profiles: Add initial code for csip plugin monitor/att: Add decoding support for CSIP
tools: Add support to generate RSI using SIRK[...]
Here is the summary with links:
- [BlueZ,V2,1/6] lib/uuid: Add CSIS UUIDs
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=b709058c6008
- [BlueZ,V2,2/6] main.conf: Add CSIP profile configurable options (no matching commit)
- [BlueZ,V2,3/6] shared/csip: Add initial code for handling CSIP (no matching commit)
- [BlueZ,V2,4/6] profiles: Add initial code for csip plugin (no matching commit)
- [BlueZ,V2,5/6] monitor/att: Add decoding support for CSIP (no matching commit)
- [BlueZ,V2,6/6] tools: Add support to generate RSI using SIRK (no matching commit)
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html