~cyphermox/ubuntu/precise/bluez/4.98-0ubuntu4

« back to all changes in this revision

Viewing changes to src/device.c

  • Committer: Bazaar Package Importer
  • Author(s): Robert Ancell
  • Date: 2011-04-05 10:09:16 UTC
  • mfrom: (1.1.31 upstream)
  • Revision ID: james.westby@ubuntu.com-20110405100916-3am5el1q0asa4ul2
Tags: 4.91-0ubuntu1
* New upstream release
* debian/libbluetooth3.symbols:
  - Updated

Show diffs side-by-side

added added

removed removed

Lines of Context:
67
67
/* When all services should trust a remote device */
68
68
#define GLOBAL_TRUST "[all]"
69
69
 
70
 
struct btd_driver_data {
71
 
        guint id;
72
 
        struct btd_device_driver *driver;
73
 
        void *priv;
74
 
};
75
 
 
76
70
struct btd_disconnect_data {
77
71
        guint id;
78
72
        disconnect_watch watch;
120
114
        GSList          *uuids;
121
115
        GSList          *services;              /* Primary services path */
122
116
        GSList          *primaries;             /* List of primary services */
123
 
        GSList          *drivers;               /* List of driver_data */
 
117
        GSList          *drivers;               /* List of device drivers */
124
118
        GSList          *watches;               /* List of disconnect_data */
125
119
        gboolean        temporary;
126
120
        struct agent    *agent;
413
407
        return dbus_message_new_method_return(msg);
414
408
}
415
409
 
416
 
static void driver_remove(struct btd_driver_data *driver_data,
 
410
static void driver_remove(struct btd_device_driver *driver,
417
411
                                                struct btd_device *device)
418
412
{
419
 
        struct btd_device_driver *driver = driver_data->driver;
420
 
 
421
413
        driver->remove(device);
422
414
 
423
 
        device->drivers = g_slist_remove(device->drivers, driver_data);
424
 
        g_free(driver_data);
 
415
        device->drivers = g_slist_remove(device->drivers, driver);
425
416
}
426
417
 
427
418
static gboolean do_disconnect(gpointer user_data)
1120
1111
 
1121
1112
                /* match pattern driver */
1122
1113
                match = device_match_pattern(device, *uuid, profiles);
1123
 
                for (; match; match = match->next)
1124
 
                        uuids = g_slist_append(uuids, match->data);
 
1114
                uuids = g_slist_concat(uuids, match);
1125
1115
        }
1126
1116
 
1127
1117
        return uuids;
1145
1135
        for (list = device_drivers; list; list = list->next) {
1146
1136
                struct btd_device_driver *driver = list->data;
1147
1137
                GSList *probe_uuids;
1148
 
                struct btd_driver_data *driver_data;
1149
1138
 
1150
1139
                probe_uuids = device_match_driver(device, driver, profiles);
1151
1140
 
1152
1141
                if (!probe_uuids)
1153
1142
                        continue;
1154
1143
 
1155
 
                driver_data = g_new0(struct btd_driver_data, 1);
1156
 
 
1157
1144
                err = driver->probe(device, probe_uuids);
1158
1145
                if (err < 0) {
1159
1146
                        error("%s driver probe failed for device %s",
1160
1147
                                                        driver->name, addr);
1161
 
                        g_free(driver_data);
1162
1148
                        g_slist_free(probe_uuids);
1163
1149
                        continue;
1164
1150
                }
1165
1151
 
1166
 
                driver_data->driver = driver;
1167
 
                device->drivers = g_slist_append(device->drivers, driver_data);
 
1152
                device->drivers = g_slist_append(device->drivers, driver);
1168
1153
                g_slist_free(probe_uuids);
1169
1154
        }
1170
1155
 
1198
1183
        DBG("Removing drivers for %s", dstaddr);
1199
1184
 
1200
1185
        for (list = device->drivers; list; list = next) {
1201
 
                struct btd_driver_data *driver_data = list->data;
1202
 
                struct btd_device_driver *driver = driver_data->driver;
 
1186
                struct btd_device_driver *driver = list->data;
1203
1187
                const char **uuid;
1204
1188
 
1205
1189
                next = list->next;
1214
1198
 
1215
1199
                        driver->remove(device);
1216
1200
                        device->drivers = g_slist_remove(device->drivers,
1217
 
                                                                driver_data);
1218
 
                        g_free(driver_data);
1219
 
 
 
1201
                                                                driver);
1220
1202
                        break;
1221
1203
                }
1222
1204
        }