diff options
| -rw-r--r-- | hcid/adapter.c | 13 | ||||
| -rw-r--r-- | hcid/dbus-hci.c | 13 | ||||
| -rw-r--r-- | hcid/device.c | 8 | ||||
| -rw-r--r-- | hcid/device.h | 1 | 
4 files changed, 27 insertions, 8 deletions
diff --git a/hcid/adapter.c b/hcid/adapter.c index 63414390..45791734 100644 --- a/hcid/adapter.c +++ b/hcid/adapter.c @@ -278,6 +278,7 @@ static struct bonding_request_info *bonding_request_new(DBusConnection *conn,  	struct bonding_request_info *bonding;  	struct device *device;  	const char *name = dbus_message_get_sender(msg); +	const gchar *destination;  	debug("bonding_request_new(%s)", address); @@ -285,10 +286,13 @@ static struct bonding_request_info *bonding_request_new(DBusConnection *conn,  	if (!device)  		return NULL; +	destination = device_get_address(device);  	device->agent = agent_create(adapter, name, agent_path, -				capability, device_agent_removed, device); +					capability, +					device_agent_removed, +					device);  	debug("Temporary agent registered for hci%d/%s at %s:%s", -			adapter->dev_id, device->address, name, +			adapter->dev_id, destination, name,  			agent_path);  	bonding = g_new0(struct bonding_request_info, 1); @@ -737,11 +741,12 @@ void adapter_remove_device(DBusConnection *conn, struct adapter *adapter,  				struct device *device)  {  	bdaddr_t src; +	const gchar *destination = device_get_address(device);  	str2ba(adapter->address, &src); -	delete_entry(&src, "profiles", device->address); +	delete_entry(&src, "profiles", destination); -	remove_bonding(conn, NULL, device->address, adapter); +	remove_bonding(conn, NULL, destination, adapter);  	if (!device->temporary) {  		g_dbus_emit_signal(conn, adapter->path, diff --git a/hcid/dbus-hci.c b/hcid/dbus-hci.c index 0b527610..583d2ed7 100644 --- a/hcid/dbus-hci.c +++ b/hcid/dbus-hci.c @@ -726,6 +726,7 @@ 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);  	/* No need to reply anything if the authentication already failed */  	if (adapter->bonding && adapter->bonding->hci_status) @@ -739,7 +740,7 @@ static void pincode_cb(struct agent *agent, DBusError *err, const char *pincode,  	}  	str2ba(adapter->address, &sba); -	str2ba(device->address, &dba); +	str2ba(destination, &dba);  	auth = adapter_find_auth_request(adapter, &dba); @@ -814,6 +815,7 @@ 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);  	/* No need to reply anything if the authentication already failed */  	if (adapter->bonding && adapter->bonding->hci_status) @@ -826,7 +828,7 @@ static void confirm_cb(struct agent *agent, DBusError *err, void *user_data)  	}  	memset(&cp, 0, sizeof(cp)); -	str2ba(device->address, &cp.bdaddr); +	str2ba(destination, &cp.bdaddr);  	auth = adapter_find_auth_request(adapter, &cp.bdaddr); @@ -854,6 +856,7 @@ 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);  	/* No need to reply anything if the authentication already failed */  	if (adapter->bonding && adapter->bonding->hci_status) @@ -865,7 +868,7 @@ static void passkey_cb(struct agent *agent, DBusError *err, uint32_t passkey,  		return;  	} -	str2ba(device->address, &dba); +	str2ba(destination, &dba);  	memset(&cp, 0, sizeof(cp));  	bacpy(&cp.bdaddr, &dba); @@ -1805,6 +1808,7 @@ void hcid_dbus_disconn_complete(bdaddr_t *local, uint8_t status,  	GSList *l;  	gboolean connected = FALSE;  	struct pending_auth_info *auth; +	const gchar *destination;  	if (status) {  		error("Disconnection failed: 0x%02x", status); @@ -1866,12 +1870,13 @@ void hcid_dbus_disconn_complete(bdaddr_t *local, uint8_t status,  	device = adapter_find_device(adapter, paddr);  	if (device) { +		destination = device_get_address(device);  		dbus_connection_emit_property_changed(connection,  					device->path, DEVICE_INTERFACE,  					"Connected", DBUS_TYPE_BOOLEAN,  					&connected);  		if (device->temporary) { -			debug("Removing temporary device %s", device->address); +			debug("Removing temporary device %s", destination);  			adapter_remove_device(connection, adapter, device);  		}  	} diff --git a/hcid/device.c b/hcid/device.c index 18248267..dffbdcde 100644 --- a/hcid/device.c +++ b/hcid/device.c @@ -936,6 +936,14 @@ struct adapter *device_get_adapter(struct device *device)  	return device->adapter;  } +const gchar *device_get_address(struct device *device) +{ +	if (!device) +		return NULL; + +	return device->address; +} +  int btd_register_device_driver(struct btd_device_driver *driver)  {  	const char **uuid; diff --git a/hcid/device.h b/hcid/device.h index c9a5cbc6..f83308dc 100644 --- a/hcid/device.h +++ b/hcid/device.h @@ -57,6 +57,7 @@ int device_browse(struct device *device, DBusConnection *conn,  			DBusMessage *msg, uuid_t *search);  void device_probe_drivers(struct device *device, GSList *uuids);  struct adapter *device_get_adapter(struct device *device); +const gchar *device_get_address(struct device *device);  #define BTD_UUIDS(args...) ((const char *[]) { args, NULL } )  | 
