Fix Class of Device setting when InitiallyPowered=false
We should only try to derive the major/minor class from
adapter->wanted_cod when the adapter has been fully initialized. If the
adapter isn't initialized wanted_cod will most likely only contain service
class bits so we should instead try to get the necessary major/minor class
from the storage.
diff --git a/src/adapter.c b/src/adapter.c
index 6ba5e56..0ecf62a 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -1878,7 +1878,7 @@
strncpy((char *) adapter->dev.name, name, MAX_NAME_LENGTH);
/* Set device class */
- if (adapter->wanted_cod) {
+ if (adapter->initialized && adapter->wanted_cod) {
cls[1] = (adapter->wanted_cod >> 8) & 0xff;
cls[0] = adapter->wanted_cod & 0xff;
} else if (read_local_class(&adapter->bdaddr, cls) < 0) {