* [PATCH 1/4] remove log to make bluetooth.c a static library
@ 2010-07-18 22:57 Gustavo F. Padovan
2010-07-18 22:57 ` [PATCH 2/4] bluetooth: move uuid to struct bluetooth_profile Gustavo F. Padovan
0 siblings, 1 reply; 10+ messages in thread
From: Gustavo F. Padovan @ 2010-07-18 22:57 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 3525 bytes --]
---
plugins/bluetooth.c | 27 +++------------------------
1 files changed, 3 insertions(+), 24 deletions(-)
diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c
index 5a85eaa..1079838 100644
--- a/plugins/bluetooth.c
+++ b/plugins/bluetooth.c
@@ -77,7 +77,6 @@ int bluetooth_send_with_reply(const char *path, const char *interface,
msg = dbus_message_new_method_call(BLUEZ_SERVICE, path,
interface, method);
if (!msg) {
- ofono_error("Unable to allocate new D-Bus %s message", method);
err = -ENOMEM;
goto fail;
}
@@ -96,7 +95,6 @@ int bluetooth_send_with_reply(const char *path, const char *interface,
timeout *= 1000;
if (!dbus_connection_send_with_reply(connection, msg, &call, timeout)) {
- ofono_error("Sending %s failed", method);
err = -EIO;
goto fail;
}
@@ -246,18 +244,11 @@ static void device_properties_cb(DBusPendingCall *call, gpointer user_data)
reply = dbus_pending_call_steal_reply(call);
- if (dbus_message_is_error(reply, DBUS_ERROR_SERVICE_UNKNOWN)) {
- DBG("Bluetooth daemon is apparently not available.");
+ if (dbus_message_is_error(reply, DBUS_ERROR_SERVICE_UNKNOWN))
goto done;
- }
-
- if (dbus_message_get_type(reply) == DBUS_MESSAGE_TYPE_ERROR) {
- if (!dbus_message_is_error(reply, DBUS_ERROR_UNKNOWN_METHOD))
- ofono_info("Error from GetProperties reply: %s",
- dbus_message_get_error_name(reply));
+ if (dbus_message_get_type(reply) == DBUS_MESSAGE_TYPE_ERROR)
goto done;
- }
bluetooth_parse_properties(reply, "UUIDs", has_uuid, &have_uuid,
"Adapter", parse_string, &adapter,
@@ -285,8 +276,6 @@ static void parse_devices(DBusMessageIter *array, gpointer user_data)
DBusMessageIter value;
GSList **device_list = user_data;
- DBG("");
-
if (dbus_message_iter_get_arg_type(array) != DBUS_TYPE_ARRAY)
return;
@@ -380,7 +369,6 @@ static void adapter_properties_cb(DBusPendingCall *call, gpointer user_data)
reply = dbus_pending_call_steal_reply(call);
if (dbus_message_is_error(reply, DBUS_ERROR_SERVICE_UNKNOWN)) {
- DBG("Bluetooth daemon is apparently not available.");
goto done;
}
@@ -389,7 +377,6 @@ static void adapter_properties_cb(DBusPendingCall *call, gpointer user_data)
"Address", parse_string, &addr,
NULL);
- DBG("Adapter Address: %s, Path: %s", addr, path);
g_hash_table_insert(adapter_address_hash,
g_strdup(path), g_strdup(addr));
@@ -439,8 +426,6 @@ static void parse_adapters(DBusMessageIter *array, gpointer user_data)
{
DBusMessageIter value;
- DBG("");
-
if (dbus_message_iter_get_arg_type(array) != DBUS_TYPE_ARRAY)
return;
@@ -452,8 +437,6 @@ static void parse_adapters(DBusMessageIter *array, gpointer user_data)
dbus_message_iter_get_basic(&value, &path);
- DBG("Calling GetProperties on %s", path);
-
bluetooth_send_with_reply(path, BLUEZ_ADAPTER_INTERFACE,
"GetProperties", adapter_properties_cb,
g_strdup(path), g_free, -1, DBUS_TYPE_INVALID);
@@ -468,12 +451,8 @@ static void manager_properties_cb(DBusPendingCall *call, gpointer user_data)
reply = dbus_pending_call_steal_reply(call);
- if (dbus_message_is_error(reply, DBUS_ERROR_SERVICE_UNKNOWN)) {
- DBG("Bluetooth daemon is apparently not available.");
+ if (dbus_message_is_error(reply, DBUS_ERROR_SERVICE_UNKNOWN))
goto done;
- }
-
- DBG("");
bluetooth_parse_properties(reply, "Adapters", parse_adapters, NULL,
NULL);
--
1.7.1.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/4] bluetooth: move uuid to struct bluetooth_profile
2010-07-18 22:57 [PATCH 1/4] remove log to make bluetooth.c a static library Gustavo F. Padovan
@ 2010-07-18 22:57 ` Gustavo F. Padovan
2010-07-18 22:57 ` [PATCH 3/4] bluetooth: do not use ofono_dbus_get_connection Gustavo F. Padovan
0 siblings, 1 reply; 10+ messages in thread
From: Gustavo F. Padovan @ 2010-07-18 22:57 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2378 bytes --]
---
plugins/bluetooth.c | 4 ++--
plugins/bluetooth.h | 4 ++--
plugins/hfp.c | 3 ++-
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c
index 1079838..f74c9c5 100644
--- a/plugins/bluetooth.c
+++ b/plugins/bluetooth.c
@@ -482,7 +482,7 @@ static guint adapter_added_watch;
static guint adapter_removed_watch;
static guint property_watch;
-int bluetooth_register_uuid(const char *uuid, struct bluetooth_profile *profile)
+int bluetooth_register_uuid(struct bluetooth_profile *profile)
{
int err;
@@ -522,7 +522,7 @@ int bluetooth_register_uuid(const char *uuid, struct bluetooth_profile *profile)
g_free, g_free);
done:
- g_hash_table_insert(uuid_hash, g_strdup(uuid), profile);
+ g_hash_table_insert(uuid_hash, g_strdup(profile->uuid), profile);
bluetooth_send_with_reply("/", BLUEZ_MANAGER_INTERFACE, "GetProperties",
manager_properties_cb, NULL, NULL, -1,
diff --git a/plugins/bluetooth.h b/plugins/bluetooth.h
index fb0d841..1cb950b 100644
--- a/plugins/bluetooth.h
+++ b/plugins/bluetooth.h
@@ -30,14 +30,14 @@
struct bluetooth_profile {
const char *name;
+ const char *uuid;
int (*create)(const char *device, const char *dev_addr,
const char *adapter_addr, const char *alias);
void (*remove_all)();
void (*set_alias)(const char *device, const char *);
};
-int bluetooth_register_uuid(const char *uuid,
- struct bluetooth_profile *profile);
+int bluetooth_register_uuid(struct bluetooth_profile *profile);
void bluetooth_unregister_uuid(const char *uuid);
void bluetooth_create_path(const char *dev_addr, const char *adapter_addr,
diff --git a/plugins/hfp.c b/plugins/hfp.c
index b6cd415..76923f0 100644
--- a/plugins/hfp.c
+++ b/plugins/hfp.c
@@ -674,6 +674,7 @@ static struct ofono_modem_driver hfp_driver = {
static struct bluetooth_profile hfp_profile = {
.name = "hfp",
+ .uuid = HFP_AG_UUID,
.create = hfp_create_modem,
.remove_all = hfp_remove_all_modem,
.set_alias = hfp_set_alias,
@@ -692,7 +693,7 @@ static int hfp_init()
if (err < 0)
return err;
- err = bluetooth_register_uuid(HFP_AG_UUID, &hfp_profile);
+ err = bluetooth_register_uuid(&hfp_profile);
if (err < 0) {
ofono_modem_driver_unregister(&hfp_driver);
return err;
--
1.7.1.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/4] bluetooth: do not use ofono_dbus_get_connection
2010-07-18 22:57 ` [PATCH 2/4] bluetooth: move uuid to struct bluetooth_profile Gustavo F. Padovan
@ 2010-07-18 22:57 ` Gustavo F. Padovan
2010-07-18 22:57 ` [PATCH 4/4] make bluetooth.{c,h} a static library Gustavo F. Padovan
0 siblings, 1 reply; 10+ messages in thread
From: Gustavo F. Padovan @ 2010-07-18 22:57 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1873 bytes --]
We can't rely on that function anymore, since bluetooth.c will be used
outside of ofonod now.
---
plugins/bluetooth.c | 5 +++--
plugins/bluetooth.h | 3 ++-
plugins/hfp.c | 2 +-
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c
index f74c9c5..9335607 100644
--- a/plugins/bluetooth.c
+++ b/plugins/bluetooth.c
@@ -482,14 +482,15 @@ static guint adapter_added_watch;
static guint adapter_removed_watch;
static guint property_watch;
-int bluetooth_register_uuid(struct bluetooth_profile *profile)
+int bluetooth_register_uuid(DBusConnection *conn,
+ struct bluetooth_profile *profile)
{
int err;
if (uuid_hash)
goto done;
- connection = ofono_dbus_get_connection();
+ connection = conn;
bluetooth_watch = g_dbus_add_service_watch(connection, BLUEZ_SERVICE,
NULL, bluetooth_disconnect, NULL, NULL);
diff --git a/plugins/bluetooth.h b/plugins/bluetooth.h
index 1cb950b..552ad18 100644
--- a/plugins/bluetooth.h
+++ b/plugins/bluetooth.h
@@ -37,7 +37,8 @@ struct bluetooth_profile {
void (*set_alias)(const char *device, const char *);
};
-int bluetooth_register_uuid(struct bluetooth_profile *profile);
+int bluetooth_register_uuid(DBusConnection *conn,
+ struct bluetooth_profile *profile);
void bluetooth_unregister_uuid(const char *uuid);
void bluetooth_create_path(const char *dev_addr, const char *adapter_addr,
diff --git a/plugins/hfp.c b/plugins/hfp.c
index 76923f0..b934f3b 100644
--- a/plugins/hfp.c
+++ b/plugins/hfp.c
@@ -693,7 +693,7 @@ static int hfp_init()
if (err < 0)
return err;
- err = bluetooth_register_uuid(&hfp_profile);
+ err = bluetooth_register_uuid(connection, &hfp_profile);
if (err < 0) {
ofono_modem_driver_unregister(&hfp_driver);
return err;
--
1.7.1.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 4/4] make bluetooth.{c,h} a static library
2010-07-18 22:57 ` [PATCH 3/4] bluetooth: do not use ofono_dbus_get_connection Gustavo F. Padovan
@ 2010-07-18 22:57 ` Gustavo F. Padovan
2010-07-18 23:01 ` Marcel Holtmann
0 siblings, 1 reply; 10+ messages in thread
From: Gustavo F. Padovan @ 2010-07-18 22:57 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1348 bytes --]
---
Makefile.am | 7 +++----
plugins/bluetooth.c | 3 ---
2 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index e256841..3c69b4e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -71,6 +71,8 @@ gatchat_sources = gatchat/gatchat.h gatchat/gatchat.c \
gatchat/ppp_auth.c gatchat/ppp_net.c \
gatchat/ppp_ipcp.c
+bluetooth_sources = plugins/bluetooth.c plugins/bluetooth.h
+
udev_files = plugins/ofono.rules
if UDEV
@@ -236,11 +238,8 @@ builtin_sources += plugins/huawei.c
builtin_modules += novatel
builtin_sources += plugins/novatel.c
-builtin_modules += bluetooth
-builtin_sources += plugins/bluetooth.c plugins/bluetooth.h
-
builtin_modules += hfp
-builtin_sources += plugins/hfp.c plugins/bluetooth.h
+builtin_sources += plugins/hfp.c $(bluetooth_sources)
builtin_modules += palmpre
builtin_sources += plugins/palmpre.c
diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c
index 9335607..9aca650 100644
--- a/plugins/bluetooth.c
+++ b/plugins/bluetooth.c
@@ -555,6 +555,3 @@ void bluetooth_unregister_uuid(const char *uuid)
g_hash_table_destroy(adapter_address_hash);
uuid_hash = NULL;
}
-
-OFONO_PLUGIN_DEFINE(bluetooth, "Bluetooth Utils Plugins", VERSION,
- OFONO_PLUGIN_PRIORITY_DEFAULT, NULL, NULL)
--
1.7.1.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 4/4] make bluetooth.{c,h} a static library
2010-07-18 22:57 ` [PATCH 4/4] make bluetooth.{c,h} a static library Gustavo F. Padovan
@ 2010-07-18 23:01 ` Marcel Holtmann
2010-07-18 23:05 ` Gustavo F. Padovan
0 siblings, 1 reply; 10+ messages in thread
From: Marcel Holtmann @ 2010-07-18 23:01 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 276 bytes --]
Hi Gustavo,
> Makefile.am | 7 +++----
> plugins/bluetooth.c | 3 ---
> 2 files changed, 3 insertions(+), 7 deletions(-)
why are we doing this exactly? If I missed it, please explain it again
since I am not sure that I agree.
Regards
Marcel
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 4/4] make bluetooth.{c,h} a static library
2010-07-18 23:01 ` Marcel Holtmann
@ 2010-07-18 23:05 ` Gustavo F. Padovan
2010-07-18 23:10 ` Marcel Holtmann
0 siblings, 1 reply; 10+ messages in thread
From: Gustavo F. Padovan @ 2010-07-18 23:05 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 586 bytes --]
Hi Marcel,
* Marcel Holtmann <marcel@holtmann.org> [2010-07-18 16:01:12 -0700]:
> Hi Gustavo,
>
> > Makefile.am | 7 +++----
> > plugins/bluetooth.c | 3 ---
> > 2 files changed, 3 insertions(+), 7 deletions(-)
>
> why are we doing this exactly? If I missed it, please explain it again
> since I am not sure that I agree.
We are doing this for the DUN daemon. As you guys said to me it will be
separated daemon in oFono sources, so we need bluetooth.c as a static
library to reuse it in the DUN daemon.
--
Gustavo F. Padovan
http://padovan.org
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 4/4] make bluetooth.{c,h} a static library
2010-07-18 23:05 ` Gustavo F. Padovan
@ 2010-07-18 23:10 ` Marcel Holtmann
2010-07-18 23:23 ` Gustavo F. Padovan
0 siblings, 1 reply; 10+ messages in thread
From: Marcel Holtmann @ 2010-07-18 23:10 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 970 bytes --]
Hi Gustavo,
> > > Makefile.am | 7 +++----
> > > plugins/bluetooth.c | 3 ---
> > > 2 files changed, 3 insertions(+), 7 deletions(-)
> >
> > why are we doing this exactly? If I missed it, please explain it again
> > since I am not sure that I agree.
>
> We are doing this for the DUN daemon. As you guys said to me it will be
> separated daemon in oFono sources, so we need bluetooth.c as a static
> library to reuse it in the DUN daemon.
we need to discuss this again. I am not sure it is the best idea to have
this as a separate daemon. I argue with myself forth and back on this
idea. One option is to do this as an oFono atom, another one is to do
this as a separate daemon. Currently the atom idea is winning.
Also there is no need to create a static library for doing this. That is
just wrong. We can do the build magic with autofoo properly and without
having to use a hack with a static library.
Regards
Marcel
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 4/4] make bluetooth.{c,h} a static library
2010-07-18 23:10 ` Marcel Holtmann
@ 2010-07-18 23:23 ` Gustavo F. Padovan
2010-07-18 23:34 ` Marcel Holtmann
0 siblings, 1 reply; 10+ messages in thread
From: Gustavo F. Padovan @ 2010-07-18 23:23 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1345 bytes --]
Hi Marcel,
* Marcel Holtmann <marcel@holtmann.org> [2010-07-18 16:10:21 -0700]:
> Hi Gustavo,
>
> > > > Makefile.am | 7 +++----
> > > > plugins/bluetooth.c | 3 ---
> > > > 2 files changed, 3 insertions(+), 7 deletions(-)
> > >
> > > why are we doing this exactly? If I missed it, please explain it again
> > > since I am not sure that I agree.
> >
> > We are doing this for the DUN daemon. As you guys said to me it will be
> > separated daemon in oFono sources, so we need bluetooth.c as a static
> > library to reuse it in the DUN daemon.
>
> we need to discuss this again. I am not sure it is the best idea to have
> this as a separate daemon. I argue with myself forth and back on this
> idea. One option is to do this as an oFono atom, another one is to do
> this as a separate daemon. Currently the atom idea is winning.
Ok, so I'll wait to continue my implementation of the DUN client. I
don't know the oFono internal too much to help on that decision.
> Also there is no need to create a static library for doing this. That is
> just wrong. We can do the build magic with autofoo properly and without
> having to use a hack with a static library.
I meant build statically here like gatchat, without any hack with static
library. ;)
--
Gustavo F. Padovan
http://padovan.org
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 4/4] make bluetooth.{c,h} a static library
2010-07-18 23:23 ` Gustavo F. Padovan
@ 2010-07-18 23:34 ` Marcel Holtmann
2010-07-19 1:39 ` Denis Kenzior
0 siblings, 1 reply; 10+ messages in thread
From: Marcel Holtmann @ 2010-07-18 23:34 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1581 bytes --]
Hi Gustavo,
> > > > > Makefile.am | 7 +++----
> > > > > plugins/bluetooth.c | 3 ---
> > > > > 2 files changed, 3 insertions(+), 7 deletions(-)
> > > >
> > > > why are we doing this exactly? If I missed it, please explain it again
> > > > since I am not sure that I agree.
> > >
> > > We are doing this for the DUN daemon. As you guys said to me it will be
> > > separated daemon in oFono sources, so we need bluetooth.c as a static
> > > library to reuse it in the DUN daemon.
> >
> > we need to discuss this again. I am not sure it is the best idea to have
> > this as a separate daemon. I argue with myself forth and back on this
> > idea. One option is to do this as an oFono atom, another one is to do
> > this as a separate daemon. Currently the atom idea is winning.
>
> Ok, so I'll wait to continue my implementation of the DUN client. I
> don't know the oFono internal too much to help on that decision.
I was talking about the server and not the client. For the client we
have to have a chat about it. I might have missed parts of the initial
discussion.
> > Also there is no need to create a static library for doing this. That is
> > just wrong. We can do the build magic with autofoo properly and without
> > having to use a hack with a static library.
>
> I meant build statically here like gatchat, without any hack with static
> library. ;)
Actually gatchat is not build statically. It is build as part of out AT
modem driver. That it is in separate directory is purely cosmetic.
Regards
Marcel
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 4/4] make bluetooth.{c,h} a static library
2010-07-18 23:34 ` Marcel Holtmann
@ 2010-07-19 1:39 ` Denis Kenzior
0 siblings, 0 replies; 10+ messages in thread
From: Denis Kenzior @ 2010-07-19 1:39 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1162 bytes --]
Hi Marcel,
>> Ok, so I'll wait to continue my implementation of the DUN client. I
>> don't know the oFono internal too much to help on that decision.
>
> I was talking about the server and not the client. For the client we
> have to have a chat about it. I might have missed parts of the initial
> discussion.
>
As we discussed before, the client needs settings strings to send to the
modem. E.g. AT+CGDCONT=foobar; ATD*99***1. oFono atoms are not setup
to do this.
>>> Also there is no need to create a static library for doing this. That is
>>> just wrong. We can do the build magic with autofoo properly and without
>>> having to use a hack with a static library.
>>
>> I meant build statically here like gatchat, without any hack with static
>> library. ;)
>
> Actually gatchat is not build statically. It is build as part of out AT
> modem driver. That it is in separate directory is purely cosmetic.
>
GAtChat will end up used by the core for the ppp integration. I argued
that bluetooth should follow the same semantic, since it will be used by
both dun client daemon and oFono hfp/sap plugins.
Regards,
-Denis
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2010-07-19 1:39 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-18 22:57 [PATCH 1/4] remove log to make bluetooth.c a static library Gustavo F. Padovan
2010-07-18 22:57 ` [PATCH 2/4] bluetooth: move uuid to struct bluetooth_profile Gustavo F. Padovan
2010-07-18 22:57 ` [PATCH 3/4] bluetooth: do not use ofono_dbus_get_connection Gustavo F. Padovan
2010-07-18 22:57 ` [PATCH 4/4] make bluetooth.{c,h} a static library Gustavo F. Padovan
2010-07-18 23:01 ` Marcel Holtmann
2010-07-18 23:05 ` Gustavo F. Padovan
2010-07-18 23:10 ` Marcel Holtmann
2010-07-18 23:23 ` Gustavo F. Padovan
2010-07-18 23:34 ` Marcel Holtmann
2010-07-19 1:39 ` Denis Kenzior
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.