Skip to content

Commit 6a8f93c

Browse files
author
Martin.JM
committed
Improve Korad IDN
1 parent 8643cdc commit 6a8f93c

File tree

1 file changed

+10
-6
lines changed
  • src/hardware/korad-kaxxxxp

1 file changed

+10
-6
lines changed

src/hardware/korad-kaxxxxp/api.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -281,13 +281,17 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
281281
sr_dbg("Want max %zu bytes.", len);
282282

283283
/*
284-
* There is a quirk rolled into here:
285-
* - The KORAD_QUIRK_NEWLINE needs a `\n`
286-
* If there's more at the end they still function perfectly fine.
287-
* But the normal ones need an `*IDN?` without anything at the end.
288-
* So this sends a combination that satisfies these constraints.
284+
* For the identification we send two messages due to the newline quirk
285+
* The first works on devices that require no newline to be there
286+
* The second adds support for devices that require the newline to be there
287+
* The timeout makes sure the former devices handle the cmd first
289288
*/
290-
ret = korad_kaxxxxp_send_cmd(serial, "*IDN?\n*IDN?", false);
289+
ret = korad_kaxxxxp_send_cmd(serial, "*IDN?", false);
290+
if (ret < 0)
291+
return NULL;
292+
293+
g_usleep(100000);
294+
ret = korad_kaxxxxp_send_cmd(serial, "\n", false);
291295
if (ret < 0)
292296
return NULL;
293297

0 commit comments

Comments
 (0)