radioshack-dmm: Integrate into serial-dmm

Use the infrastructure of serial-dmm to handle the RadioShack 22-812,
and completely remove radioshack-dmm.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
This commit is contained in:
Alexandru Gagniuc 2012-12-02 13:15:21 -06:00 committed by Uwe Hermann
parent 05f134abc2
commit 21829e6708
11 changed files with 50 additions and 599 deletions

View File

@ -31,7 +31,6 @@ SUBDIRS = \
hantek-dso \
link-mso19 \
openbench-logic-sniffer \
radioshack-dmm \
serial-dmm \
tondaj-sl-814 \
uni-t-dmm \

View File

@ -153,7 +153,7 @@ static gboolean checksum_valid(const struct rs9lcd_packet *rs_packet)
raw = (void *)rs_packet;
for (i = 0; i < RS_22_812_PACKET_SIZE - 1; i++)
for (i = 0; i < RS9LCD_PACKET_SIZE - 1; i++)
sum += raw[i];
/* This is just a funky constant added to the checksum. */

View File

@ -1,34 +0,0 @@
##
## This file is part of the sigrok project.
##
## Copyright (C) 2012 Bert Vermeulen <bert@biot.com>
## Copyright (C) 2012 Alexandru Gagniuc <mr.nuke.me@gmail.com>
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
##
if HW_RADIOSHACK_DMM
# Local lib, this is NOT meant to be installed!
noinst_LTLIBRARIES = libsigrokhwradioshackdmm.la
libsigrokhwradioshackdmm_la_SOURCES = \
api.c \
protocol.c \
protocol.h
libsigrokhwradioshackdmm_la_CFLAGS = \
-I$(top_srcdir)
endif

View File

