FreeBSD/usr.sbin/bluetooth/hccontrol/node.c
/* Send Read_Node_List command to the node */
Send Read_Node_List command to the node
Send Read_Node_List command to the node
int
hci_read_node_list(int s, int argc, char **argv)
{
	struct ng_btsocket_hci_raw_node_list_names	r;
	int						i;
	r.num_names = MAX_NODE_NUM;
	r.names = (struct nodeinfo*)calloc(MAX_NODE_NUM, sizeof(struct nodeinfo));
	if (r.names == NULL)
		return (ERROR);
	if (ioctl(s, SIOC_HCI_RAW_NODE_LIST_NAMES, &r, sizeof(r)) < 0) {
		free(r.names);
		return (ERROR);
	}
	fprintf(stdout, "Name            ID       Num hooks\n");
	for (i = 0; i < r.num_names; ++i)
		fprintf(stdout, "%-15s %08x %9d\n",
		    r.names[i].name, r.names[i].id, r.names[i].hooks);
	free(r.names);
	return (OK);
}
int hci_read_node_list ( int s , int argc , char * * argv ) { struct ng_btsocket_hci_raw_node_list_names r ; int i ; r . num_names = MAX_NODE_NUM ; r . names = ( struct nodeinfo * ) calloc ( MAX_NODE_NUM , sizeof ( struct nodeinfo ) ) ; if ( r . names == NULL ) return ( ERROR ) ; if ( ioctl ( s , SIOC_HCI_RAW_NODE_LIST_NAMES , & r , sizeof ( r ) ) < 0 ) { free ( r . names ) ; return ( ERROR ) ; } fprintf ( stdout , " \n " ) ; for ( i = 0 ; i < r . num_names ; ++ i ) fprintf ( stdout , " \n " , r . names [ i ] . name , r . names [ i ] . id , r . names [ i ] . hooks ) ; free ( r . names ) ; return ( OK ) ; }
Send Read_Node_List command to the node
Send Read_Node_List command to the node