serial-dmm: Add RadioShack 22-168 support.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
This commit is contained in:
Alexandru Gagniuc 2012-12-02 09:17:46 -06:00 committed by Uwe Hermann
parent eebb606762
commit d5ce233fe1
4 changed files with 47 additions and 1 deletions

View File

@ -56,6 +56,7 @@ SR_PRIV struct sr_dev_driver va_va18b_driver_info;
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;
static struct sr_dev_driver *di_dt4000zc = &digitek_dt4000zc_driver_info;
static struct sr_dev_driver *di_tp4000zc = &tekpower_tp4000zc_driver_info;
@ -66,6 +67,7 @@ static struct sr_dev_driver *di_va18b = &va_va18b_driver_info;
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;
/* After hw_init() this will point to a device-specific entry (see above). */
static struct sr_dev_driver *di = NULL;
@ -125,6 +127,12 @@ SR_PRIV struct dmm_info dmms[] = {
sr_fs9721_packet_valid, sr_fs9721_parse,
dmm_details_pce_dm32,
},
{
"RadioShack", "22-168", "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. */
@ -180,6 +188,8 @@ static int hw_init(int dmm)
di = di_4370;
if (dmm == PCE_PCE_DM32)
di = di_pce_dm32;
if (dmm == RADIOSHACK_22_168)
di = di_22_168;
sr_dbg("Selected '%s' subdriver.", di->name);
di->priv = drvc;
@ -232,6 +242,11 @@ static int hw_init_pce_pce_dm32(void)
return hw_init(PCE_PCE_DM32);
}
static int hw_init_radioshack_22_168(void)
{
return hw_init(RADIOSHACK_22_168);
}
static GSList *scan(const char *conn, const char *serialcomm, int dmm)
{
struct sr_dev_inst *sdi;
@ -357,6 +372,8 @@ static GSList *hw_scan(GSList *options)
dmm = 7;
if (!strcmp(di->name, "pce-pce-dm32"))
dmm = 8;
if (!strcmp(di->name, "radioshack-22-168"))
dmm = 9;
if (serialcomm) {
/* Use the provided comm specs. */
@ -530,6 +547,8 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
receive_data = peaktech_4370_receive_data;
if (!strcmp(di->name, "pce-pce-dm32"))
receive_data = pce_pce_dm32_receive_data;
if (!strcmp(di->name, "radioshack-22-168"))
receive_data = radioshack_22_168_receive_data;
/* Poll every 50ms, or whenever some data comes in. */
sr_source_add(devc->serial->fd, G_IO_IN, 50,
@ -726,3 +745,20 @@ SR_PRIV struct sr_dev_driver pce_pce_dm32_driver_info = {
.priv = NULL,
};
SR_PRIV struct sr_dev_driver radioshack_22_168_driver_info = {
.name = "radioshack-22-168",
.longname = "RadioShack 22-168",
.api_version = 1,
.init = hw_init_radioshack_22_168,
.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

@ -238,3 +238,9 @@ SR_PRIV int pce_pce_dm32_receive_data(int fd, int revents, void *cb_data)
struct fs9721_info info;
return receive_data(fd, revents, PCE_PCE_DM32, &info, cb_data);
}
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);
}

View File

@ -40,9 +40,10 @@ enum {
METEX_M3640D,
PEAKTECH_4370,
PCE_PCE_DM32,
RADIOSHACK_22_168,
};
#define DMM_COUNT 9
#define DMM_COUNT 10
struct dmm_info {
char *vendor;
@ -88,6 +89,7 @@ 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 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 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

@ -123,6 +123,7 @@ extern SR_PRIV struct sr_dev_driver va_va18b_driver_info;
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;
#endif
#ifdef HAVE_HW_UNI_T_DMM
extern SR_PRIV struct sr_dev_driver uni_t_ut61d_driver_info;
@ -186,6 +187,7 @@ static struct sr_dev_driver *drivers_list[] = {
&metex_m3640d_driver_info,
&peaktech_4370_driver_info,
&pce_pce_dm32_driver_info,
&radioshack_22_168_driver_info,
#endif
#ifdef HAVE_HW_UNI_T_DMM
&uni_t_ut61d_driver_info,