case 0x04:
str = "Connection terminated due to authentication failure";
break;
+ case 0x05:
+ str = "Connection terminated by local host for suspend";
+ break;
default:
str = "Reserved";
break;
mgmt_print_added_device_flags("Current Flags", current_flags);
}
+static void mgmt_controller_suspend_evt(const void *data, uint16_t size)
+{
+ uint8_t state = get_u8(data);
+ char *str;
+
+ switch (state) {
+ case 0x0:
+ str = "Controller running (failed to suspend)";
+ break;
+ case 0x1:
+ str = "Disconnected and not scanning";
+ break;
+ case 0x2:
+ str = "Page scanning and/or passive scanning";
+ break;
+ default:
+ str = "Unknown suspend state";
+ break;
+ }
+
+ print_field("Suspend state: %s (%d)", str, state);
+}
+
+static void mgmt_controller_resume_evt(const void *data, uint16_t size)
+{
+ uint8_t addr_type = get_u8(data + 6);
+ uint8_t wake_reason = get_u8(data + 7);
+ char *str;
+
+ switch (wake_reason) {
+ case 0x0:
+ str = "Resume from non-Bluetooth wake source";
+ break;
+ case 0x1:
+ str = "Wake due to unexpected event";
+ break;
+ case 0x2:
+ str = "Remote wake due to peer device connection";
+ break;
+ default:
+ str = "Unknown wake reason";
+ break;
+ }
+
+ print_field("Wake reason: %s (%d)", str, wake_reason);
+ mgmt_print_address(data, addr_type);
+}
+
static const struct mgmt_data mgmt_event_table[] = {
{ 0x0001, "Command Complete",
mgmt_command_complete_evt, 3, false },
mgmt_exp_feature_changed_evt, 20, true },
{ 0x002a, "Device Flags Changed",
mgmt_device_flags_changed_evt, 15, true },
+ { 0x002d, "Controller Suspended",
+ mgmt_controller_suspend_evt, 1, true },
+ { 0x002e, "Controller Resumed",
+ mgmt_controller_resume_evt, 8, true },
{ }
};