Add support for inquiry scan type

This commit is contained in:
Marcel Holtmann 2005-06-16 14:02:56 +00:00
parent adb76ec0bc
commit f31fbabd2a
2 changed files with 41 additions and 0 deletions

View File

@ -133,6 +133,12 @@ With no
prints out the current inquiry mode. Otherwise, sets inquiry mode to
.IR mode .
.TP
.BI inqtype " [type]"
With no
.IR type ,
prints out the current inquiry scan type. Otherwise, sets inquiry scan type to
.IR type .
.TP
.BI inqparms " [win:int]"
With no
.IR win:int ,

View File

@ -881,6 +881,40 @@ static void cmd_inq_mode(int ctl, int hdev, char *opt)
}
}
static void cmd_inq_type(int ctl, int hdev, char *opt)
{
int dd;
dd = hci_open_dev(hdev);
if (dd < 0) {
fprintf(stderr, "Can't open device hci%d: %s (%d)\n",
hdev, strerror(errno), errno);
exit(1);
}
if (opt) {
uint8_t type = atoi(opt);
if (hci_write_inquiry_scan_type(dd, type, 2000) < 0) {
fprintf(stderr, "Can't set inquiry scan type on hci%d: %s (%d)\n",
hdev, strerror(errno), errno);
exit(1);
}
} else {
uint8_t type;
if (hci_read_inquiry_scan_type(dd, &type, 1000) < 0) {
fprintf(stderr, "Can't read inquiry scan type on hci%d: %s (%d)\n",
hdev, strerror(errno), errno);
exit(1);
}
print_dev_hdr(&di);
printf("\tInquiry scan type: %s\n",
type == 1 ? "Interlaced Inquiry Scan" : "Standard Inquiry Scan");
}
}
static void cmd_inq_parms(int ctl, int hdev, char *opt)
{
struct hci_request rq;
@ -1325,6 +1359,7 @@ static struct {
{ "voice", cmd_voice, "[voice]", "Get/Set voice setting" },
{ "iac", cmd_iac, "[iac]", "Get/Set inquiry access code" },
{ "inqmode", cmd_inq_mode, "[mode]", "Get/set inquiry mode" },
{ "inqtype", cmd_inq_type, "[type]", "Get/set inquiry scan type" },
{ "inqparms", cmd_inq_parms, "[win:int]", "Get/Set inquiry scan window and interval" },
{ "pageparms", cmd_page_parms, "[win:int]", "Get/Set page scan window and interval" },
{ "pageto", cmd_page_to, "[to]", "Get/Set page timeout" },