Diff between 17a68a3f7e1a25b7e248ea4652027632aeb1915c and 473ea45a0d819ae489c448ba28d95cbcfdb5530d

Changed Files

File Additions Deletions Status
src/mgmt.c +22 -12 modified

Full Patch

diff --git a/src/mgmt.c b/src/mgmt.c
index 880ef90..84da37d 100644
--- a/src/mgmt.c
+++ b/src/mgmt.c
@@ -333,7 +333,7 @@ static inline int mgmt_low_energy(uint32_t settings)
 
 static void update_settings(struct btd_adapter *adapter, uint32_t settings)
 {
-	DBG("new settings %x", settings);
+	DBG("new settings 0x%08x", settings);
 
 	adapter_update_connectable(adapter, mgmt_connectable(settings));
 	adapter_update_discoverable(adapter, mgmt_discoverable(settings));
@@ -371,8 +371,6 @@ static void mgmt_new_settings(uint16_t index, void *buf, size_t len)
 		return;
 	}
 
-	DBG("hci%u new settings", index);
-
 	if (index > max_index) {
 		error("Unexpected index %u in new_settings event", index);
 		return;
@@ -388,6 +386,8 @@ static void mgmt_new_settings(uint16_t index, void *buf, size_t len)
 
 	settings = bt_get_le32(ev);
 
+	DBG("index %d settings 0x%08x", index, settings);
+
 	old_power = mgmt_powered(info->current_settings);
 	new_power = mgmt_powered(settings);
 
@@ -1484,13 +1484,14 @@ static void mgmt_update_cod(uint16_t index, void *buf, size_t len)
 	struct controller_info *info;
 	struct btd_adapter *adapter;
 
-	DBG("index %d", index);
-
 	if (len < sizeof(*rp)) {
 		error("Too small class of device reply");
 		return;
 	}
 
+	DBG("index %d class 0x%02x%02x%02x", index,
+					rp->val[2], rp->val[1], rp->val[0]);
+
 	info = &controllers[index];
 
 	adapter = manager_find_adapter(&info->bdaddr);
@@ -1529,13 +1530,24 @@ static void mgmt_remove_uuid_complete(uint16_t index, void *buf, size_t len)
 	handle_pending_uuids(index);
 }
 
+static void mgmt_set_dev_class_complete(uint16_t index, void *buf, size_t len)
+{
+        DBG("index %d", index);
+
+	if (index > max_index) {
+		error("Unexpected index %u in set_dev_class_complete event",
+									index);
+		return;
+	}
+
+	mgmt_update_cod(index, buf, len);
+}
+
 static void mgmt_cmd_complete(uint16_t index, void *buf, size_t len)
 {
 	struct mgmt_ev_cmd_complete *ev = buf;
 	uint16_t opcode;
 
-	DBG("");
-
 	if (len < sizeof(*ev)) {
 		error("Too small management command complete event packet");
 		return;
@@ -1545,6 +1557,8 @@ static void mgmt_cmd_complete(uint16_t index, void *buf, size_t len)
 
 	len -= sizeof(*ev);
 
+	DBG("opcode 0x%04x status 0x%02x len %zu", opcode, ev->status, len);
+
 	switch (opcode) {
 	case MGMT_OP_READ_VERSION:
 		read_version_complete(ev->data, len);
@@ -1580,7 +1594,7 @@ static void mgmt_cmd_complete(uint16_t index, void *buf, size_t len)
 		mgmt_remove_uuid_complete(index, ev->data, len);
 		break;
 	case MGMT_OP_SET_DEV_CLASS:
-		mgmt_update_cod(index, buf, len);
+		mgmt_set_dev_class_complete(index, ev->data, len);
 		break;
 	case MGMT_OP_LOAD_LINK_KEYS:
 		DBG("load_link_keys complete");
@@ -2066,8 +2080,6 @@ static gboolean mgmt_event(GIOChannel *channel, GIOCondition cond,
 	ssize_t ret;
 	uint16_t len, opcode, index;
 
-	DBG("cond %d", cond);
-
 	if (cond & G_IO_NVAL)
 		return FALSE;
 
@@ -2083,8 +2095,6 @@ static gboolean mgmt_event(GIOChannel *channel, GIOCondition cond,
 		return TRUE;
 	}
 
-	DBG("Received %zd bytes from management socket", ret);
-
 	if (ret < MGMT_HDR_SIZE) {
 		error("Too small Management packet");
 		return TRUE;