From: Alok Barsode <[email protected]>
---
src/adapter.c | 10 ++--------
1 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/src/adapter.c b/src/adapter.c
index a54078c..2efdbc8 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -416,14 +416,8 @@ static int set_mode(struct btd_adapter *adapter, uint8_t new_mode)
return -EIO;
if (adapter->up && scan_enable == SCAN_DISABLED) {
- struct hci_request rq = {
- .ogf = OGF_HOST_CTL,
- .ocf = OCF_WRITE_SCAN_ENABLE,
- .cparam = &scan_enable,
- .clen = sizeof(scan_enable),
- };
-
- hci_send_req(dd, &rq, HCI_REQ_TIMEOUT);
+ hci_send_cmd(dd, OGF_HOST_CTL, OCF_WRITE_SCAN_ENABLE,
+ 1, &scan_enable);
hci_close_dev(dd);
err = adapter_ops->stop(adapter->dev_id);
--
1.5.6.3
From: Alok Barsode <[email protected]>
---
src/adapter.c | 45 ++++++++++++++-------------------------------
1 files changed, 14 insertions(+), 31 deletions(-)
diff --git a/src/adapter.c b/src/adapter.c
index 87ecaff..c1a81b4 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -328,38 +328,18 @@ static void adapter_set_discov_timeout(struct btd_adapter *adapter,
adapter);
}
-static uint8_t mode2scan(uint8_t mode)
-{
- switch (mode) {
- case MODE_OFF:
- return SCAN_DISABLED;
- case MODE_CONNECTABLE:
- return SCAN_PAGE;
- case MODE_DISCOVERABLE:
- case MODE_LIMITED:
- return (SCAN_PAGE | SCAN_INQUIRY);
- default:
- error("Invalid mode given to mode2scan: %u", mode);
- return SCAN_PAGE;
- }
-}
-
static int set_mode(struct btd_adapter *adapter, uint8_t new_mode)
{
- uint8_t scan_enable;
- uint8_t current_scan = adapter->scan_mode;
int err;
const char *modestr;
- scan_enable = mode2scan(new_mode);
-
- if (!adapter->up && scan_enable != SCAN_DISABLED) {
+ if (!adapter->up && new_mode != MODE_OFF) {
err = adapter_ops->set_powered(adapter->dev_id, TRUE);
if (err < 0)
return err;
}
- if (adapter->up && scan_enable == SCAN_DISABLED) {
+ if (adapter->up && new_mode == MODE_OFF) {
err = adapter_ops->set_powered(adapter->dev_id, FALSE);
if (err < 0)
return err;
@@ -369,17 +349,20 @@ static int set_mode(struct btd_adapter *adapter, uint8_t new_mode)
goto done;
}
- if (current_scan != scan_enable) {
- if (scan_enable == SCAN_PAGE)
- err = adapter_ops->set_connectable(adapter->dev_id);
- else
- err = adapter_ops->set_discoverable(adapter->dev_id);
+ if (new_mode == adapter->mode)
+ return 0;
- if (err < 0)
- return err;
- } else if ((scan_enable & SCAN_INQUIRY) &&
- (new_mode != adapter->mode)) {
+ if (new_mode == MODE_CONNECTABLE)
+ err = adapter_ops->set_connectable(adapter->dev_id);
+ else
+ err = adapter_ops->set_discoverable(adapter->dev_id);
+
+ if (err < 0)
+ return err;
+
+ if (new_mode > MODE_CONNECTABLE) {
adapter_remove_discov_timeout(adapter);
+
if (adapter->discov_timeout)
adapter_set_discov_timeout(adapter,
adapter->discov_timeout);
--
1.5.6.3
From: Alok Barsode <[email protected]>
---
plugins/hciops.c | 46 ++++++++++++++++++++++++++++++++++++
src/adapter.c | 69 +++++++----------------------------------------------
src/adapter.h | 2 +
3 files changed, 57 insertions(+), 60 deletions(-)
diff --git a/plugins/hciops.c b/plugins/hciops.c
index 184ed9c..8f9ee06 100644
--- a/plugins/hciops.c
+++ b/plugins/hciops.c
@@ -516,6 +516,51 @@ static int hciops_discoverable(int index)
return 0;
}
+static int hciops_set_limited_discoverable(int index, const uint8_t *cls,
+ gboolean limited)
+{
+ int dd, err = 0;
+ uint32_t dev_class;
+ int num = (limited ? 2 : 1);
+ uint8_t lap[] = { 0x33, 0x8b, 0x9e, 0x00, 0x8b, 0x9e };
+ /*
+ * 1: giac
+ * 2: giac + liac
+ */
+ dd = hci_open_dev(index);
+ if (dd < 0)
+ return -EIO;
+
+ if (hci_write_current_iac_lap(dd, num, lap, HCI_REQ_TIMEOUT) < 0) {
+ err = -errno;
+ error("Can't write current IAC LAP: %s(%d)",
+ strerror(errno), errno);
+ goto done;
+ }
+
+ if (limited) {
+ if (cls[1] & 0x20)
+ goto done; /* Already limited */
+
+ dev_class = (cls[2] << 16) | ((cls[1] | 0x20) << 8) | cls[0];
+ } else {
+ if (!(cls[1] & 0x20))
+ goto done; /* Already clear */
+
+ dev_class = (cls[2] << 16) | ((cls[1] & 0xdf) << 8) | cls[0];
+ }
+
+ if (hci_write_class_of_dev(dd, dev_class, HCI_REQ_TIMEOUT) < 0) {
+ err = -errno;
+ error("Can't write class of device: %s (%d)",
+ strerror(errno), errno);
+ goto done;
+ }
+done:
+ hci_close_dev(dd);
+ return err;
+}
+
static struct btd_adapter_ops hci_ops = {
.setup = hciops_setup,
.cleanup = hciops_cleanup,
@@ -524,6 +569,7 @@ static struct btd_adapter_ops hci_ops = {
.set_powered = hciops_powered,
.set_connectable = hciops_connectable,
.set_discoverable = hciops_discoverable,
+ .set_limited_discoverable = hciops_set_limited_discoverable,
};
static int hciops_init(void)
diff --git a/src/adapter.c b/src/adapter.c
index 73e6d80..87ecaff 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -252,45 +252,6 @@ int pending_remote_name_cancel(struct btd_adapter *adapter)
return err;
}
-static int set_limited_discoverable(int dd, const uint8_t *cls,
- gboolean limited)
-{
- uint32_t dev_class;
- int num = (limited ? 2 : 1);
- uint8_t lap[] = { 0x33, 0x8b, 0x9e, 0x00, 0x8b, 0x9e };
- /*
- * 1: giac
- * 2: giac + liac
- */
- if (hci_write_current_iac_lap(dd, num, lap, HCI_REQ_TIMEOUT) < 0) {
- int err = -errno;
- error("Can't write current IAC LAP: %s(%d)",
- strerror(errno), errno);
- return err;
- }
-
- if (limited) {
- if (cls[1] & 0x20)
- return 0; /* Already limited */
-
- dev_class = (cls[2] << 16) | ((cls[1] | 0x20) << 8) | cls[0];
- } else {
- if (!(cls[1] & 0x20))
- return 0; /* Already clear */
-
- dev_class = (cls[2] << 16) | ((cls[1] & 0xdf) << 8) | cls[0];
- }
-
- if (hci_write_class_of_dev(dd, dev_class, HCI_REQ_TIMEOUT) < 0) {
- int err = -errno;
- error("Can't write class of device: %s (%d)",
- strerror(errno), errno);
- return err;
- }
-
- return 0;
-}
-
static const char *mode2str(uint8_t mode)
{
switch(mode) {
@@ -387,7 +348,7 @@ static int set_mode(struct btd_adapter *adapter, uint8_t new_mode)
{
uint8_t scan_enable;
uint8_t current_scan = adapter->scan_mode;
- int err, dd;
+ int err;
const char *modestr;
scan_enable = mode2scan(new_mode);
@@ -423,17 +384,12 @@ static int set_mode(struct btd_adapter *adapter, uint8_t new_mode)
adapter_set_discov_timeout(adapter,
adapter->discov_timeout);
- dd = hci_open_dev(adapter->dev_id);
- if (dd < 0)
- return -EIO;
-
if (new_mode == MODE_LIMITED)
- set_limited_discoverable(dd, adapter->dev.class,
- TRUE);
+ adapter_ops->set_limited_discoverable(adapter->dev_id,
+ adapter->dev.class, TRUE);
else if (adapter->mode == MODE_LIMITED)
- set_limited_discoverable(dd, adapter->dev.class,
- FALSE);
- hci_close_dev(dd);
+ adapter_ops->set_limited_discoverable(adapter->dev_id,
+ adapter->dev.class, FALSE);
}
done:
modestr = mode2str(new_mode);
@@ -2724,7 +2680,6 @@ void adapter_mode_changed(struct btd_adapter *adapter, uint8_t scan_mode)
const gchar *path = adapter_get_path(adapter);
gboolean discoverable, pairable;
uint8_t real_class[3];
- int dd;
if (adapter->scan_mode == scan_mode)
return;
@@ -2769,23 +2724,17 @@ void adapter_mode_changed(struct btd_adapter *adapter, uint8_t scan_mode)
ADAPTER_INTERFACE, "Pairable",
DBUS_TYPE_BOOLEAN, &pairable);
- dd = hci_open_dev(adapter->dev_id);
- if (dd < 0) {
- error("HCI device open failed: hci%d", adapter->dev_id);
- goto done;
- }
-
memcpy(real_class, adapter->dev.class, 3);
if (adapter->svc_cache)
real_class[2] = adapter->svc_cache;
if (discoverable && adapter->pairable)
- set_limited_discoverable(dd, real_class, TRUE);
+ adapter_ops->set_limited_discoverable(adapter->dev_id,
+ real_class, TRUE);
else if (!discoverable)
- set_limited_discoverable(dd, real_class, FALSE);
+ adapter_ops->set_limited_discoverable(adapter->dev_id,
+ real_class, FALSE);
- hci_close_dev(dd);
-done:
emit_property_changed(connection, path,
ADAPTER_INTERFACE, "Discoverable",
DBUS_TYPE_BOOLEAN, &discoverable);
diff --git a/src/adapter.h b/src/adapter.h
index bfd2826..a94edc6 100644
--- a/src/adapter.h
+++ b/src/adapter.h
@@ -155,6 +155,8 @@ struct btd_adapter_ops {
int (*set_powered) (int index, gboolean powered);
int (*set_connectable) (int index);
int (*set_discoverable) (int index);
+ int (*set_limited_discoverable) (int index, const uint8_t *cls,
+ gboolean limited);
};
int btd_register_adapter_ops(struct btd_adapter_ops *btd_adapter_ops);
--
1.5.6.3
From: Alok Barsode <[email protected]>
---
src/adapter.c | 19 ++++++++++---------
1 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/src/adapter.c b/src/adapter.c
index cd18412..73e6d80 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -1935,11 +1935,15 @@ static void load_drivers(struct btd_adapter *adapter)
}
}
-static void load_connections(struct btd_adapter *adapter, int dd)
+static void load_connections(struct btd_adapter *adapter)
{
struct hci_conn_list_req *cl = NULL;
struct hci_conn_info *ci;
- int i;
+ int i, dd;
+
+ dd = hci_open_dev(adapter->dev_id);
+ if (dd < 0)
+ return;
cl = g_malloc0(10 * sizeof(*ci) + sizeof(*cl));
@@ -1949,6 +1953,7 @@ static void load_connections(struct btd_adapter *adapter, int dd)
if (ioctl(dd, HCIGETCONNLIST, cl) != 0) {
g_free(cl);
+ hci_close_dev(dd);
return;
}
@@ -1963,6 +1968,7 @@ static void load_connections(struct btd_adapter *adapter, int dd)
}
g_free(cl);
+ hci_close_dev(dd);
}
static int get_discoverable_timeout(const char *src)
@@ -1990,7 +1996,7 @@ static int adapter_up(struct btd_adapter *adapter)
char mode[14], srcaddr[18];
uint8_t scan_mode;
gboolean powered, dev_down = FALSE;
- int dd, err;
+ int err;
ba2str(&adapter->bdaddr, srcaddr);
@@ -2055,19 +2061,14 @@ proceed:
load_drivers(adapter);
load_devices(adapter);
- dd = hci_open_dev(adapter->dev_id);
- if (dd < 0)
- return -EIO;
-
/* retrieve the active connections: address the scenario where
* the are active connections before the daemon've started */
- load_connections(adapter, dd);
+ load_connections(adapter);
adapter->initialized = TRUE;
manager_add_adapter(adapter->path);
- hci_close_dev(dd);
}
if (adapter->svc_cache)
--
1.5.6.3
From: Alok Barsode <[email protected]>
---
plugins/hciops.c | 18 ++++++++++++++++++
src/adapter.c | 46 +++++++++++++++++++---------------------------
src/adapter.h | 1 +
3 files changed, 38 insertions(+), 27 deletions(-)
diff --git a/plugins/hciops.c b/plugins/hciops.c
index 15084e4..184ed9c 100644
--- a/plugins/hciops.c
+++ b/plugins/hciops.c
@@ -499,6 +499,23 @@ static int hciops_connectable(int index)
return 0;
}
+static int hciops_discoverable(int index)
+{
+ int dd;
+ uint8_t mode = (SCAN_PAGE | SCAN_INQUIRY);
+
+ dd = hci_open_dev(index);
+ if (dd < 0)
+ return -EIO;
+
+ hci_send_cmd(dd, OGF_HOST_CTL, OCF_WRITE_SCAN_ENABLE,
+ 1, &mode);
+
+ hci_close_dev(dd);
+
+ return 0;
+}
+
static struct btd_adapter_ops hci_ops = {
.setup = hciops_setup,
.cleanup = hciops_cleanup,
@@ -506,6 +523,7 @@ static struct btd_adapter_ops hci_ops = {
.stop = hciops_stop,
.set_powered = hciops_powered,
.set_connectable = hciops_connectable,
+ .set_discoverable = hciops_discoverable,
};
static int hciops_init(void)
diff --git a/src/adapter.c b/src/adapter.c
index 121694d..cd18412 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -409,24 +409,13 @@ static int set_mode(struct btd_adapter *adapter, uint8_t new_mode)
}
if (current_scan != scan_enable) {
- if (scan_enable == SCAN_PAGE) {
+ if (scan_enable == SCAN_PAGE)
err = adapter_ops->set_connectable(adapter->dev_id);
- if (err < 0)
- return err;
- } else {
- dd = hci_open_dev(adapter->dev_id);
- if (dd < 0)
- return -EIO;
-
- err = hci_send_cmd(dd, OGF_HOST_CTL, OCF_WRITE_SCAN_ENABLE,
- 1, &scan_enable);
- if (err < 0) {
- hci_close_dev(dd);
- return err;
- }
-
- hci_close_dev(dd);
- }
+ else
+ err = adapter_ops->set_discoverable(adapter->dev_id);
+
+ if (err < 0)
+ return err;
} else if ((scan_enable & SCAN_INQUIRY) &&
(new_mode != adapter->mode)) {
adapter_remove_discov_timeout(adapter);
@@ -2001,7 +1990,7 @@ static int adapter_up(struct btd_adapter *adapter)
char mode[14], srcaddr[18];
uint8_t scan_mode;
gboolean powered, dev_down = FALSE;
- int dd;
+ int dd, err;
ba2str(&adapter->bdaddr, srcaddr);
@@ -2054,19 +2043,22 @@ static int adapter_up(struct btd_adapter *adapter)
}
proceed:
- dd = hci_open_dev(adapter->dev_id);
-
- if (dd < 0)
- return -EIO;
+ if (scan_mode == SCAN_PAGE)
+ err = adapter_ops->set_connectable(adapter->dev_id);
+ else
+ err = adapter_ops->set_discoverable(adapter->dev_id);
- if (dev_down == FALSE)
- hci_send_cmd(dd, OGF_HOST_CTL, OCF_WRITE_SCAN_ENABLE,
- 1, &scan_mode);
+ if (err < 0)
+ return err;
if (adapter->initialized == FALSE) {
load_drivers(adapter);
load_devices(adapter);
+ dd = hci_open_dev(adapter->dev_id);
+ if (dd < 0)
+ return -EIO;
+
/* retrieve the active connections: address the scenario where
* the are active connections before the daemon've started */
load_connections(adapter, dd);
@@ -2074,6 +2066,8 @@ proceed:
adapter->initialized = TRUE;
manager_add_adapter(adapter->path);
+
+ hci_close_dev(dd);
}
if (adapter->svc_cache)
@@ -2088,8 +2082,6 @@ proceed:
ADAPTER_INTERFACE, "Powered",
DBUS_TYPE_BOOLEAN, &powered);
- hci_close_dev(dd);
-
return 0;
}
diff --git a/src/adapter.h b/src/adapter.h
index 0bfad8a..bfd2826 100644
--- a/src/adapter.h
+++ b/src/adapter.h
@@ -154,6 +154,7 @@ struct btd_adapter_ops {
int (*stop) (int index);
int (*set_powered) (int index, gboolean powered);
int (*set_connectable) (int index);
+ int (*set_discoverable) (int index);
};
int btd_register_adapter_ops(struct btd_adapter_ops *btd_adapter_ops);
--
1.5.6.3
From: Alok Barsode <[email protected]>
---
plugins/hciops.c | 18 ++++++++++++++++++
src/adapter.c | 42 +++++++++++++++++++++---------------------
src/adapter.h | 1 +
3 files changed, 40 insertions(+), 21 deletions(-)
diff --git a/plugins/hciops.c b/plugins/hciops.c
index 1e54c09..15084e4 100644
--- a/plugins/hciops.c
+++ b/plugins/hciops.c
@@ -482,12 +482,30 @@ static int hciops_powered(int index, gboolean powered)
return hciops_stop(index);
}
+static int hciops_connectable(int index)
+{
+ int dd;
+ uint8_t mode = SCAN_PAGE;
+
+ dd = hci_open_dev(index);
+ if (dd < 0)
+ return -EIO;
+
+ hci_send_cmd(dd, OGF_HOST_CTL, OCF_WRITE_SCAN_ENABLE,
+ 1, &mode);
+
+ hci_close_dev(dd);
+
+ return 0;
+}
+
static struct btd_adapter_ops hci_ops = {
.setup = hciops_setup,
.cleanup = hciops_cleanup,
.start = hciops_start,
.stop = hciops_stop,
.set_powered = hciops_powered,
+ .set_connectable = hciops_connectable,
};
static int hciops_init(void)
diff --git a/src/adapter.c b/src/adapter.c
index 5b3b0aa..121694d 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -343,23 +343,10 @@ static void adapter_remove_discov_timeout(struct btd_adapter *adapter)
static gboolean discov_timeout_handler(gpointer user_data)
{
struct btd_adapter *adapter = user_data;
- int dd;
- uint8_t scan_enable;
- uint16_t dev_id = adapter->dev_id;
adapter->discov_timeout_id = 0;
- dd = hci_open_dev(dev_id);
- if (dd < 0) {
- error("HCI device open failed: hci%d", dev_id);
- return FALSE;
- }
-
- scan_enable = adapter->scan_mode & ~SCAN_INQUIRY;
-
- hci_send_cmd(dd, OGF_HOST_CTL, OCF_WRITE_SCAN_ENABLE,
- 1, &scan_enable);
- hci_close_dev(dd);
+ adapter_ops->set_connectable(adapter->dev_id);
return FALSE;
}
@@ -421,16 +408,24 @@ static int set_mode(struct btd_adapter *adapter, uint8_t new_mode)
goto done;
}
- dd = hci_open_dev(adapter->dev_id);
- if (dd < 0)
- return -EIO;
-
if (current_scan != scan_enable) {
- err = hci_send_cmd(dd, OGF_HOST_CTL, OCF_WRITE_SCAN_ENABLE,
+ if (scan_enable == SCAN_PAGE) {
+ err = adapter_ops->set_connectable(adapter->dev_id);
+ if (err < 0)
+ return err;
+ } else {
+ dd = hci_open_dev(adapter->dev_id);
+ if (dd < 0)
+ return -EIO;
+
+ err = hci_send_cmd(dd, OGF_HOST_CTL, OCF_WRITE_SCAN_ENABLE,
1, &scan_enable);
- if (err < 0) {
+ if (err < 0) {
+ hci_close_dev(dd);
+ return err;
+ }
+
hci_close_dev(dd);
- return err;
}
} else if ((scan_enable & SCAN_INQUIRY) &&
(new_mode != adapter->mode)) {
@@ -438,6 +433,11 @@ static int set_mode(struct btd_adapter *adapter, uint8_t new_mode)
if (adapter->discov_timeout)
adapter_set_discov_timeout(adapter,
adapter->discov_timeout);
+
+ dd = hci_open_dev(adapter->dev_id);
+ if (dd < 0)
+ return -EIO;
+
if (new_mode == MODE_LIMITED)
set_limited_discoverable(dd, adapter->dev.class,
TRUE);
diff --git a/src/adapter.h b/src/adapter.h
index 5c292fb..0bfad8a 100644
--- a/src/adapter.h
+++ b/src/adapter.h
@@ -153,6 +153,7 @@ struct btd_adapter_ops {
int (*start) (int index);
int (*stop) (int index);
int (*set_powered) (int index, gboolean powered);
+ int (*set_connectable) (int index);
};
int btd_register_adapter_ops(struct btd_adapter_ops *btd_adapter_ops);
--
1.5.6.3
From: Alok Barsode <[email protected]>
---
plugins/hciops.c | 21 +++++++++++++++++++++
src/adapter.c | 15 +++------------
src/adapter.h | 1 +
3 files changed, 25 insertions(+), 12 deletions(-)
diff --git a/plugins/hciops.c b/plugins/hciops.c
index 2e91129..1e54c09 100644
--- a/plugins/hciops.c
+++ b/plugins/hciops.c
@@ -462,11 +462,32 @@ done:
return err;
}
+static int hciops_powered(int index, gboolean powered)
+{
+ int dd;
+ uint8_t mode = SCAN_DISABLED;
+
+ if (powered)
+ return hciops_start(index);
+
+ dd = hci_open_dev(index);
+ if (dd < 0)
+ return -EIO;
+
+ hci_send_cmd(dd, OGF_HOST_CTL, OCF_WRITE_SCAN_ENABLE,
+ 1, &mode);
+
+ hci_close_dev(dd);
+
+ return hciops_stop(index);
+}
+
static struct btd_adapter_ops hci_ops = {
.setup = hciops_setup,
.cleanup = hciops_cleanup,
.start = hciops_start,
.stop = hciops_stop,
+ .set_powered = hciops_powered,
};
static int hciops_init(void)
diff --git a/src/adapter.c b/src/adapter.c
index 2efdbc8..5b3b0aa 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -406,21 +406,13 @@ static int set_mode(struct btd_adapter *adapter, uint8_t new_mode)
scan_enable = mode2scan(new_mode);
if (!adapter->up && scan_enable != SCAN_DISABLED) {
- err = adapter_ops->start(adapter->dev_id);
+ err = adapter_ops->set_powered(adapter->dev_id, TRUE);
if (err < 0)
return err;
}
- dd = hci_open_dev(adapter->dev_id);
- if (dd < 0)
- return -EIO;
-
if (adapter->up && scan_enable == SCAN_DISABLED) {
- hci_send_cmd(dd, OGF_HOST_CTL, OCF_WRITE_SCAN_ENABLE,
- 1, &scan_enable);
- hci_close_dev(dd);
-
- err = adapter_ops->stop(adapter->dev_id);
+ err = adapter_ops->set_powered(adapter->dev_id, FALSE);
if (err < 0)
return err;
@@ -452,14 +444,13 @@ static int set_mode(struct btd_adapter *adapter, uint8_t new_mode)
else if (adapter->mode == MODE_LIMITED)
set_limited_discoverable(dd, adapter->dev.class,
FALSE);
+ hci_close_dev(dd);
}
done:
modestr = mode2str(new_mode);
write_device_mode(&adapter->bdaddr, modestr);
- hci_close_dev(dd);
-
adapter->mode = new_mode;
return 0;
diff --git a/src/adapter.h b/src/adapter.h
index 97e9888..5c292fb 100644
--- a/src/adapter.h
+++ b/src/adapter.h
@@ -152,6 +152,7 @@ struct btd_adapter_ops {
void (*cleanup) (void);
int (*start) (int index);
int (*stop) (int index);
+ int (*set_powered) (int index, gboolean powered);
};
int btd_register_adapter_ops(struct btd_adapter_ops *btd_adapter_ops);
--
1.5.6.3
Hi Alok,
On Sun, May 17, 2009, alok barsode wrote:
> The 3rd patch has dependencies on the 1st patch (using hci_send_cmd
> for hci_send_req) .
> did u get time to test that patch?
No. I stopped processing the patches after I hit the issues with the
second one.
> do you want me to rework all the patches so as to remove dependency on patch1?
> (which would basically mean removing that patch).
Resend a fixed second patch and any other patches that need updating due
to the fixes (afaik it only affects the third patch).
Johan
Hi Johan,
On Sun, May 17, 2009 at 4:24 AM, Johan Hedberg <[email protected]> wr=
ote:
> Hi Alok,
>
> On Fri, May 15, 2009, Johan Hedberg wrote:
>> I'm going through your patches now and I found at least one issue:
>>
>> > + =A0 hci_send_cmd(dd, OGF_HOST_CTL, OCF_WRITE_SCAN_ENABLE,
>> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
1, SCAN_DISABLED);
>>
>> This looks wrong. The last parameter should a pointer and not an integer=
.
>
hmmm right, I show assign 'SCAN_DISABLE' to a variable and send its
address to hci_send_cmd.
> There's another issue with this patch as well:
> adapter.c: In function =91set_mode=92:
> adapter.c:403: error: =91dd=92 may be used uninitialized in this function
>
> I'd have fixed both issues for you (since they are rather trivial) but
> then your third patch doesn't apply cleanly anymore. So please fix these
> issues, check that no patch causes any compilation warning or error, and
> resend them. Thanks.
>
The 3rd patch has dependencies on the 1st patch (using hci_send_cmd
for hci_send_req) .
did u get time to test that patch?
Thanks for fixing patch2.
do you want me to rework all the patches so as to remove dependency on patc=
h1?
(which would basically mean removing that patch).
Cheers,
Alok
> Johan
>
Hi Alok,
On Fri, May 15, 2009, Johan Hedberg wrote:
> I'm going through your patches now and I found at least one issue:
>
> > + hci_send_cmd(dd, OGF_HOST_CTL, OCF_WRITE_SCAN_ENABLE,
> > + 1, SCAN_DISABLED);
>
> This looks wrong. The last parameter should a pointer and not an integer.
There's another issue with this patch as well:
adapter.c: In function ‘set_mode’:
adapter.c:403: error: ‘dd’ may be used uninitialized in this function
I'd have fixed both issues for you (since they are rather trivial) but
then your third patch doesn't apply cleanly anymore. So please fix these
issues, check that no patch causes any compilation warning or error, and
resend them. Thanks.
Johan
Hi Alok,
I'm going through your patches now and I found at least one issue:
> + hci_send_cmd(dd, OGF_HOST_CTL, OCF_WRITE_SCAN_ENABLE,
> + 1, SCAN_DISABLED);
This looks wrong. The last parameter should a pointer and not an integer.
Johan