diff --git a/plugins/mgmtops.c b/plugins/mgmtops.c
index ff5ee3e..e9c6f0b 100644
--- a/plugins/mgmtops.c
+++ b/plugins/mgmtops.c
gboolean pending_class;
uint8_t major;
uint8_t minor;
+
+ gboolean pending_powered;
} *controllers = NULL;
static int mgmt_sock = -1;
static int mgmt_set_powered(int index, gboolean powered)
{
- DBG("index %d powered %d", index, powered);
+ struct controller_info *info = &controllers[index];
+
+ DBG("index %d powered %d pending_uuid %u", index, powered,
+ info->pending_uuid);
+
+ if (powered) {
+ if (info->pending_uuid) {
+ info->pending_powered = TRUE;
+ return 0;
+ }
+ } else {
+ info->pending_powered = FALSE;
+ }
+
return mgmt_set_mode(index, MGMT_OP_SET_POWERED, powered);
}
mgmt_set_dev_class(index, info->major, info->minor);
}
+ if (info->pending_powered) {
+ info->pending_powered = FALSE;
+ mgmt_set_powered(index, 1);
+ }
+
return;
}