@ -1,394 +0,0 @@
/*
* This file is part of the sigrok project.
*
* Copyright (C) 2012 Bert Vermeulen <bert@biot.com>
* Copyright (C) 2012 Alexandru Gagniuc <mr.nuke.me@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <glib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <errno.h>
#include "libsigrok.h"
#include "libsigrok-internal.h"
#include "protocol.h"
#define SERIALCOMM "4800/8n1"
static const int hwopts[] = {
SR_HWOPT_CONN,
SR_HWOPT_SERIALCOMM,
0,
};
static const int hwcaps[] = {
SR_HWCAP_MULTIMETER,
SR_HWCAP_LIMIT_SAMPLES,
SR_HWCAP_CONTINUOUS,
0,
};
static const char *probe_names[] = {
"Probe",
NULL,
};
SR_PRIV struct sr_dev_driver radioshackdmm_driver_info;
static struct sr_dev_driver *di = &radioshackdmm_driver_info;
/* Properly close and free all devices. */
static int clear_instances(void)
{
struct sr_dev_inst *sdi;
struct drv_context *drvc;
struct dev_context *devc;
GSList *l;
if (!(drvc = di->priv))
return SR_OK;
drvc = di->priv;
for (l = drvc->instances; l; l = l->next) {
if (!(sdi = l->data))
continue;
if (!(devc = sdi->priv))
continue;
sr_serial_dev_inst_free(devc->serial);
sr_dev_inst_free(sdi);
}
g_slist_free(drvc->instances);
drvc->instances = NULL;
return SR_OK;
}
static int hw_init(void)
{
struct drv_context *drvc;
if (!(drvc = g_try_malloc0(sizeof(struct drv_context)))) {
sr_err("Driver context malloc failed.");
return SR_ERR_MALLOC;
}
di->priv = drvc;
return SR_OK;
}
static gboolean packet_valid_wrap(const uint8_t *buf)
{
return sr_rs9lcd_packet_valid((void*)buf);
}
static GSList *rs_22_812_scan(const char *conn, const char *serialcomm)
{
struct sr_dev_inst *sdi;
struct drv_context *drvc;
struct dev_context *devc;
struct sr_probe *probe;
struct sr_serial_dev_inst *serial;
GSList *devices;
int ret;
size_t len, dropped;
uint8_t buf[128];
if (!(serial = sr_serial_dev_inst_new(conn, serialcomm)))
return NULL;
if (serial_open(serial, SERIAL_RDONLY | SERIAL_NONBLOCK) != SR_OK)
return NULL;
sr_info("Probing port '%s' readonly.", conn);
drvc = di->priv;
devices = NULL;
/*
* There's no way to get an ID from the multimeter. It just sends data
* periodically, so the best we can do is check if the packets match
* the expected format.
*/
serial_flush(serial);
/* Let's get a bit of data and see if we can find a packet. */
len = sizeof(buf);
/* 500ms gives us a window of two packets */
ret = serial_stream_detect(serial, buf, &len, RS_22_812_PACKET_SIZE,
packet_valid_wrap, 500, 4800);
if (ret != SR_OK)
goto scan_cleanup;
/* If we dropped more than two packets, something is wrong. */
dropped = len - RS_22_812_PACKET_SIZE;
if (dropped > 2 * RS_22_812_PACKET_SIZE)
goto scan_cleanup;
sr_info("Found RadioShack 22-812 on port '%s'.", conn);
if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, "RadioShack",
"22-812", "")))
goto scan_cleanup;
if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) {
sr_err("Device context malloc failed.");
goto scan_cleanup;
}
devc->serial = serial;
sdi->priv = devc;
sdi->driver = di;
if (!(probe = sr_probe_new(0, SR_PROBE_ANALOG, TRUE, "P1")))
goto scan_cleanup;
sdi->probes = g_slist_append(sdi->probes, probe);
drvc->instances = g_slist_append(drvc->instances, sdi);
devices = g_slist_append(devices, sdi);
scan_cleanup:
serial_close(serial);
return devices;
}
static GSList *hw_scan(GSList * options)
{
struct sr_hwopt *opt;
GSList *l, *devices;
const char *conn, *serialcomm;
conn = serialcomm = NULL;
for (l = options; l; l = l->next) {
opt = l->data;
switch (opt->hwopt) {
case SR_HWOPT_CONN:
conn = opt->value;
break;
case SR_HWOPT_SERIALCOMM:
serialcomm = opt->value;
break;
}
}
if (!conn)
return NULL;
if (serialcomm)
/* Use the provided comm specs. */
devices = rs_22_812_scan(conn, serialcomm);
else
/* Try the default. */
devices = rs_22_812_scan(conn, SERIALCOMM);
return devices;
}
static GSList *hw_dev_list(void)
{
struct drv_context *drvc;
drvc = di->priv;
return drvc->instances;
}
static int hw_dev_open(struct sr_dev_inst *sdi)
{
struct dev_context *devc;
if (!(devc = sdi->priv)) {
sr_err("sdi->priv was NULL.");
return SR_ERR_BUG;
}
if (serial_open(devc->serial, SERIAL_RDONLY | SERIAL_NONBLOCK) != SR_OK)
return SR_ERR;
sdi->status = SR_ST_ACTIVE;
return SR_OK;
}
static int hw_dev_close(struct sr_dev_inst *sdi)
{
struct dev_context *devc;
if (!(devc = sdi->priv)) {
sr_err("sdi->priv was NULL.");
return SR_ERR_BUG;
}
if (devc->serial && devc->serial->fd != -1) {
serial_close(devc->serial);
sdi->status = SR_ST_INACTIVE;
}
return SR_OK;
}
static int hw_cleanup(void)
{
clear_instances();
return SR_OK;
}
static int hw_info_get(int info_id, const void **data,
const struct sr_dev_inst *sdi)
{
(void)sdi;
switch (info_id) {
case SR_DI_HWOPTS:
*data = hwopts;
break;
case SR_DI_HWCAPS:
*data = hwcaps;
break;
case SR_DI_NUM_PROBES:
*data = GINT_TO_POINTER(1);
break;
case SR_DI_PROBE_NAMES:
*data = probe_names;
break;
default:
sr_err("Unknown info_id: %d.", info_id);
return SR_ERR_ARG;
}
return SR_OK;
}
static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
const void *value)
{
struct dev_context *devc;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR;
if (!(devc = sdi->priv)) {
sr_err("sdi->priv was NULL.");
return SR_ERR_BUG;
}
switch (hwcap) {
case SR_HWCAP_LIMIT_SAMPLES:
devc->limit_samples = *(const uint64_t *)value;
sr_dbg("Setting sample limit to %" PRIu64 ".",
devc->limit_samples);
break;
default:
sr_err("Unknown capability: %d.", hwcap);
return SR_ERR_ARG;
break;
}
return SR_OK;
}
static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
void *cb_data)
{
struct sr_datafeed_packet packet;
struct sr_datafeed_header header;
struct sr_datafeed_meta_analog meta;
struct dev_context *devc;
if (!(devc = sdi->priv)) {
sr_err("sdi->priv was NULL.");
return SR_ERR_BUG;
}
sr_dbg("Starting acquisition.");
devc->cb_data = cb_data;
/*
* Reset the number of samples to take. If we've already collected our
* quota, but we start a new session, and don't reset this, we'll just
* quit without aquiring any new samples.
*/
devc->num_samples = 0;
/* Send header packet to the session bus. */
sr_dbg("Sending SR_DF_HEADER.");
packet.type = SR_DF_HEADER;
packet.payload = (uint8_t *) & header;
header.feed_version = 1;
gettimeofday(&header.starttime, NULL);
sr_session_send(devc->cb_data, &packet);
/* Send metadata about the SR_DF_ANALOG packets to come. */
sr_dbg("Sending SR_DF_META_ANALOG.");
packet.type = SR_DF_META_ANALOG;
packet.payload = &meta;
meta.num_probes = 1;
sr_session_send(devc->cb_data, &packet);
/* Poll every 50ms, or whenever some data comes in. */
sr_source_add(devc->serial->fd, G_IO_IN, 50,
radioshack_dmm_receive_data, (void *)sdi);
return SR_OK;
}
static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
{
struct sr_datafeed_packet packet;
struct dev_context *devc;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR;
if (!(devc = sdi->priv)) {
sr_err("sdi->priv was NULL.");
return SR_ERR_BUG;
}
sr_dbg("Stopping acquisition.");
sr_source_remove(devc->serial->fd);
hw_dev_close((struct sr_dev_inst *)sdi);
/* Send end packet to the session bus. */
sr_dbg("Sending SR_DF_END.");
packet.type = SR_DF_END;
sr_session_send(cb_data, &packet);
return SR_OK;
}
SR_PRIV struct sr_dev_driver radioshackdmm_driver_info = {
.name = "radioshack-dmm",
.longname = "RadioShack 22-812/22-039 DMMs",
.api_version = 1,
.init = hw_init,
.cleanup = hw_cleanup,
.scan = hw_scan,
.dev_list = hw_dev_list,
.dev_clear = clear_instances,
.dev_open = hw_dev_open,
.dev_close = hw_dev_close,
.info_get = hw_info_get,
.dev_config_set = hw_dev_config_set,
.dev_acquisition_start = hw_dev_acquisition_start,
.dev_acquisition_stop = hw_dev_acquisition_stop,
.priv = NULL,
};

