The follow patch adds support for the Velleman LABPS3005DN device that I
acquired about a month ago. The protocol is slightly different from all the
other korad-kaxxxxp devices. Most notably, the device requires '\n' to be sent
literally (0x5c, 0x6e) - not sure how they let that happen.

With this patch, I can set the voltage, toggle the voltage output, identify the
device, and measure the voltage and amperage over time.

My question is -- what would the best way to integrate support in the
korad-kaxxxxp driver? Some flag to enable quircks for this device?

I will have to rework the patch to not blindly add the literal newline
characters for outgoing and not blindly strip the actual newline character for
incoming data, as well, of course.

Identification:

<  2a 49 44 4e 3f 5c 6e          | *IDN?\n
>  51 4a 45 33 30 30 35 50 56 31 | QJE3005PV1
>  2e 30 0a                      | .0

This, in comparison, does not work:

<  2a 49 44 4e 3f 0a             | *IDN?

(Nothing is sent)

Also, the OUT command is now named OUTPUT, and the STATUS command returns three
bytes as opposed to one:

<  4f 55 54 50 55 54 30 5c 6e 53 | OUTPUT0\nS
<  54 41 54 55 53 3f 5c 6e       | TATUS?\n
>  31 30 30 0a                   | 100
<  4f 55 54 50 55 54 31 5c 6e 53 | OUTPUT1\nS
<  54 41 54 55 53 3f 5c 6e       | TATUS?\n
>  31 31 30 0a                   | 110

I know all of this seems ridiculous and makes me seem like a fool, but I've
observed the Windows software on the CD that accompanied this device do the same
thing. This from the Console output of their Windows software V1.0.5.622
running in WINE:

Send: 56 53 45 54 31 3A 30 34 2E 32 30 5C 6E
2020-05-19 14:13:12,441 [1] INFO  VellemanLABPS3005DNLite.Console  - VSET1:04.20

Which is:

>>> ''.join([chr(x) for x in [0x56, 0x53, 0x45, 0x54, 0x31, 0x3A, 0x30, 0x34, 
>>> 0x2E, 0x32, 0x30, 0x5C, 0x6E]])
'VSET1:04.20\\n'

Sniffing with portmon.exe on Windows shows the same behaviour, so this is not a
Linux driver bug or a WINE bug, as far as I can tell.


Merlijn Wajer (1):
  HACK: korad-kaxxxxp: support VELLEMAN_LABPS3005DN (QJE3005PV1.0)

 src/hardware/korad-kaxxxxp/api.c      |  2 ++
 src/hardware/korad-kaxxxxp/protocol.c | 21 +++++++++++++++------
 src/hardware/korad-kaxxxxp/protocol.h |  1 +
 3 files changed, 18 insertions(+), 6 deletions(-)

-- 
2.24.1



_______________________________________________
sigrok-devel mailing list
sigrok-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sigrok-devel

Reply via email to