diff options
| -rw-r--r-- | tools/hciconfig.c | 33 | ||||
| -rw-r--r-- | tools/hcitool.c | 23 | 
2 files changed, 9 insertions, 47 deletions
| diff --git a/tools/hciconfig.c b/tools/hciconfig.c index 0e591e8d..854c8715 100644 --- a/tools/hciconfig.c +++ b/tools/hciconfig.c @@ -670,7 +670,6 @@ void cmd_version(int ctl, int hdev, char *opt)  void cmd_inq_mode(int ctl, int hdev, char *opt)  { -	struct hci_request rq;  	int dd;  	dd = hci_open_dev(hdev); @@ -679,8 +678,6 @@ void cmd_inq_mode(int ctl, int hdev, char *opt)  		exit(1);  	} -	memset(&rq, 0, sizeof(rq)); -  	if (opt) {  		uint8_t mode = atoi(opt); @@ -902,7 +899,6 @@ void cmd_page_to(int ctl, int hdev, char *opt)  void cmd_afh_mode(int ctl, int hdev, char *opt)  { -	struct hci_request rq;  	int dd;  	dd = hci_open_dev(hdev); @@ -911,44 +907,25 @@ void cmd_afh_mode(int ctl, int hdev, char *opt)  		exit(1);  	} -	memset(&rq, 0, sizeof(rq)); -  	if (opt) { -		write_afh_mode_cp cp; - -		cp.mode = atoi(opt); - -		rq.ogf = OGF_HOST_CTL; -		rq.ocf = OCF_WRITE_AFH_MODE; -		rq.cparam = &cp; -		rq.clen = WRITE_AFH_MODE_RP_SIZE; +		uint8_t mode = atoi(opt); -		if (hci_send_req(dd, &rq, 1000) < 0) { +		if (hci_write_afh_mode(dd, mode, 1000) < 0) {  			printf("Can't set AFH mode on hci%d. %s(%d)\n",  						hdev, strerror(errno), errno);  			exit(1);  		}  	} else { -		read_afh_mode_rp rp; - -		rq.ogf = OGF_HOST_CTL; -		rq.ocf = OCF_READ_AFH_MODE; -		rq.rparam = &rp; -		rq.rlen = READ_AFH_MODE_RP_SIZE; +		uint8_t mode; -		if (hci_send_req(dd, &rq, 1000) < 0) { +		if (hci_read_afh_mode(dd, &mode, 1000) < 0) {  			printf("Can't read AFH mode on hci%d. %s(%d)\n",   							hdev, strerror(errno), errno);  			exit(1);  		} -		if (rp.status) { -			printf("Read AFH mode on hci%d returned status %d\n",  -							hdev, rp.status); -			exit(1); -		}  		print_dev_hdr(&di); -		printf("\tAFH mode: %s\n", rp.mode == 1 ? "Enabled" : "Disabled"); +		printf("\tAFH mode: %s\n", mode == 1 ? "Enabled" : "Disabled");  	}  } diff --git a/tools/hcitool.c b/tools/hcitool.c index 4ecead2f..8bb68427 100644 --- a/tools/hcitool.c +++ b/tools/hcitool.c @@ -1092,10 +1092,9 @@ static char *afh_help =  static void cmd_afh(int dev_id, int argc, char **argv)  {  	struct hci_conn_info_req *cr; -	struct hci_request rq; -	read_afh_map_rp rp;  	bdaddr_t bdaddr;  	uint16_t handle; +	uint8_t mode, map[10];  	int opt, dd;  	for_each_opt(opt, afh_options, NULL) { @@ -1142,30 +1141,16 @@ static void cmd_afh(int dev_id, int argc, char **argv)  	handle = htobs(cr->conn_info->handle); -	memset(&rq, 0, sizeof(rq)); -	rq.ogf    = OGF_STATUS_PARAM; -	rq.ocf    = OCF_READ_AFH_MAP; -	rq.cparam = &handle; -	rq.clen   = 2; -	rq.rparam = &rp; -	rq.rlen   = READ_AFH_MAP_RP_SIZE; - -	if (hci_send_req(dd, &rq, 100) < 0) { +	if (hci_read_afh_map(dd, handle, &mode, map, 1000) < 0) {  		perror("HCI read AFH map request failed");  		exit(1);  	} -	if (rp.status) { -		fprintf(stderr, "HCI read_afh_map cmd failed (0x%2.2X)\n", -				rp.status); -		exit(1); -	} - -	if (rp.mode == 0x01) { +	if (mode == 0x01) {  		int i;  		printf("AFH map: 0x");  		for (i = 0; i < 10; i++) -			printf("%02x", rp.map[i]); +			printf("%02x", map[i]);  		printf("\n");  	} else  		printf("AFH disabled\n"); | 
