From f0a8b8a3e3ef51ec2440de0e9c8298a34aad4869 Mon Sep 17 00:00:00 2001 From: ALTracer Date: Mon, 6 Nov 2023 22:52:48 +0300 Subject: [PATCH] hosted/jlink: fixup! Query and log extended capabilities * Try to print extended capabilities. If the adapter doesn't advertise support for them, then just print standard capabilities, like it was before. --- src/platforms/hosted/jlink.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/platforms/hosted/jlink.c b/src/platforms/hosted/jlink.c index 69a9eb817e4..58399782c15 100644 --- a/src/platforms/hosted/jlink.c +++ b/src/platforms/hosted/jlink.c @@ -333,10 +333,9 @@ static bool jlink_get_extended_capabilities(void) return false; uint32_t ext_caps[4]; - ext_caps[0] = read_le4(buffer, 0); - ext_caps[1] = read_le4(buffer, 4); - ext_caps[2] = read_le4(buffer, 8); - ext_caps[3] = read_le4(buffer, 12); + for (size_t i = 0; i < 4; i++) + ext_caps[i] = read_le4(buffer, i * 4U); + DEBUG_INFO("Extended capabilities: 0x%08" PRIx32, ext_caps[0]); DEBUG_INFO(" 0x%08" PRIx32 " 0x%08" PRIx32 " 0x%08" PRIx32 "\n", ext_caps[1], ext_caps[2], ext_caps[3]); @@ -350,11 +349,10 @@ static bool jlink_get_capabilities(void) return false; jlink.capabilities = read_le4(buffer, 0); - DEBUG_INFO("Capabilities: 0x%08" PRIx32 "\n", jlink.capabilities); - if (jlink.capabilities & JLINK_CAPABILITY_EXTENDED_CAPABILITIES) - jlink_get_extended_capabilities(); + return jlink_get_extended_capabilities(); + DEBUG_INFO("Capabilities: 0x%08" PRIx32 "\n", jlink.capabilities); return true; }