uni-t-dmm: Make driver more similar to serial-dmm.
This commit is contained in:
parent
7381251e33
commit
c885268777
|
@ -40,14 +40,27 @@ static const int32_t hwcaps[] = {
|
||||||
SR_PRIV struct sr_dev_driver uni_t_ut61d_driver_info;
|
SR_PRIV struct sr_dev_driver uni_t_ut61d_driver_info;
|
||||||
SR_PRIV struct sr_dev_driver voltcraft_vc820_driver_info;
|
SR_PRIV struct sr_dev_driver voltcraft_vc820_driver_info;
|
||||||
|
|
||||||
static struct sr_dev_driver *di_ut61d = &uni_t_ut61d_driver_info;
|
SR_PRIV struct dmm_info udmms[] = {
|
||||||
static struct sr_dev_driver *di_vc820 = &voltcraft_vc820_driver_info;
|
{
|
||||||
|
"UNI-T", "UT61D", 19230 /* TODO */,
|
||||||
|
FS9922_PACKET_SIZE, NULL,
|
||||||
|
sr_fs9922_packet_valid, sr_fs9922_parse,
|
||||||
|
NULL,
|
||||||
|
&uni_t_ut61d_driver_info, receive_data_UNI_T_UT61D,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Voltcraft VC-820", "VC-820", 19200 /* TODO */,
|
||||||
|
FS9721_PACKET_SIZE, NULL,
|
||||||
|
sr_fs9721_packet_valid, sr_fs9721_parse,
|
||||||
|
NULL,
|
||||||
|
&voltcraft_vc820_driver_info, receive_data_VOLTCRAFT_VC820,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
/* After hw_init() this will point to a device-specific entry (see above). */
|
static int clear_instances(int dmm)
|
||||||
static struct sr_dev_driver *di = NULL;
|
|
||||||
|
|
||||||
static int clear_instances(void)
|
|
||||||
{
|
{
|
||||||
|
(void)dmm;
|
||||||
|
|
||||||
/* TODO: Use common code later. */
|
/* TODO: Use common code later. */
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
|
@ -55,26 +68,12 @@ static int clear_instances(void)
|
||||||
|
|
||||||
static int hw_init(struct sr_context *sr_ctx, int dmm)
|
static int hw_init(struct sr_context *sr_ctx, int dmm)
|
||||||
{
|
{
|
||||||
if (dmm == UNI_T_UT61D)
|
sr_dbg("Selected '%s' subdriver.", udmms[dmm].di->name);
|
||||||
di = di_ut61d;
|
|
||||||
else if (dmm == VOLTCRAFT_VC820)
|
|
||||||
di = di_vc820;
|
|
||||||
sr_dbg("Selected '%s' subdriver.", di->name);
|
|
||||||
|
|
||||||
return std_hw_init(sr_ctx, di, DRIVER_LOG_DOMAIN);
|
return std_hw_init(sr_ctx, uddms[dmm].di, DRIVER_LOG_DOMAIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hw_init_ut61d(struct sr_context *sr_ctx)
|
static GSList *hw_scan(GSList *options, int dmm)
|
||||||
{
|
|
||||||
return hw_init(sr_ctx, UNI_T_UT61D);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int hw_init_vc820(struct sr_context *sr_ctx)
|
|
||||||
{
|
|
||||||
return hw_init(sr_ctx, VOLTCRAFT_VC820);
|
|
||||||
}
|
|
||||||
|
|
||||||
static GSList *hw_scan(GSList *options)
|
|
||||||
{
|
{
|
||||||
GSList *usb_devices, *devices, *l;
|
GSList *usb_devices, *devices, *l;
|
||||||
struct sr_dev_inst *sdi;
|
struct sr_dev_inst *sdi;
|
||||||
|
@ -87,10 +86,10 @@ static GSList *hw_scan(GSList *options)
|
||||||
|
|
||||||
(void)options;
|
(void)options;
|
||||||
|
|
||||||
drvc = di->priv;
|
drvc = udmms[dmm].di->priv;
|
||||||
|
|
||||||
/* USB scan is always authoritative. */
|
/* USB scan is always authoritative. */
|
||||||
clear_instances();
|
clear_instances(dmm);
|
||||||
|
|
||||||
conn = NULL;
|
conn = NULL;
|
||||||
for (l = options; l; l = l->next) {
|
for (l = options; l; l = l->next) {
|
||||||
|
@ -119,12 +118,12 @@ static GSList *hw_scan(GSList *options)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE,
|
if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE,
|
||||||
di->longname, NULL, NULL))) {
|
udmms[dmm].vendor, udmms[dmm].device, NULL))) {
|
||||||
sr_err("sr_dev_inst_new returned NULL.");
|
sr_err("sr_dev_inst_new returned NULL.");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
sdi->priv = devc;
|
sdi->priv = devc;
|
||||||
sdi->driver = di;
|
sdi->driver = udmms[dmm].di;
|
||||||
if (!(probe = sr_probe_new(0, SR_PROBE_ANALOG, TRUE, "P1")))
|
if (!(probe = sr_probe_new(0, SR_PROBE_ANALOG, TRUE, "P1")))
|
||||||
return NULL;
|
return NULL;
|
||||||
sdi->probes = g_slist_append(sdi->probes, probe);
|
sdi->probes = g_slist_append(sdi->probes, probe);
|
||||||
|
@ -138,18 +137,18 @@ static GSList *hw_scan(GSList *options)
|
||||||
return devices;
|
return devices;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GSList *hw_dev_list(void)
|
static GSList *hw_dev_list(int dmm)
|
||||||
{
|
{
|
||||||
return ((struct drv_context *)(di->priv))->instances;
|
return ((struct drv_context *)(udmms[dmm]->priv))->instances;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hw_dev_open(struct sr_dev_inst *sdi)
|
static int hw_dev_open(struct sr_dev_inst *sdi, int dmm)
|
||||||
{
|
{
|
||||||
struct drv_context *drvc;
|
struct drv_context *drvc;
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
drvc = di->priv;
|
drvc = udmms[dmm].di->priv;
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
if ((ret = sr_usb_open(drvc->sr_ctx->libusb_ctx, devc->usb)) == SR_OK)
|
if ((ret = sr_usb_open(drvc->sr_ctx->libusb_ctx, devc->usb)) == SR_OK)
|
||||||
|
@ -169,9 +168,9 @@ static int hw_dev_close(struct sr_dev_inst *sdi)
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hw_cleanup(void)
|
static int hw_cleanup(int dmm)
|
||||||
{
|
{
|
||||||
clear_instances();
|
clear_instances(dmm);
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
@ -231,7 +230,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
|
static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
|
||||||
void *cb_data)
|
void *cb_data, int dmm)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
|
|
||||||
|
@ -242,13 +241,8 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
|
||||||
/* Send header packet to the session bus. */
|
/* Send header packet to the session bus. */
|
||||||
std_session_send_df_header(cb_data, DRIVER_LOG_DOMAIN);
|
std_session_send_df_header(cb_data, DRIVER_LOG_DOMAIN);
|
||||||
|
|
||||||
if (!strcmp(di->name, "uni-t-ut61d")) {
|
|
||||||
sr_source_add(0, 0, 10 /* poll_timeout */,
|
sr_source_add(0, 0, 10 /* poll_timeout */,
|
||||||
uni_t_ut61d_receive_data, (void *)sdi);
|
udmms[dmm].receive_data, (void *)sdi);
|
||||||
} else if (!strcmp(di->name, "voltcraft-vc820")) {
|
|
||||||
sr_source_add(0, 0, 10 /* poll_timeout */,
|
|
||||||
voltcraft_vc820_receive_data, (void *)sdi);
|
|
||||||
}
|
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
@ -272,40 +266,50 @@ static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
SR_PRIV struct sr_dev_driver uni_t_ut61d_driver_info = {
|
/* Driver-specific API function wrappers */
|
||||||
.name = "uni-t-ut61d",
|
#define HW_INIT(X) \
|
||||||
.longname = "UNI-T UT61D",
|
static int hw_init_##X(struct sr_context *sr_ctx) { return hw_init(sr_ctx, X); }
|
||||||
.api_version = 1,
|
#define HW_CLEANUP(X) \
|
||||||
.init = hw_init_ut61d,
|
static int hw_cleanup_##X(void) { return hw_cleanup(X); }
|
||||||
.cleanup = hw_cleanup,
|
#define HW_SCAN(X) \
|
||||||
.scan = hw_scan,
|
static GSList *hw_scan_##X(GSList *options) { return hw_scan(options, X); }
|
||||||
.dev_list = hw_dev_list,
|
#define HW_DEV_LIST(X) \
|
||||||
.dev_clear = clear_instances,
|
static GSList *hw_dev_list_##X(void) { return hw_dev_list(X); }
|
||||||
.config_get = NULL,
|
#define CLEAR_INSTANCES(X) \
|
||||||
.config_set = config_set,
|
static int clear_instances_##X(void) { return clear_instances(X); }
|
||||||
.config_list = config_list,
|
#define HW_DEV_ACQUISITION_START(X) \
|
||||||
.dev_open = hw_dev_open,
|
static int hw_dev_acquisition_start_##X(const struct sr_dev_inst *sdi, \
|
||||||
.dev_close = hw_dev_close,
|
void *cb_data) { return hw_dev_acquisition_start(sdi, cb_data, X); }
|
||||||
.dev_acquisition_start = hw_dev_acquisition_start,
|
#define HW_DEV_OPEN(X) \
|
||||||
.dev_acquisition_stop = hw_dev_acquisition_stop,
|
static int hw_dev_open_##X(struct sr_dev_inst *sdi) { return hw_dev_open(sdi, X); }
|
||||||
.priv = NULL,
|
|
||||||
|
/* Driver structs and API function wrappers */
|
||||||
|
#define DRV(ID, ID_UPPER, NAME, LONGNAME) \
|
||||||
|
HW_INIT(ID_UPPER) \
|
||||||
|
HW_CLEANUP(ID_UPPER) \
|
||||||
|
HW_SCAN(ID_UPPER) \
|
||||||
|
HW_DEV_LIST(ID_UPPER) \
|
||||||
|
CLEAR_INSTANCES(ID_UPPER) \
|
||||||
|
HW_DEV_ACQUISITION_START(ID_UPPER) \
|
||||||
|
HW_DEV_OPEN(ID_UPPER) \
|
||||||
|
SR_PRIV struct sr_dev_driver ID##_driver_info = { \
|
||||||
|
.name = NAME, \
|
||||||
|
.longname = LONGNAME, \
|
||||||
|
.api_version = 1, \
|
||||||
|
.init = hw_init_##ID_UPPER, \
|
||||||
|
.cleanup = hw_cleanup_##ID_UPPER, \
|
||||||
|
.scan = hw_scan_##ID_UPPER, \
|
||||||
|
.dev_list = hw_dev_list_##ID_UPPER, \
|
||||||
|
.dev_clear = clear_instances_##ID_UPPER, \
|
||||||
|
.config_get = NULL, \
|
||||||
|
.config_set = config_set, \
|
||||||
|
.config_list = config_list, \
|
||||||
|
.dev_open = hw_dev_open_##ID_UPPER, \
|
||||||
|
.dev_close = hw_dev_close, \
|
||||||
|
.dev_acquisition_start = hw_dev_acquisition_start_##ID_UPPER, \
|
||||||
|
.dev_acquisition_stop = hw_dev_acquisition_stop, \
|
||||||
|
.priv = NULL, \
|
||||||
};
|
};
|
||||||
|
|
||||||
SR_PRIV struct sr_dev_driver voltcraft_vc820_driver_info = {
|
DRV(uni_t_ut61d, UNI_T_UT61D, "uni-t-ut61d", "UNI-T UT61D")
|
||||||
.name = "voltcraft-vc820",
|
DRV(voltcraft_vc820, VOLTCRAFT_VC820, "voltcraft-vc820", "Voltcraft VC-820")
|
||||||
.longname = "Voltcraft VC-820",
|
|
||||||
.api_version = 1,
|
|
||||||
.init = hw_init_vc820,
|
|
||||||
.cleanup = hw_cleanup,
|
|
||||||
.scan = hw_scan,
|
|
||||||
.dev_list = hw_dev_list,
|
|
||||||
.dev_clear = clear_instances,
|
|
||||||
.config_get = NULL,
|
|
||||||
.config_set = config_set,
|
|
||||||
.config_list = config_list,
|
|
||||||
.dev_open = hw_dev_open,
|
|
||||||
.dev_close = hw_dev_close,
|
|
||||||
.dev_acquisition_start = hw_dev_acquisition_start,
|
|
||||||
.dev_acquisition_stop = hw_dev_acquisition_stop,
|
|
||||||
.priv = NULL,
|
|
||||||
};
|
|
||||||
|
|
|
@ -30,11 +30,12 @@
|
||||||
* Most UNI-T DMMs can be used with two (three) different PC interface cables:
|
* Most UNI-T DMMs can be used with two (three) different PC interface cables:
|
||||||
* - The UT-D04 USB/HID cable, old version with Hoitek HE2325U chip.
|
* - The UT-D04 USB/HID cable, old version with Hoitek HE2325U chip.
|
||||||
* - The UT-D04 USB/HID cable, new version with WCH CH9325 chip.
|
* - The UT-D04 USB/HID cable, new version with WCH CH9325 chip.
|
||||||
* - The UT-D01 RS232 cable.
|
* - The UT-D02 RS232 cable.
|
||||||
*
|
*
|
||||||
* This driver is meant to support all three cables, and various DMMs that
|
* This driver is meant to support all USB/HID cables, and various DMMs that
|
||||||
* can be attached to a PC via these cables. Currently only the UT-D04 cable
|
* can be attached to a PC via these cables. Currently only the UT-D04 cable
|
||||||
* (new version) is supported.
|
* (new version) is supported/tested.
|
||||||
|
* The UT-D02 RS232 cable is handled by the 'serial-dmm' driver.
|
||||||
*
|
*
|
||||||
* The data for one DMM packet (e.g. 14 bytes if the respective DMM uses a
|
* The data for one DMM packet (e.g. 14 bytes if the respective DMM uses a
|
||||||
* Fortune Semiconductor FS9922-DMM4 chip) is spread across multiple
|
* Fortune Semiconductor FS9922-DMM4 chip) is spread across multiple
|
||||||
|
@ -66,12 +67,12 @@
|
||||||
* - ...
|
* - ...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void decode_packet(struct sr_dev_inst *sdi, int dmm, const uint8_t *buf)
|
static void decode_packet(struct sr_dev_inst *sdi, int dmm, const uint8_t *buf,
|
||||||
|
void *info)
|
||||||
{
|
{
|
||||||
struct sr_datafeed_packet packet;
|
struct sr_datafeed_packet packet;
|
||||||
struct sr_datafeed_analog analog;
|
struct sr_datafeed_analog analog;
|
||||||
struct dev_context *devc;
|
/// struct fs9721_info info;
|
||||||
struct fs9721_info info;
|
|
||||||
float floatval;
|
float floatval;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -79,16 +80,16 @@ static void decode_packet(struct sr_dev_inst *sdi, int dmm, const uint8_t *buf)
|
||||||
memset(&analog, 0, sizeof(struct sr_datafeed_analog));
|
memset(&analog, 0, sizeof(struct sr_datafeed_analog));
|
||||||
|
|
||||||
/* Parse the protocol packet. */
|
/* Parse the protocol packet. */
|
||||||
ret = SR_ERR;
|
ret = udmms[dmm].packet_parse(buf, &floatval, &analog, &info);
|
||||||
if (dmm == UNI_T_UT61D)
|
|
||||||
ret = sr_dmm_parse_fs9922(buf, &floatval, &analog);
|
|
||||||
else if (dmm == VOLTCRAFT_VC820)
|
|
||||||
ret = sr_fs9721_parse(buf, &floatval, &analog, &info);
|
|
||||||
if (ret != SR_OK) {
|
if (ret != SR_OK) {
|
||||||
sr_err("Invalid DMM packet, ignoring.");
|
sr_err("Invalid DMM packet, ignoring.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If this DMM needs additional handling, call the resp. function. */
|
||||||
|
if (udmms[dmm].dmm_details)
|
||||||
|
udmms[dmm].dmm_details(&analog, info);
|
||||||
|
|
||||||
/* Send a sample packet with one analog value. */
|
/* Send a sample packet with one analog value. */
|
||||||
analog.probes = sdi->probes;
|
analog.probes = sdi->probes;
|
||||||
analog.num_samples = 1;
|
analog.num_samples = 1;
|
||||||
|
@ -181,7 +182,7 @@ static void log_dmm_packet(const uint8_t *buf)
|
||||||
buf[7], buf[8], buf[9], buf[10], buf[11], buf[12], buf[13]);
|
buf[7], buf[8], buf[9], buf[10], buf[11], buf[12], buf[13]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int uni_t_dmm_receive_data(int fd, int revents, int dmm, void *cb_data)
|
static int receive_data(int fd, int revents, int dmm, void *info, void *cb_data)
|
||||||
{
|
{
|
||||||
struct sr_dev_inst *sdi;
|
struct sr_dev_inst *sdi;
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
|
@ -201,8 +202,8 @@ static int uni_t_dmm_receive_data(int fd, int revents, int dmm, void *cb_data)
|
||||||
|
|
||||||
/* On the first run, we need to init the HID chip. */
|
/* On the first run, we need to init the HID chip. */
|
||||||
if (first_run) {
|
if (first_run) {
|
||||||
/* TODO: The baudrate is DMM-specific (UT61D: 19230). */
|
/* Note: The baudrate is DMM-specific (UT61D: 19230). */
|
||||||
if ((ret = hid_chip_init(devc, 19230)) != SR_OK) {
|
if ((ret = hid_chip_init(devc, udmms[dmm].baudrate)) != SR_OK) {
|
||||||
sr_err("HID chip init failed: %d.", ret);
|
sr_err("HID chip init failed: %d.", ret);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -237,15 +238,8 @@ static int uni_t_dmm_receive_data(int fd, int revents, int dmm, void *cb_data)
|
||||||
if (buf[0] != 0xf0) {
|
if (buf[0] != 0xf0) {
|
||||||
/* First time: Synchronize to the start of a packet. */
|
/* First time: Synchronize to the start of a packet. */
|
||||||
if (!synced_on_first_packet) {
|
if (!synced_on_first_packet) {
|
||||||
if (dmm == UNI_T_UT61D) {
|
if (!udmms[dmm].packet_valid(buf))
|
||||||
/* Valid packets start with '+' or '-'. */
|
|
||||||
if ((buf[1] != '+') && buf[1] != '-')
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} else if (dmm == VOLTCRAFT_VC820) {
|
|
||||||
/* Valid packets have 0x1 as high nibble. */
|
|
||||||
if (!sr_fs9721_is_packet_start(buf[1]))
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
synced_on_first_packet = TRUE;
|
synced_on_first_packet = TRUE;
|
||||||
sr_spew("Successfully synchronized on first packet.");
|
sr_spew("Successfully synchronized on first packet.");
|
||||||
}
|
}
|
||||||
|
@ -258,13 +252,14 @@ static int uni_t_dmm_receive_data(int fd, int revents, int dmm, void *cb_data)
|
||||||
if (data_byte_counter == NUM_DATA_BYTES) {
|
if (data_byte_counter == NUM_DATA_BYTES) {
|
||||||
log_dmm_packet(pbuf);
|
log_dmm_packet(pbuf);
|
||||||
data_byte_counter = 0;
|
data_byte_counter = 0;
|
||||||
if (dmm == VOLTCRAFT_VC820) {
|
|
||||||
if (!sr_fs9721_packet_valid(pbuf)) {
|
if (!udmms[dmm].packet_valid(pbuf)) {
|
||||||
sr_err("Invalid packet.");
|
sr_err("Invalid packet.");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
decode_packet(sdi, dmm, pbuf);
|
decode_packet(sdi, dmm, pbuf, info);
|
||||||
|
|
||||||
memset(pbuf, 0x00, NUM_DATA_BYTES);
|
memset(pbuf, 0x00, NUM_DATA_BYTES);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -278,12 +273,11 @@ static int uni_t_dmm_receive_data(int fd, int revents, int dmm, void *cb_data)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
SR_PRIV int uni_t_ut61d_receive_data(int fd, int revents, void *cb_data)
|
#define RECEIVE_DATA(ID_UPPER, DMM_DRIVER) \
|
||||||
{
|
SR_PRIV int receive_data_##ID_UPPER(int fd, int revents, void *cb_data) { \
|
||||||
return uni_t_dmm_receive_data(fd, revents, UNI_T_UT61D, cb_data);
|
struct DMM_DRIVER##_info info; \
|
||||||
}
|
return receive_data(fd, revents, ID_UPPER, &info, cb_data); }
|
||||||
|
|
||||||
SR_PRIV int voltcraft_vc820_receive_data(int fd, int revents, void *cb_data)
|
/* Driver-specific receive_data() wrappers */
|
||||||
{
|
RECEIVE_DATA(UNI_T_UT61D, fs9922)
|
||||||
return uni_t_dmm_receive_data(fd, revents, VOLTCRAFT_VC820, cb_data);
|
RECEIVE_DATA(VOLTCRAFT_VC820, fs9721)
|
||||||
}
|
|
||||||
|
|
|
@ -36,11 +36,30 @@
|
||||||
#define sr_warn(s, args...) sr_warn(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 sr_err(s, args...) sr_err(DRIVER_LOG_DOMAIN s, ## args)
|
||||||
|
|
||||||
|
/* Note: When adding entries here, don't forget to update DMM_COUNT. */
|
||||||
enum {
|
enum {
|
||||||
UNI_T_UT61D,
|
UNI_T_UT61D,
|
||||||
VOLTCRAFT_VC820,
|
VOLTCRAFT_VC820,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define DMM_COUNT 2
|
||||||
|
|
||||||
|
struct dmm_info {
|
||||||
|
char *vendor;
|
||||||
|
char *device;
|
||||||
|
uint32_t baudrate;
|
||||||
|
int packet_size;
|
||||||
|
int (*packet_request)(struct sr_serial_dev_inst *);
|
||||||
|
gboolean (*packet_valid)(const uint8_t *);
|
||||||
|
int (*packet_parse)(const uint8_t *, float *,
|
||||||
|
struct sr_datafeed_analog *, void *);
|
||||||
|
void (*dmm_details)(struct sr_datafeed_analog *, void *);
|
||||||
|
struct sr_dev_driver *di;
|
||||||
|
int (*receive_data)(int, int, void *);
|
||||||
|
};
|
||||||
|
|
||||||
|
extern SR_PRIV struct dmm_info udmms[DMM_COUNT];
|
||||||
|
|
||||||
#define UT_D04_CABLE_USB_VID 0x1a86
|
#define UT_D04_CABLE_USB_VID 0x1a86
|
||||||
#define UT_D04_CABLE_USB_DID 0xe008
|
#define UT_D04_CABLE_USB_DID 0xe008
|
||||||
|
|
||||||
|
@ -66,7 +85,7 @@ struct dev_context {
|
||||||
uint8_t protocol_buf[14];
|
uint8_t protocol_buf[14];
|
||||||
};
|
};
|
||||||
|
|
||||||
SR_PRIV int uni_t_ut61d_receive_data(int fd, int revents, void *cb_data);
|
SR_PRIV int receive_data_UNI_T_UT61D(int fd, int revents, void *cb_data);
|
||||||
SR_PRIV int voltcraft_vc820_receive_data(int fd, int revents, void *cb_data);
|
SR_PRIV int receive_data_VOLTCRAFT_VC820(int fd, int revents, void *cb_data);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue