dmm/metex14: unbreak packet request helper return code

Return SR_OK in case of successful transmission of a packet request. The
previous implementation passed the serial layer's verbatim return value,
which was non-negative non-null (read: above zero) in case of success,
which is none of the expected return codes of a packet request routine.

This amends commit 379e95c587 and completes the adjustment which was
started in commit a4be2b327b. The issue has gone unnoticed in the past
since it took not effect. The serial-dmm caller only tested for negative
return values.
This commit is contained in:
Gerhard Sittig 2020-10-06 20:59:27 +02:00
parent 1f8ef363cb
commit d7838e4804
1 changed files with 10 additions and 1 deletions

View File

@ -332,10 +332,19 @@ static gboolean flags_valid(const struct metex14_info *info)
SR_PRIV int sr_metex14_packet_request(struct sr_serial_dev_inst *serial)
{
const uint8_t wbuf = 'D';
size_t wrlen;
int ret;
sr_spew("Requesting DMM packet.");
return serial_write_blocking(serial, &wbuf, 1, 0);
wrlen = sizeof(wbuf);
ret = serial_write_blocking(serial, &wbuf, wrlen, 0);
if (ret < 0)
return ret;
if ((size_t)ret != wrlen)
return SR_ERR_IO;
return SR_OK;
}
#endif