View File

@ -1,115 +0,0 @@
/*
* This file is part of the sigrok project.
*
* Copyright (C) 2012 Bert Vermeulen <bert@biot.com>
* Copyright (C) 2012 Alexandru Gagniuc <mr.nuke.me@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <errno.h>
#include <glib.h>
#include "libsigrok.h"
#include "libsigrok-internal.h"
#include "protocol.h"
static void handle_packet(const uint8_t *rs_packet,
struct dev_context *devc)
{
float rawval;
struct sr_datafeed_packet packet;
struct sr_datafeed_analog *analog;
/* TODO: Check malloc return value. */
analog = g_try_malloc0(sizeof(struct sr_datafeed_analog));
/* TODO: Check malloc return value. */
analog->num_samples = 1;
analog->mq = -1;
sr_rs9lcd_parse(rs_packet, &rawval, analog, NULL);
analog->data = &rawval;
if (analog->mq != -1) {
/* Got a measurement. */
sr_spew("Value: %f.", rawval);
packet.type = SR_DF_ANALOG;
packet.payload = analog;
sr_session_send(devc->cb_data, &packet);
devc->num_samples++;
}
g_free(analog);
}
static void handle_new_data(struct dev_context *devc)
{
int len;
size_t i, offset = 0;
uint8_t *rs_packet;
/* Try to get as much data as the buffer can hold. */
len = RS_DMM_BUFSIZE - devc->buflen;
len = serial_read(devc->serial, devc->buf + devc->buflen, len);
if (len < 1) {
sr_err("Serial port read error.");
return;
}
devc->buflen += len;
/* Now look for packets in that data. */
while ((devc->buflen - offset) >= RS_22_812_PACKET_SIZE) {
rs_packet = (void *)(devc->buf + offset);
if (sr_rs9lcd_packet_valid(rs_packet)) {
handle_packet(rs_packet, devc);
offset += RS_22_812_PACKET_SIZE;
} else {
offset++;
}
}
/* If we have any data left, move it to the beginning of our buffer. */
for (i = 0; i < devc->buflen - offset; i++)
devc->buf[i] = devc->buf[offset + i];
devc->buflen -= offset;
}
SR_PRIV int radioshack_dmm_receive_data(int fd, int revents, void *cb_data)
{
struct sr_dev_inst *sdi;
struct dev_context *devc;
(void)fd;
if (!(sdi = cb_data))
return TRUE;
if (!(devc = sdi->priv))
return TRUE;
if (revents == G_IO_IN) {
/* Serial data arrived. */
handle_new_data(devc);
}
if (devc->num_samples >= devc->limit_samples) {
sdi->driver->dev_acquisition_stop(sdi, cb_data);
return TRUE;
}
return TRUE;
}

