FreeBSD/usr.sbin/bluetooth/hccontrol/status.c
/* Send Reset_Failed_Contact_Counter command to the unit */
Send Reset_Failed_Contact_Counter command to the unit
Send Reset_Failed_Contact_Counter command to the unit
static int
hci_reset_failed_contact_counter(int s, int argc, char **argv)
{
	ng_hci_reset_failed_contact_cntr_cp	cp;
	ng_hci_reset_failed_contact_cntr_rp	rp;
	int					n;
	switch (argc) {
	case 1:
		if (sscanf(argv[0], "%d", &n) != 1 || n <= 0 || n > 0x0eff)
			return (USAGE);
		cp.con_handle = (uint16_t) (n & 0x0fff);
		cp.con_handle = htole16(cp.con_handle);
		break;
	default:
		return (USAGE);
	}
	n = sizeof(rp);
	if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_STATUS,
			NG_HCI_OCF_RESET_FAILED_CONTACT_CNTR),
			(char const *) &cp, sizeof(cp),
			(char *) &rp, &n) == ERROR)
		return (ERROR);
	if (rp.status != 0x00) {
		fprintf(stdout, "Status: %s [%#02x]\n", 
			hci_status2str(rp.status), rp.status);
		return (FAILED);
	}
	return (OK);
}
static int hci_reset_failed_contact_counter ( int s , int argc , char * * argv ) { ng_hci_reset_failed_contact_cntr_cp cp ; ng_hci_reset_failed_contact_cntr_rp rp ; int n ; switch ( argc ) { case 1 : if ( sscanf ( argv [ 0 ] , " " , & n ) != 1 || n <= 0 || n > 0x0eff ) return ( USAGE ) ; cp . con_handle = ( uint16_t ) ( n & 0x0fff ) ; cp . con_handle = htole16 ( cp . con_handle ) ; break ; default : return ( USAGE ) ; } n = sizeof ( rp ) ; if ( hci_request ( s , NG_HCI_OPCODE ( NG_HCI_OGF_STATUS , NG_HCI_OCF_RESET_FAILED_CONTACT_CNTR ) , ( char const * ) & cp , sizeof ( cp ) , ( char * ) & rp , & n ) == ERROR ) return ( ERROR ) ; if ( rp . status != 0x00 ) { fprintf ( stdout , " \n " , hci_status2str ( rp . status ) , rp . status ) ; return ( FAILED ) ; } return ( OK ) ; }
Send Reset_Failed_Contact_Counter command to the unit
Send Reset_Failed_Contact_Counter command to the unit
/* connection handle */ /* send command */