serial-dmm: Add Metex M-3640D support.

This commit is contained in:
Uwe Hermann 2012-12-02 00:40:15 +01:00
parent 9871215c83
commit a53da08254
4 changed files with 48 additions and 7 deletions

View File

@ -53,6 +53,7 @@ SR_PRIV struct sr_dev_driver metex_me31_driver_info;
SR_PRIV struct sr_dev_driver peaktech_3410_driver_info;
SR_PRIV struct sr_dev_driver mastech_mas345_driver_info;
SR_PRIV struct sr_dev_driver va_va18b_driver_info;
SR_PRIV struct sr_dev_driver metex_m3640d_driver_info;
static struct sr_dev_driver *di_dt4000zc = &digitek_dt4000zc_driver_info;
static struct sr_dev_driver *di_tp4000zc = &tekpower_tp4000zc_driver_info;
@ -60,6 +61,7 @@ static struct sr_dev_driver *di_me31 = &metex_me31_driver_info;
static struct sr_dev_driver *di_3410 = &peaktech_3410_driver_info;
static struct sr_dev_driver *di_mas345 = &mastech_mas345_driver_info;
static struct sr_dev_driver *di_va18b = &va_va18b_driver_info;
static struct sr_dev_driver *di_m3640d = &metex_m3640d_driver_info;
/* After hw_init() this will point to a device-specific entry (see above). */
static struct sr_dev_driver *di = NULL;
@ -101,6 +103,12 @@ SR_PRIV struct dmm_info dmms[] = {
sr_fs9721_packet_valid, sr_fs9721_parse,
dmm_details_va18b,
},
{
"Metex", "M-3640D", "1200/7n2/rts=0/dtr=1", 1200,
METEX14_PACKET_SIZE, sr_metex14_packet_request,
sr_metex14_packet_valid, sr_metex14_parse,
NULL,
},
};
/* Properly close and free all devices. */
@ -150,6 +158,8 @@ static int hw_init(int dmm)
di = di_mas345;
if (dmm == VA_VA18B)
di = di_va18b;
if (dmm == METEX_M3640D)
di = di_m3640d;
sr_dbg("Selected '%s' subdriver.", di->name);
di->priv = drvc;
@ -187,6 +197,11 @@ static int hw_init_va_va18b(void)
return hw_init(VA_VA18B);
}
static int hw_init_metex_m3640d(void)
{
return hw_init(METEX_M3640D);
}
static GSList *scan(const char *conn, const char *serialcomm, int dmm)
{
struct sr_dev_inst *sdi;
@ -306,6 +321,8 @@ static GSList *hw_scan(GSList *options)
dmm = 4;
if (!strcmp(di->name, "va-va18b"))
dmm = 5;
if (!strcmp(di->name, "metex-m3640d"))
dmm = 6;
if (serialcomm) {
/* Use the provided comm specs. */
@ -473,6 +490,8 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
receive_data = mastech_mas345_receive_data;
if (!strcmp(di->name, "va-va18b"))
receive_data = va_va18b_receive_data;
if (!strcmp(di->name, "metex-m3640d"))
receive_data = metex_m3640d_receive_data;
/* Poll every 50ms, or whenever some data comes in. */
sr_source_add(devc->serial->fd, G_IO_IN, 50,
@ -614,3 +633,21 @@ SR_PRIV struct sr_dev_driver va_va18b_driver_info = {
.dev_acquisition_stop = hw_dev_acquisition_stop,
.priv = NULL,
};
SR_PRIV struct sr_dev_driver metex_m3640d_driver_info = {
.name = "metex-m3640d",
.longname = "Metex M-3640D",
.api_version = 1,
.init = hw_init_metex_m3640d,
.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

@ -169,41 +169,41 @@ static int receive_data(int fd, int revents, int dmm, void *info, void *cb_data)
SR_PRIV int digitek_dt4000zc_receive_data(int fd, int revents, void *cb_data)
{
struct fs9721_info info;
return receive_data(fd, revents, DIGITEK_DT4000ZC, &info, cb_data);
}
SR_PRIV int tekpower_tp4000zc_receive_data(int fd, int revents, void *cb_data)
{
struct fs9721_info info;
return receive_data(fd, revents, TEKPOWER_TP4000ZC, &info, cb_data);
}
SR_PRIV int metex_me31_receive_data(int fd, int revents, void *cb_data)
{
struct metex14_info info;
return receive_data(fd, revents, METEX_ME31, &info, cb_data);
}
SR_PRIV int peaktech_3410_receive_data(int fd, int revents, void *cb_data)
{
struct metex14_info info;
return receive_data(fd, revents, PEAKTECH_3410, &info, cb_data);
}
SR_PRIV int mastech_mas345_receive_data(int fd, int revents, void *cb_data)
{
struct metex14_info info;
return receive_data(fd, revents, MASTECH_MAS345, &info, cb_data);
}
SR_PRIV int va_va18b_receive_data(int fd, int revents, void *cb_data)
{
struct fs9721_info info;
return receive_data(fd, revents, VA_VA18B, &info, cb_data);
}
SR_PRIV int metex_m3640d_receive_data(int fd, int revents, void *cb_data)
{
struct metex14_info info;
return receive_data(fd, revents, METEX_M3640D, &info, cb_data);
}

View File

@ -36,6 +36,7 @@ enum {
PEAKTECH_3410,
MASTECH_MAS345,
VA_VA18B,
METEX_M3640D,
};
struct dmm_info {
@ -51,7 +52,7 @@ struct dmm_info {
void (*dmm_details)(struct sr_datafeed_analog *, void *);
};
SR_PRIV struct dmm_info dmms[6];
SR_PRIV struct dmm_info dmms[7];
#define DMM_BUFSIZE 256
@ -79,6 +80,7 @@ SR_PRIV int metex_me31_receive_data(int fd, int revents, void *cb_data);
SR_PRIV int peaktech_3410_receive_data(int fd, int revents, void *cb_data);
SR_PRIV int mastech_mas345_receive_data(int fd, int revents, void *cb_data);
SR_PRIV int va_va18b_receive_data(int fd, int revents, void *cb_data);
SR_PRIV int metex_m3640d_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

@ -120,6 +120,7 @@ extern SR_PRIV struct sr_dev_driver metex_me31_driver_info;
extern SR_PRIV struct sr_dev_driver peaktech_3410_driver_info;
extern SR_PRIV struct sr_dev_driver mastech_mas345_driver_info;
extern SR_PRIV struct sr_dev_driver va_va18b_driver_info;
extern SR_PRIV struct sr_dev_driver metex_m3640d_driver_info;
#endif
#ifdef HAVE_HW_UNI_T_DMM
extern SR_PRIV struct sr_dev_driver uni_t_ut61d_driver_info;
@ -180,6 +181,7 @@ static struct sr_dev_driver *drivers_list[] = {
&peaktech_3410_driver_info,
&mastech_mas345_driver_info,
&va_va18b_driver_info,
&metex_m3640d_driver_info,
#endif
#ifdef HAVE_HW_UNI_T_DMM
&uni_t_ut61d_driver_info,