View File

@ -1,52 +0,0 @@
/*
* This file is part of the sigrok project.
*
* Copyright (C) 2012 Bert Vermeulen <bert@biot.com>
* Copyright (C) 2012 Alexandru Gagniuc <mr.nuke.me@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LIBSIGROK_HARDWARE_RADIOSHACK_DMM_PROTOCOL_H
#define LIBSIGROK_HARDWARE_RADIOSHACK_DMM_PROTOCOL_H
/* Message logging helpers with driver-specific prefix string. */
#define DRIVER_LOG_DOMAIN "radioshack-dmm: "
#define sr_log(l, s, args...) sr_log(l, DRIVER_LOG_DOMAIN s, ## args)
#define sr_spew(s, args...) sr_spew(DRIVER_LOG_DOMAIN s, ## args)
#define sr_dbg(s, args...) sr_dbg(DRIVER_LOG_DOMAIN s, ## args)
#define sr_info(s, args...) sr_info(DRIVER_LOG_DOMAIN s, ## args)
#define sr_warn(s, args...) sr_warn(DRIVER_LOG_DOMAIN s, ## args)
#define sr_err(s, args...) sr_err(DRIVER_LOG_DOMAIN s, ## args)
#define RS_DMM_BUFSIZE 256
/* Private, per-device-instance driver context. */
struct dev_context {
uint64_t limit_samples;
struct sr_serial_dev_inst *serial;
/* Opaque pointer passed in by the frontend. */
void *cb_data;
/* Runtime. */
uint64_t num_samples;
uint8_t buf[RS_DMM_BUFSIZE];
size_t bufoffset;
size_t buflen;
};
SR_PRIV int radioshack_dmm_receive_data(int fd, int revents, void *cb_data);
#endif

View File

