[PATCH 4/8] android/bluetooth: Refactor send_remote_device_name_prop

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Rename send_remote_device_name_prop to get_device_name and make it
accept struct device as parameter. Also return HAL status code.
This will allow to use this function also in get device property
command handler.
---
 android/bluetooth.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/android/bluetooth.c b/android/bluetooth.c
index 4ceb40f..879cf8d 100644
--- a/android/bluetooth.c
+++ b/android/bluetooth.c
@@ -558,19 +558,16 @@ static void new_link_key_callback(uint16_t index, uint16_t length,
 	browse_remote_sdp(&addr->bdaddr);
 }
 
-static void send_remote_device_name_prop(const bdaddr_t *bdaddr)
+static uint8_t get_device_name(struct device *dev)
 {
 	struct hal_ev_remote_device_props *ev;
-	struct device *dev;
 	size_t ev_len;
 
-	dev = get_device(bdaddr);
-
 	ev_len = BASELEN_REMOTE_DEV_PROP + strlen(dev->name);
 	ev = g_malloc0(ev_len);
 
 	ev->status = HAL_STATUS_SUCCESS;
-	bdaddr2android(bdaddr, ev->bdaddr);
+	bdaddr2android(&dev->bdaddr, ev->bdaddr);
 	ev->num_props = 1;
 	ev->props[0].type = HAL_PROP_DEVICE_NAME;
 	ev->props[0].len = strlen(dev->name);
@@ -580,6 +577,8 @@ static void send_remote_device_name_prop(const bdaddr_t *bdaddr)
 								ev_len, ev);
 
 	g_free(ev);
+
+	return HAL_STATUS_SUCCESS;
 }
 
 static void pin_code_request_callback(uint16_t index, uint16_t length,
@@ -598,7 +597,7 @@ static void pin_code_request_callback(uint16_t index, uint16_t length,
 
 	/* Workaround for Android Bluetooth.apk issue: send remote
 	 * device property */
-	send_remote_device_name_prop(&ev->addr.bdaddr);
+	get_device_name(get_device(&ev->addr.bdaddr));
 
 	set_device_bond_state(&ev->addr.bdaddr, HAL_STATUS_SUCCESS,
 						HAL_BOND_STATE_BONDING);
-- 
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux