Add length argument on hciops start discovery function

For BR/EDR only adapters, the recommended inquiry length is 0x08
(10.24 seconds). For interleave discovery the inquiry length is
0x04(5.12 seconds).
This commit is contained in:
Claudio Takahasi 2010-09-01 15:28:58 -03:00
parent 980dc45cc2
commit 388cdea438
3 changed files with 8 additions and 6 deletions

View File

@ -561,7 +561,7 @@ fail:
return err; return err;
} }
static int hciops_start_discovery(int index, gboolean periodic) static int hciops_start_discovery(int index, uint8_t length, gboolean periodic)
{ {
uint8_t lap[3] = { 0x33, 0x8b, 0x9e }; uint8_t lap[3] = { 0x33, 0x8b, 0x9e };
int dd, err; int dd, err;
@ -577,7 +577,7 @@ static int hciops_start_discovery(int index, gboolean periodic)
memcpy(&cp.lap, lap, 3); memcpy(&cp.lap, lap, 3);
cp.max_period = htobs(24); cp.max_period = htobs(24);
cp.min_period = htobs(16); cp.min_period = htobs(16);
cp.length = 0x04; cp.length = length;
cp.num_rsp = 0x00; cp.num_rsp = 0x00;
err = hci_send_cmd(dd, OGF_LINK_CTL, OCF_PERIODIC_INQUIRY, err = hci_send_cmd(dd, OGF_LINK_CTL, OCF_PERIODIC_INQUIRY,
@ -587,7 +587,7 @@ static int hciops_start_discovery(int index, gboolean periodic)
memset(&inq_cp, 0, sizeof(inq_cp)); memset(&inq_cp, 0, sizeof(inq_cp));
memcpy(&inq_cp.lap, lap, 3); memcpy(&inq_cp.lap, lap, 3);
inq_cp.length = 0x04; inq_cp.length = length;
inq_cp.num_rsp = 0x00; inq_cp.num_rsp = 0x00;
err = hci_send_cmd(dd, OGF_LINK_CTL, OCF_INQUIRY, err = hci_send_cmd(dd, OGF_LINK_CTL, OCF_INQUIRY,

View File

@ -1284,14 +1284,16 @@ static int start_discovery(struct btd_adapter *adapter)
/* BR/EDR only? */ /* BR/EDR only? */
if (le_capable(adapter) == FALSE) if (le_capable(adapter) == FALSE)
return adapter_ops->start_discovery(adapter->dev_id, periodic); return adapter_ops->start_discovery(adapter->dev_id,
0x08, periodic);
/* Dual mode or LE only */ /* Dual mode or LE only */
if (bredr_capable(adapter) == FALSE) { if (bredr_capable(adapter) == FALSE) {
err = adapter_ops->start_scanning(adapter->dev_id); err = adapter_ops->start_scanning(adapter->dev_id);
stop = stop_scanning; stop = stop_scanning;
} else { } else {
err = adapter_ops->start_discovery(adapter->dev_id, FALSE); err = adapter_ops->start_discovery(adapter->dev_id,
0x04, FALSE);
stop = stop_inquiry; stop = stop_inquiry;
} }

View File

@ -185,7 +185,7 @@ struct btd_adapter_ops {
int (*set_discoverable) (int index); int (*set_discoverable) (int index);
int (*set_limited_discoverable) (int index, uint32_t class, int (*set_limited_discoverable) (int index, uint32_t class,
gboolean limited); gboolean limited);
int (*start_discovery) (int index, gboolean periodic); int (*start_discovery) (int index, uint8_t length, gboolean periodic);
int (*stop_discovery) (int index); int (*stop_discovery) (int index);
int (*start_scanning) (int index); int (*start_scanning) (int index);
int (*stop_scanning) (int index); int (*stop_scanning) (int index);