@ -57,6 +57,7 @@ SR_PRIV struct sr_dev_driver metex_m3640d_driver_info;
SR_PRIV struct sr_dev_driver peaktech_4370_driver_info;
SR_PRIV struct sr_dev_driver pce_pce_dm32_driver_info;
SR_PRIV struct sr_dev_driver radioshack_22_168_driver_info;
SR_PRIV struct sr_dev_driver radioshack_22_812_driver_info;
static struct sr_dev_driver *di_dt4000zc = &digitek_dt4000zc_driver_info;
static struct sr_dev_driver *di_tp4000zc = &tekpower_tp4000zc_driver_info;
@ -68,6 +69,7 @@ static struct sr_dev_driver *di_m3640d = &metex_m3640d_driver_info;
static struct sr_dev_driver *di_4370 = &peaktech_4370_driver_info;
static struct sr_dev_driver *di_pce_dm32 = &pce_pce_dm32_driver_info;
static struct sr_dev_driver *di_22_168 = &radioshack_22_168_driver_info;
static struct sr_dev_driver *di_22_812 = &radioshack_22_812_driver_info;
/* After hw_init() this will point to a device-specific entry (see above). */
static struct sr_dev_driver *di = NULL;
@ -133,6 +135,12 @@ SR_PRIV struct dmm_info dmms[] = {
sr_metex14_packet_valid, sr_metex14_parse,
NULL,
},
{
"RadioShack", "22-812", "4800/8n1/rts=0/dtr=1", 4800,
RS9LCD_PACKET_SIZE, NULL,
sr_rs9lcd_packet_valid, sr_rs9lcd_parse,
NULL,
},
};
/* Properly close and free all devices. */
@ -190,6 +198,8 @@ static int hw_init(int dmm)
di = di_pce_dm32;
if (dmm == RADIOSHACK_22_168)
di = di_22_168;
if (dmm == RADIOSHACK_22_812)
di = di_22_812;
sr_dbg("Selected '%s' subdriver.", di->name);
di->priv = drvc;
@ -247,6 +257,11 @@ static int hw_init_radioshack_22_168(void)
return hw_init(RADIOSHACK_22_168);
}
static int hw_init_radioshack_22_812(void)
{
return hw_init(RADIOSHACK_22_812);
}
static GSList *scan(const char *conn, const char *serialcomm, int dmm)
{
struct sr_dev_inst *sdi;
@ -374,6 +389,8 @@ static GSList *hw_scan(GSList *options)
dmm = 8;
if (!strcmp(di->name, "radioshack-22-168"))
dmm = 9;
if (!strcmp(di->name, "radioshack-22-812"))
dmm = 10;
if (serialcomm) {
/* Use the provided comm specs. */
@ -549,6 +566,8 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
receive_data = pce_pce_dm32_receive_data;
if (!strcmp(di->name, "radioshack-22-168"))
receive_data = radioshack_22_168_receive_data;
if (!strcmp(di->name, "radioshack-22-812"))
receive_data = radioshack_22_812_receive_data;
/* Poll every 50ms, or whenever some data comes in. */
sr_source_add(devc->serial->fd, G_IO_IN, 50,
@ -762,3 +781,21 @@ SR_PRIV struct sr_dev_driver radioshack_22_168_driver_info = {
.dev_acquisition_stop = hw_dev_acquisition_stop,
.priv = NULL,
};
SR_PRIV struct sr_dev_driver radioshack_22_812_driver_info = {
.name = "radioshack-22-812",
.longname = "RadioShack 22-812",
.api_version = 1,
.init = hw_init_radioshack_22_812,
.cleanup = hw_cleanup,
.scan = hw_scan,
.dev_list = hw_dev_list,
.dev_clear = clear_instances,
.dev_open = hw_dev_open,
.dev_close = hw_dev_close,
.info_get = hw_info_get,
.dev_config_set = hw_dev_config_set,
.dev_acquisition_start = hw_dev_acquisition_start,
.dev_acquisition_stop = hw_dev_acquisition_stop,
.priv = NULL,
};

View File

@ -244,3 +244,9 @@ SR_PRIV int radioshack_22_168_receive_data(int fd, int revents, void *cb_data)
struct metex14_info info;
return receive_data(fd, revents, RADIOSHACK_22_168, &info, cb_data);
}
SR_PRIV int radioshack_22_812_receive_data(int fd, int revents, void *cb_data)
{
struct metex14_info info;
return receive_data(fd, revents, RADIOSHACK_22_812, &info, cb_data);
}

View File

@ -41,9 +41,10 @@ enum {
PEAKTECH_4370,
PCE_PCE_DM32,
RADIOSHACK_22_168,
RADIOSHACK_22_812,
};
#define DMM_COUNT 10
#define DMM_COUNT 11
struct dmm_info {
char *vendor;
@ -90,6 +91,7 @@ SR_PRIV int metex_m3640d_receive_data(int fd, int revents, void *cb_data);
SR_PRIV int peaktech_4370_receive_data(int fd, int revents, void *cb_data);
SR_PRIV int pce_pce_dm32_receive_data(int fd, int revents, void *cb_data);
SR_PRIV int radioshack_22_168_receive_data(int fd, int revents, void *cb_data);
SR_PRIV int radioshack_22_812_receive_data(int fd, int revents, void *cb_data);
SR_PRIV void dmm_details_tp4000zc(struct sr_datafeed_analog *analog, void *info);
SR_PRIV void dmm_details_dt4000zc(struct sr_datafeed_analog *analog, void *info);

View File

@ -124,6 +124,7 @@ extern SR_PRIV struct sr_dev_driver metex_m3640d_driver_info;
extern SR_PRIV struct sr_dev_driver peaktech_4370_driver_info;
extern SR_PRIV struct sr_dev_driver pce_pce_dm32_driver_info;
extern SR_PRIV struct sr_dev_driver radioshack_22_168_driver_info;
extern SR_PRIV struct sr_dev_driver radioshack_22_812_driver_info;
#endif
#ifdef HAVE_HW_UNI_T_DMM
extern SR_PRIV struct sr_dev_driver uni_t_ut61d_driver_info;
@ -188,6 +189,7 @@ static struct sr_dev_driver *drivers_list[] = {
&peaktech_4370_driver_info,
&pce_pce_dm32_driver_info,
&radioshack_22_168_driver_info,
&radioshack_22_812_driver_info,
#endif
#ifdef HAVE_HW_UNI_T_DMM
&uni_t_ut61d_driver_info,

View File

@ -207,7 +207,7 @@ SR_PRIV int sr_metex14_parse(const uint8_t *buf, float *floatval,
/*--- hardware/common/dmm/rs9lcd.c ------------------------------------------*/
#define RS_22_812_PACKET_SIZE 9
#define RS9LCD_PACKET_SIZE 9
SR_PRIV gboolean sr_rs9lcd_packet_valid(const uint8_t *buf);
SR_PRIV int sr_rs9lcd_parse(const uint8_t *buf, float *floatval,