@@ -996,6 +996,33 @@ static uint8_t sdp_a2src_user(struct bt_conn *conn, struct bt_sdp_client_result
996
996
return BT_SDP_DISCOVER_UUID_CONTINUE ;
997
997
}
998
998
999
+ static uint8_t sdp_pnp_user (struct bt_conn * conn , struct bt_sdp_client_result * result ,
1000
+ const struct bt_sdp_discover_params * params )
1001
+ {
1002
+ char addr [BT_ADDR_STR_LEN ];
1003
+ uint16_t vendor_id ;
1004
+ int err ;
1005
+
1006
+ conn_addr_str (conn , addr , sizeof (addr ));
1007
+
1008
+ if ((result != NULL ) && (result -> resp_buf != NULL )) {
1009
+ bt_shell_print ("SDP PNP data@%p (len %u) hint %u from remote %s" , result -> resp_buf ,
1010
+ result -> resp_buf -> len , result -> next_record_hint , addr );
1011
+
1012
+ err = bt_sdp_get_vendor_id (result -> resp_buf , & vendor_id );
1013
+ if (err < 0 ) {
1014
+ bt_shell_error ("PNP vendor id not found, err %d" , err );
1015
+ goto done ;
1016
+ }
1017
+
1018
+ bt_shell_print ("PNP vendor id param 0x%04x" , vendor_id );
1019
+ } else {
1020
+ bt_shell_print ("No SDP PNP data from remote %s" , addr );
1021
+ }
1022
+ done :
1023
+ return BT_SDP_DISCOVER_UUID_CONTINUE ;
1024
+ }
1025
+
999
1026
static struct bt_sdp_discover_params discov_hfpag = {
1000
1027
.type = BT_SDP_DISCOVER_SERVICE_SEARCH_ATTR ,
1001
1028
.uuid = BT_UUID_DECLARE_16 (BT_SDP_HANDSFREE_AGW_SVCLASS ),
@@ -1017,6 +1044,13 @@ static struct bt_sdp_discover_params discov_a2src = {
1017
1044
.pool = & sdp_client_pool ,
1018
1045
};
1019
1046
1047
+ static struct bt_sdp_discover_params discov_pnp = {
1048
+ .type = BT_SDP_DISCOVER_SERVICE_SEARCH_ATTR ,
1049
+ .uuid = BT_UUID_DECLARE_16 (BT_SDP_PNP_INFO_SVCLASS ),
1050
+ .func = sdp_pnp_user ,
1051
+ .pool = & sdp_client_pool ,
1052
+ };
1053
+
1020
1054
static struct bt_sdp_discover_params discov ;
1021
1055
1022
1056
static int cmd_sdp_find_record (const struct shell * sh , size_t argc , char * argv [])
@@ -1037,6 +1071,8 @@ static int cmd_sdp_find_record(const struct shell *sh, size_t argc, char *argv[]
1037
1071
discov = discov_hfphf ;
1038
1072
} else if (!strcmp (action , "A2SRC" )) {
1039
1073
discov = discov_a2src ;
1074
+ } else if (!strcmp (action , "PNP" )) {
1075
+ discov = discov_pnp ;
1040
1076
} else {
1041
1077
shell_help (sh );
1042
1078
return SHELL_CMD_HELP_PRINTED ;
@@ -1446,7 +1482,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(br_cmds,
1446
1482
SHELL_CMD (l2cap , & l2cap_cmds , HELP_NONE , cmd_default_handler ),
1447
1483
SHELL_CMD_ARG (oob , NULL , NULL , cmd_oob , 1 , 0 ),
1448
1484
SHELL_CMD_ARG (pscan , NULL , "<value: on, off>" , cmd_connectable , 2 , 0 ),
1449
- SHELL_CMD_ARG (sdp - find , NULL , "<HFPAG, HFPHF>" , cmd_sdp_find_record , 2 , 0 ),
1485
+ SHELL_CMD_ARG (sdp - find , NULL , "<HFPAG, HFPHF, PNP >" , cmd_sdp_find_record , 2 , 0 ),
1450
1486
SHELL_CMD_ARG (switch - role , NULL , "<value: central, peripheral>" , cmd_switch_role , 2 , 0 ),
1451
1487
SHELL_CMD_ARG (set - role - switchable , NULL , "<value: enable, disable>" ,
1452
1488
cmd_set_role_switchable , 2 , 0 ),
0 commit comments