While trying to unit test my updates in carrick that allow me
to connect to my iphones tethered bluetooth network, I am finding
that bluetooth support in connman hasn't kept up with all the
recent changes.

Specifically, there is no possible path for a bluetooth type
network to show up as a service.

With the following patch I can see my previously paired device
to show up as a service, and I can even click on 'connect' and
watch the service eventually update the status to 'ready', but
doesn't really work (i.e. we are not really connected to a
PAN network.)

But... here is a known broken patch to expose some stuff like:

* i wasn't sure why we had both a device and a network flavor
  of creating a new service, so i randomly picked enabling
  the network flavor. 

* Made the network.c network_probe not skip over bluetooth,
  but instead call __connman_service_create_network

* if ident and group are not set on a network, then
  __connman_service_create_network will fail, so i 
  had the bluetooth plugin set ident (without understanding
  what that really means), and patched the creation method
  to allow group not to be set (since trying to set the 
  group from the bluetooth plugin exposed a bunch more
  issues)

* if name is not set on a network then the hidden wifi
  code kicks in and prevents the bluetooth network from 
  showing up in the service list.  Just to get something
  working I changed the bluetooth code to set the name as
  the node name which is obviously wrong.  I'm sure it
  would be easy to pull the name from the properties provided
  by bluez (i.e so the user would see something like
  'Rustys iPhone'), but i didn't bother trying.

* The code for converting network types to service types
  doesn't account for bluetooth dun or pan networks.  This 
  results in a segfault when the default_service code kicks
  in and attempt to set a null string in a dbus variable.


    --rusty

diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c
index 2b589cc..28a9279 100644
--- a/plugins/bluetooth.c
+++ b/plugins/bluetooth.c
@@ -527,6 +527,10 @@ static void device_properties(DBusConnection *connection, 
const char *path,
        if (network == NULL)
                return;
 
+       connman_device_set_ident(device, node);
+
+       connman_network_set_name(network, node);
+
        connman_network_set_protocol(network, CONNMAN_NETWORK_PROTOCOL_IP);
 
        connman_network_set_string(network, "Node", path);
diff --git a/src/network.c b/src/network.c
index d29ebde..3b57fb9 100644
--- a/src/network.c
+++ b/src/network.c
@@ -1245,8 +1245,10 @@ static int network_probe(struct connman_element *element)
        switch (network->type) {
        case CONNMAN_NETWORK_TYPE_UNKNOWN:
        case CONNMAN_NETWORK_TYPE_VENDOR:
+               break;
        case CONNMAN_NETWORK_TYPE_BLUETOOTH_PAN:
        case CONNMAN_NETWORK_TYPE_BLUETOOTH_DUN:
+               __connman_profile_add_network(network);
                break;
        case CONNMAN_NETWORK_TYPE_MBM:
        case CONNMAN_NETWORK_TYPE_HSO:
diff --git a/src/service.c b/src/service.c
index 315a512..36948fc 100644
--- a/src/service.c
+++ b/src/service.c
@@ -1578,9 +1578,10 @@ static enum connman_service_type 
convert_network_type(struct connman_network *ne
        switch (type) {
        case CONNMAN_NETWORK_TYPE_UNKNOWN:
        case CONNMAN_NETWORK_TYPE_VENDOR:
+               break;
        case CONNMAN_NETWORK_TYPE_BLUETOOTH_PAN:
        case CONNMAN_NETWORK_TYPE_BLUETOOTH_DUN:
-               break;
+               return CONNMAN_SERVICE_TYPE_BLUETOOTH;
        case CONNMAN_NETWORK_TYPE_MBM:
        case CONNMAN_NETWORK_TYPE_HSO:
                return CONNMAN_SERVICE_TYPE_CELLULAR;
@@ -1685,11 +1686,13 @@ struct connman_service 
*__connman_service_create_from_network(struct connman_net
                return NULL;
 
        group = connman_network_get_group(network);
-       if (group == NULL)
-               return NULL;
-
-       name = g_strdup_printf("%s_%s_%s",
-                       __connman_network_get_type(network), ident, group);
+       if (group == NULL) 
+               name = g_strdup_printf("%s_%s",
+                                      __connman_network_get_type(network), 
ident);
+       else
+               name = g_strdup_printf("%s_%s_%s",
+                                      __connman_network_get_type(network), 
ident, group);
+               
        service = __connman_service_get(name);
        g_free(name);
 


_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman

Reply via email to