summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--hcid/device.c32
-rw-r--r--hcid/kword.c1
-rw-r--r--hcid/main.c24
-rw-r--r--hcid/parser.y7
4 files changed, 33 insertions, 31 deletions
diff --git a/hcid/device.c b/hcid/device.c
index b67f87a7..987fa0c0 100644
--- a/hcid/device.c
+++ b/hcid/device.c
@@ -131,10 +131,26 @@ int remove_device(uint16_t dev_id)
return 0;
}
+static inline uint8_t get_inquiry_mode(struct hci_dev *dev)
+{
+ if (dev->manufacturer == 15 &&
+ dev->hci_rev == 0x09 && dev->lmp_subver == 0x6963)
+ return 1;
+
+ if (dev->features[6] & LMP_EXT_INQ)
+ return 2;
+
+ if (dev->features[3] & LMP_RSSI_INQ)
+ return 1;
+
+ return 0;
+}
+
int start_device(uint16_t dev_id)
{
struct hci_dev *dev;
struct hci_version ver;
+ uint8_t features[8], inqmode;
int dd;
ASSERT_DEV_ID;
@@ -159,6 +175,22 @@ int start_device(uint16_t dev_id)
dev->lmp_subver = ver.lmp_subver;
dev->manufacturer = ver.manufacturer;
+ if (hci_read_local_features(dd, features, 1000) < 0) {
+ error("Can't read features for hci%d: %s (%d)",
+ dev_id, strerror(errno), errno);
+ return -errno;
+ }
+
+ memcpy(dev->features, features, 8);
+
+ inqmode = get_inquiry_mode(dev);
+
+ if (hci_write_inquiry_mode(dd, inqmode, 1000) < 0) {
+ error("Can't write inquiry mode for hci%d: %s (%d)",
+ dev_id, strerror(errno), errno);
+ return -errno;
+ }
+
hci_close_dev(dd);
info("Device hci%d has been activated", dev_id);
diff --git a/hcid/kword.c b/hcid/kword.c
index 62a946fe..efe4cd13 100644
--- a/hcid/kword.c
+++ b/hcid/kword.c
@@ -56,7 +56,6 @@ struct kword cfg_keyword[] = {
{ "name", K_NAME },
{ "class", K_CLASS },
{ "voice", K_VOICE },
- { "inqmode", K_INQMODE },
{ "pageto", K_PAGETO },
{ "discovto", K_DISCOVTO },
{ "auth", K_AUTH },
diff --git a/hcid/main.c b/hcid/main.c
index 757d436f..5228f479 100644
--- a/hcid/main.c
+++ b/hcid/main.c
@@ -389,30 +389,6 @@ static void configure_device(int hdev)
WRITE_VOICE_SETTING_CP_SIZE, &cp);
}
- /* Set inquiry mode */
- if ((device_opts->flags & (1 << HCID_SET_INQMODE))) {
- write_inquiry_mode_cp cp;
-
- switch (device_opts->inqmode) {
- case 2:
- if (di.features[6] & LMP_EXT_INQ) {
- cp.mode = 2;
- break;
- }
- case 1:
- if (di.features[3] & LMP_RSSI_INQ) {
- cp.mode = 1;
- break;
- }
- default:
- cp.mode = 0;
- break;
- }
-
- hci_send_cmd(s, OGF_HOST_CTL, OCF_WRITE_INQUIRY_MODE,
- WRITE_INQUIRY_MODE_CP_SIZE, &cp);
- }
-
/* Set page timeout */
if ((device_opts->flags & (1 << HCID_SET_PAGETO))) {
write_page_timeout_cp cp;
diff --git a/hcid/parser.y b/hcid/parser.y
index 9d33e448..b13fbb13 100644
--- a/hcid/parser.y
+++ b/hcid/parser.y
@@ -59,7 +59,7 @@ int yyerror(char *s);
%token K_OPTIONS K_DEVICE
%token K_AUTOINIT K_SECURITY K_PAIRING
-%token K_PTYPE K_NAME K_CLASS K_VOICE K_INQMODE K_PAGETO K_LM K_LP K_AUTH K_ENCRYPT K_ISCAN K_PSCAN K_DISCOVTO
+%token K_PTYPE K_NAME K_CLASS K_VOICE K_PAGETO K_LM K_LP K_AUTH K_ENCRYPT K_ISCAN K_PSCAN K_DISCOVTO
%token K_PASSKEY
%token K_YES K_NO
@@ -189,11 +189,6 @@ device_opt:
parser_device->voice = $2;
}
- | K_INQMODE NUM {
- parser_device->flags |= (1 << HCID_SET_INQMODE);
- parser_device->inqmode = $2;
- }
-
| K_PAGETO NUM {
parser_device->flags |= (1 << HCID_SET_PAGETO);
parser_device->pageto = $2;