Do not turn IDLE LED off when port closed and target already detached

This commit is contained in:
fabalthazar 2021-12-02 21:33:46 +01:00 committed by Piotr Esden-Tempski
parent e6075d4bd3
commit 74b4b863c1
1 changed files with 5 additions and 2 deletions

View File

@ -117,8 +117,11 @@ int gdb_main_loop(struct target_controller *tc, bool in_syscall)
while (1) { while (1) {
SET_IDLE_STATE(1); SET_IDLE_STATE(1);
size_t size = gdb_getpacket(pbuf, BUF_SIZE); size_t size = gdb_getpacket(pbuf, BUF_SIZE);
SET_IDLE_STATE(0); // If port closed and target detached, stay idle
switch (pbuf[0]) { if ((pbuf[0] != 0x04) || cur_target) {
SET_IDLE_STATE(0);
}
switch(pbuf[0]) {
/* Implementation of these is mandatory! */ /* Implementation of these is mandatory! */
case 'g': { /* 'g': Read general registers */ case 'g': { /* 'g': Read general registers */
ERROR_IF_NO_TARGET(); ERROR_IF_NO_TARGET();