diff options
| author | Marcel Holtmann <marcel@holtmann.org> | 2008-09-08 18:50:16 +0200 | 
|---|---|---|
| committer | Marcel Holtmann <marcel@holtmann.org> | 2008-09-08 18:50:16 +0200 | 
| commit | a83ccff765033e99113ac29d3b0b7f7e0064fb28 (patch) | |
| tree | 085e8fcf478c8e7edae2f5e6375f8f43e0ffabfe /src | |
| parent | 8a74ae3846bc1fb887c80a355265e701f1546df6 (diff) | |
| parent | 19ce4933f3dadf3b04a2a9bd84d66d750cc010c3 (diff) | |
Merge branch 'for-upstream' of git://gitorious.org/bluez/aloks-clone
Diffstat (limited to 'src')
| -rw-r--r-- | src/adapter.c | 27 | ||||
| -rw-r--r-- | src/dbus-hci.c | 18 | ||||
| -rw-r--r-- | src/device.c | 13 | ||||
| -rw-r--r-- | src/device.h | 2 | 
4 files changed, 33 insertions, 27 deletions
| diff --git a/src/adapter.c b/src/adapter.c index 7881a0bd..4870ccaf 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -412,8 +412,9 @@ static struct bonding_request_info *bonding_request_new(DBusConnection *conn,  	struct bonding_request_info *bonding;  	struct btd_device *device;  	const char *name = dbus_message_get_sender(msg); -	const gchar *destination;  	struct agent *agent; +	char addr[18]; +	bdaddr_t bdaddr;  	debug("bonding_request_new(%s)", address); @@ -421,7 +422,9 @@ static struct bonding_request_info *bonding_request_new(DBusConnection *conn,  	if (!device)  		return NULL; -	destination = device_get_address(device); +	device_get_address(device, &bdaddr); +	ba2str(&bdaddr, addr); +  	agent = agent_create(adapter, name, agent_path,  					capability,  					device_agent_removed, @@ -430,7 +433,7 @@ static struct bonding_request_info *bonding_request_new(DBusConnection *conn,  	device_set_agent(device, agent);  	debug("Temporary agent registered for hci%d/%s at %s:%s", -			adapter->dev_id, destination, name, +			adapter->dev_id, addr, name,  			agent_path);  	bonding = g_new0(struct bonding_request_info, 1); @@ -987,16 +990,19 @@ done:  void adapter_remove_device(DBusConnection *conn, struct btd_adapter *adapter,  				struct btd_device *device)  { -	bdaddr_t src; -	const gchar *destination = device_get_address(device); +	bdaddr_t src, dst;  	const gchar *dev_path = device_get_path(device);  	struct agent *agent; +	char dst_addr[18]; + +	device_get_address(device, &dst); +	ba2str(&dst, dst_addr);  	str2ba(adapter->address, &src); -	delete_entry(&src, "profiles", destination); +	delete_entry(&src, "profiles", dst_addr);  	if (!device_is_temporary(device)) { -		remove_bonding(conn, NULL, destination, adapter); +		remove_bonding(conn, NULL, dst_addr, adapter);  		g_dbus_emit_signal(conn, adapter->path,  				ADAPTER_INTERFACE, @@ -2176,6 +2182,8 @@ static void create_stored_device_from_profiles(char *key, char *value,  	struct btd_device *device;  	const gchar *src;  	struct record_list rec_list; +	bdaddr_t dst; +	char dst_addr[18];  	if (g_slist_find_custom(adapter->devices,  				key, (GCompareFunc) device_address_cmp)) @@ -2188,8 +2196,11 @@ static void create_stored_device_from_profiles(char *key, char *value,  	device_set_temporary(device, FALSE);  	adapter->devices = g_slist_append(adapter->devices, device); +	device_get_address(device, &dst); +	ba2str(&dst, dst_addr); +  	src = adapter->address; -	rec_list.addr = device_get_address(device); +	rec_list.addr = dst_addr;  	rec_list.recs = NULL;  	create_name(filename, PATH_MAX, STORAGEDIR, src, "sdp"); diff --git a/src/dbus-hci.c b/src/dbus-hci.c index 77f768c1..8d5ad1ce 100644 --- a/src/dbus-hci.c +++ b/src/dbus-hci.c @@ -124,7 +124,6 @@ static void pincode_cb(struct agent *agent, DBusError *err, const char *pincode,  	size_t len;  	int dev;  	struct pending_auth_info *auth; -	const gchar *destination = device_get_address(device);  	uint16_t dev_id = adapter_get_dev_id(adapter);  	struct bonding_request_info *bonding = adapter_get_bonding_info(adapter); @@ -140,7 +139,7 @@ static void pincode_cb(struct agent *agent, DBusError *err, const char *pincode,  	}  	adapter_get_address(adapter, &sba); -	str2ba(destination, &dba); +	device_get_address(device, &dba);  	auth = adapter_find_auth_request(adapter, &dba); @@ -221,7 +220,6 @@ static void confirm_cb(struct agent *agent, DBusError *err, void *user_data)  	user_confirm_reply_cp cp;  	int dd;  	struct pending_auth_info *auth; -	const gchar *destination = device_get_address(device);  	uint16_t dev_id = adapter_get_dev_id(adapter);  	struct bonding_request_info *bonding = adapter_get_bonding_info(adapter); @@ -236,7 +234,7 @@ static void confirm_cb(struct agent *agent, DBusError *err, void *user_data)  	}  	memset(&cp, 0, sizeof(cp)); -	str2ba(destination, &cp.bdaddr); +	device_get_address(device, &cp.bdaddr);  	auth = adapter_find_auth_request(adapter, &cp.bdaddr); @@ -264,7 +262,6 @@ static void passkey_cb(struct agent *agent, DBusError *err, uint32_t passkey,  	bdaddr_t dba;  	int dd;  	struct pending_auth_info *auth; -	const gchar *destination = device_get_address(device);  	uint16_t dev_id = adapter_get_dev_id(adapter);  	struct bonding_request_info *bonding = adapter_get_bonding_info(adapter); @@ -278,7 +275,7 @@ static void passkey_cb(struct agent *agent, DBusError *err, uint32_t passkey,  		return;  	} -	str2ba(destination, &dba); +	device_get_address(device, &dba);  	memset(&cp, 0, sizeof(cp));  	bacpy(&cp.bdaddr, &dba); @@ -1086,10 +1083,11 @@ void hcid_dbus_disconn_complete(bdaddr_t *local, uint8_t status,  	struct active_conn_info *dev;  	gboolean connected = FALSE;  	struct pending_auth_info *auth; -	const gchar *destination;  	const gchar *dev_path;  	uint16_t dev_id;  	struct bonding_request_info *bonding; +	bdaddr_t bdaddr; +	char addr[18];  	if (status) {  		error("Disconnection failed: 0x%02x", status); @@ -1143,7 +1141,9 @@ void hcid_dbus_disconn_complete(bdaddr_t *local, uint8_t status,  	device = adapter_find_device(adapter, paddr);  	if (device) { -		destination = device_get_address(device); +		device_get_address(device, &bdaddr); +		ba2str(&bdaddr, addr); +  		dev_path = device_get_path(device);  		dbus_connection_emit_property_changed(connection, @@ -1151,7 +1151,7 @@ void hcid_dbus_disconn_complete(bdaddr_t *local, uint8_t status,  					"Connected", DBUS_TYPE_BOOLEAN,  					&connected);  		if (device_is_temporary(device)) { -			debug("Removing temporary device %s", destination); +			debug("Removing temporary device %s", addr);  			adapter_remove_device(connection, adapter, device);  		}  	} diff --git a/src/device.c b/src/device.c index a4b26d52..63c6a5b7 100644 --- a/src/device.c +++ b/src/device.c @@ -633,7 +633,6 @@ void device_probe_drivers(struct btd_device *device, GSList *uuids, sdp_list_t *  void device_remove_drivers(struct btd_device *device, GSList *uuids, sdp_list_t *recs)  {  	struct btd_adapter *adapter = device_get_adapter(device); -	const gchar *dst = device_get_address(device);  	GSList *list;  	char src_addr[18];  	bdaddr_t src; @@ -665,7 +664,7 @@ void device_remove_drivers(struct btd_device *device, GSList *uuids, sdp_list_t  			if (!rec)  				continue; -			delete_record(src_addr, dst, rec->handle); +			delete_record(src_addr, device->address, rec->handle);  		}  	} @@ -795,7 +794,6 @@ static void update_services(struct browse_req *req, sdp_list_t *recs)  {  	struct btd_device *device = req->device;  	struct btd_adapter *adapter = device_get_adapter(device); -	const gchar *dst = device_get_address(device);  	sdp_list_t *seq;  	char src_addr[18];  	bdaddr_t src; @@ -825,7 +823,7 @@ static void update_services(struct browse_req *req, sdp_list_t *recs)  		if (sdp_list_find(req->records, rec, rec_cmp))  			continue; -		store_record(src_addr, dst, rec); +		store_record(src_addr, device->address, rec);  		/* Copy record */  		if (sdp_gen_record_pdu(rec, &pdu) == 0) { @@ -1015,12 +1013,9 @@ struct btd_adapter *device_get_adapter(struct btd_device *device)  	return device->adapter;  } -const gchar *device_get_address(struct btd_device *device) +void device_get_address(struct btd_device *device, bdaddr_t *bdaddr)  { -	if (!device) -		return NULL; - -	return device->address; +	str2ba(device->address, bdaddr);  }  const gchar *device_get_path(struct btd_device *device) diff --git a/src/device.h b/src/device.h index 95b5e596..d2331173 100644 --- a/src/device.h +++ b/src/device.h @@ -32,7 +32,7 @@ int device_browse(struct btd_device *device, DBusConnection *conn,  			DBusMessage *msg, uuid_t *search);  void device_probe_drivers(struct btd_device *device, GSList *uuids, sdp_list_t *recs);  struct btd_adapter *device_get_adapter(struct btd_device *device); -const gchar *device_get_address(struct btd_device *device); +void device_get_address(struct btd_device *adapter, bdaddr_t *bdaddr);  const gchar *device_get_path(struct btd_device *device);  struct agent *device_get_agent(struct btd_device *device);  void device_set_agent(struct btd_device *device, struct agent *agent); | 
