2010-12-20 18:16:44

by Bruna Moreira

[permalink] [raw]
Subject: [PATCH 1/2] Move EIR flags definitions to adapter.c

---
src/adapter.c | 9 +++++++++
src/sdpd.h | 9 ---------
2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index 669a0ac..db3649f 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -56,6 +56,15 @@
#include "agent.h"
#include "storage.h"

+/* Flags Descriptions */
+#define EIR_LIM_DISC 0x01 /* LE Limited Discoverable Mode */
+#define EIR_GEN_DISC 0x02 /* LE General Discoverable Mode */
+#define EIR_BREDR_UNSUP 0x04 /* BR/EDR Not Supported */
+#define EIR_SIM_CONTROLLER 0x08 /* Simultaneous LE and BR/EDR to Same
+ Device Capable (Controller) */
+#define EIR_SIM_HOST 0x10 /* Simultaneous LE and BR/EDR to Same
+ Device Capable (Host) */
+
#define ADV_TYPE_IND 0x00
#define ADV_TYPE_DIRECT_IND 0x01

diff --git a/src/sdpd.h b/src/sdpd.h
index 98e5b20..dc7a256 100644
--- a/src/sdpd.h
+++ b/src/sdpd.h
@@ -48,15 +48,6 @@
#define EIR_TX_POWER 0x0A /* transmit power level */
#define EIR_DEVICE_ID 0x10 /* device ID */

-/* Flags Descriptions */
-#define EIR_LIM_DISC 0x01 /* LE Limited Discoverable Mode */
-#define EIR_GEN_DISC 0x02 /* LE General Discoverable Mode */
-#define EIR_BREDR_UNSUP 0x04 /* BR/EDR Not Supported */
-#define EIR_SIM_CONTROLLER 0x08 /* Simultaneous LE and BR/EDR to Same
- Device Capable (Controller) */
-#define EIR_SIM_HOST 0x10 /* Simultaneous LE and BR/EDR to Same
- Device Capable (Host) */
-
typedef struct request {
bdaddr_t device;
bdaddr_t bdaddr;
--
1.7.0.4



2010-12-20 22:43:55

by Johan Hedberg

[permalink] [raw]
Subject: Re: [PATCH 1/2] Move EIR flags definitions to adapter.c

Hi Bruna,

On Mon, Dec 20, 2010, Bruna Moreira wrote:
> ---
> src/adapter.c | 9 +++++++++
> src/sdpd.h | 9 ---------
> 2 files changed, 9 insertions(+), 9 deletions(-)

Both patches have been pushed upstream. Thanks. In the future, please
put some content to the commit message body for any non-trivial patches.
You could at least have a sentence or two about *why* the patches are
needed.

Johan

2010-12-20 20:10:55

by Bruna Moreira

[permalink] [raw]
Subject: Re: [PATCH 1/2] Move EIR flags definitions to adapter.c

Hi Gustavo,

On Mon, Dec 20, 2010 at 2:54 PM, Gustavo F. Padovan
<[email protected]> wrote:
> Hi Bruna,
>
> * Bruna Moreira <[email protected]> [2010-12-20 14:16:44 -0400]:
>
>> ---
>> ?src/adapter.c | ? ?9 +++++++++
>> ?src/sdpd.h ? ?| ? ?9 ---------
>> ?2 files changed, 9 insertions(+), 9 deletions(-)
>
> What's the point on moving this? I supposed you were using these macros in the
> following patch but you're not.
>

It is only a cleanup patch. These macros are used just in adapter.c.
This patch is not related with the next one.

BR,
--
Bruna Moreira
Instituto Nokia de Tecnologia (INdT)
Manaus - Brazil

2010-12-20 18:54:22

by Gustavo Padovan

[permalink] [raw]
Subject: Re: [PATCH 1/2] Move EIR flags definitions to adapter.c

Hi Bruna,

* Bruna Moreira <[email protected]> [2010-12-20 14:16:44 -0400]:

> ---
> src/adapter.c | 9 +++++++++
> src/sdpd.h | 9 ---------
> 2 files changed, 9 insertions(+), 9 deletions(-)

What's the point on moving this? I supposed you were using these macros in the
following patch but you're not.

--
Gustavo F. Padovan
http://profusion.mobi

2010-12-20 18:16:45

by Bruna Moreira

[permalink] [raw]
Subject: [PATCH 2/2] Remove le_advertising_info struct from adapter.c

---
src/adapter.c | 13 ++++---------
src/adapter.h | 6 +++---
src/event.c | 6 +++++-
3 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index db3649f..5cdf4c2 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -2763,23 +2763,18 @@ static void remove_same_uuid(gpointer data, gpointer user_data)
}

void adapter_update_device_from_info(struct btd_adapter *adapter,
- le_advertising_info *info,
- char *name, GSList *services,
- uint8_t flags)
+ bdaddr_t bdaddr, int8_t rssi,
+ uint8_t evt_type, char *name,
+ GSList *services, uint8_t flags)
{
struct remote_dev_info *dev;
- bdaddr_t bdaddr;
gboolean new_dev;
- int8_t rssi;
-
- rssi = *(info->data + info->length);
- bdaddr = info->bdaddr;

dev = get_found_dev(adapter, &bdaddr, &new_dev);

if (new_dev) {
dev->le = TRUE;
- dev->evt_type = info->evt_type;
+ dev->evt_type = evt_type;
} else if (dev->rssi == rssi)
return;

diff --git a/src/adapter.h b/src/adapter.h
index a390088..039c30b 100644
--- a/src/adapter.h
+++ b/src/adapter.h
@@ -136,9 +136,9 @@ int adapter_get_discover_type(struct btd_adapter *adapter);
struct remote_dev_info *adapter_search_found_devices(struct btd_adapter *adapter,
struct remote_dev_info *match);
void adapter_update_device_from_info(struct btd_adapter *adapter,
- le_advertising_info *info,
- char *name, GSList *services,
- uint8_t flags);
+ bdaddr_t bdaddr, int8_t rssi,
+ uint8_t evt_type, char *name,
+ GSList *services, uint8_t flags);
void adapter_update_found_devices(struct btd_adapter *adapter, bdaddr_t *bdaddr,
int8_t rssi, uint32_t class, const char *name,
const char *alias, gboolean legacy,
diff --git a/src/event.c b/src/event.c
index 3603643..55a83c2 100644
--- a/src/event.c
+++ b/src/event.c
@@ -435,6 +435,7 @@ void btd_event_advertising_report(bdaddr_t *local, le_advertising_info *info)
{
struct btd_adapter *adapter;
struct eir_data eir_data;
+ int8_t rssi;
int err;

adapter = manager_find_adapter(local);
@@ -450,7 +451,10 @@ void btd_event_advertising_report(bdaddr_t *local, le_advertising_info *info)
error("Error parsing advertising data: %s (%d)",
strerror(-err), -err);

- adapter_update_device_from_info(adapter, info, eir_data.name,
+ rssi = *(info->data + info->length);
+
+ adapter_update_device_from_info(adapter, info->bdaddr, rssi,
+ info->evt_type, eir_data.name,
eir_data.services, eir_data.flags);
}

--
1.7.0.4