scpi_usbtmc_libusb: Retry if a Bulk-IN request starts with an empty packet
[libsigrok.git] / src / hardware / serial-dmm / api.c
1 /*
2  * This file is part of the libsigrok project.
3  *
4  * Copyright (C) 2012 Bert Vermeulen <bert@biot.com>
5  * Copyright (C) 2012 Alexandru Gagniuc <mr.nuke.me@gmail.com>
6  * Copyright (C) 2012 Uwe Hermann <uwe@hermann-uwe.de>
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20  */
21
22 #include <config.h>
23 #include <sys/types.h>
24 #include <sys/stat.h>
25 #include <fcntl.h>
26 #include <string.h>
27 #include <glib.h>
28 #include <libsigrok/libsigrok.h>
29 #include "libsigrok-internal.h"
30 #include "protocol.h"
31
32 static const uint32_t scanopts[] = {
33         SR_CONF_CONN,
34         SR_CONF_SERIALCOMM,
35 };
36
37 static const uint32_t drvopts[] = {
38         SR_CONF_MULTIMETER,
39 };
40
41 static const uint32_t devopts[] = {
42         SR_CONF_CONTINUOUS,
43         SR_CONF_LIMIT_SAMPLES | SR_CONF_SET,
44         SR_CONF_LIMIT_MSEC | SR_CONF_SET,
45 };
46
47 static GSList *scan(struct sr_dev_driver *di, GSList *options)
48 {
49         struct dmm_info *dmm;
50         struct sr_config *src;
51         GSList *l, *devices;
52         const char *conn, *serialcomm;
53         struct sr_dev_inst *sdi;
54         struct dev_context *devc;
55         struct sr_serial_dev_inst *serial;
56         int dropped, ret;
57         size_t len;
58         uint8_t buf[128];
59         size_t ch_idx;
60         char ch_name[12];
61
62         dmm = (struct dmm_info *)di;
63
64         conn = dmm->conn;
65         serialcomm = dmm->serialcomm;
66         for (l = options; l; l = l->next) {
67                 src = l->data;
68                 switch (src->key) {
69                 case SR_CONF_CONN:
70                         conn = g_variant_get_string(src->data, NULL);
71                         break;
72                 case SR_CONF_SERIALCOMM:
73                         serialcomm = g_variant_get_string(src->data, NULL);
74                         break;
75                 }
76         }
77         if (!conn)
78                 return NULL;
79
80         serial = sr_serial_dev_inst_new(conn, serialcomm);
81
82         if (serial_open(serial, SERIAL_RDWR) != SR_OK)
83                 return NULL;
84
85         sr_info("Probing serial port %s.", conn);
86
87         devices = NULL;
88         serial_flush(serial);
89
90         /* Request a packet if the DMM requires this. */
91         if (dmm->packet_request) {
92                 if ((ret = dmm->packet_request(serial)) < 0) {
93                         sr_err("Failed to request packet: %d.", ret);
94                         return FALSE;
95                 }
96         }
97
98         /*
99          * There's no way to get an ID from the multimeter. It just sends data
100          * periodically (or upon request), so the best we can do is check if
101          * the packets match the expected format.
102          */
103
104         /* Let's get a bit of data and see if we can find a packet. */
105         len = sizeof(buf);
106         ret = serial_stream_detect(serial, buf, &len, dmm->packet_size,
107                                    dmm->packet_valid, 3000);
108         if (ret != SR_OK)
109                 goto scan_cleanup;
110
111         /*
112          * If we dropped more than two packets worth of data, something is
113          * wrong. We shouldn't quit however, since the dropped bytes might be
114          * just zeroes at the beginning of the stream. Those can occur as a
115          * combination of the nonstandard cable that ships with some devices
116          * and the serial port or USB to serial adapter.
117          */
118         dropped = len - dmm->packet_size;
119         if (dropped > 2 * dmm->packet_size)
120                 sr_warn("Had to drop too much data.");
121
122         sr_info("Found device on port %s.", conn);
123
124         sdi = g_malloc0(sizeof(struct sr_dev_inst));
125         sdi->status = SR_ST_INACTIVE;
126         sdi->vendor = g_strdup(dmm->vendor);
127         sdi->model = g_strdup(dmm->device);
128         devc = g_malloc0(sizeof(struct dev_context));
129         sr_sw_limits_init(&devc->limits);
130         sdi->inst_type = SR_INST_SERIAL;
131         sdi->conn = serial;
132         sdi->priv = devc;
133         dmm->channel_count = 1;
134         if (dmm->packet_parse == sr_brymen_bm86x_parse)
135                 dmm->channel_count = BRYMEN_BM86X_DISPLAY_COUNT;
136         if (dmm->packet_parse == sr_eev121gw_3displays_parse) {
137                 dmm->channel_count = EEV121GW_DISPLAY_COUNT;
138                 dmm->channel_formats = eev121gw_channel_formats;
139         }
140         if (dmm->packet_parse == sr_metex14_4packets_parse)
141                 dmm->channel_count = 4;
142         if (dmm->packet_parse == sr_ms2115b_parse) {
143                 dmm->channel_count = MS2115B_DISPLAY_COUNT;
144                 dmm->channel_formats = ms2115b_channel_formats;
145         }
146         for (ch_idx = 0; ch_idx < dmm->channel_count; ch_idx++) {
147                 size_t ch_num;
148                 const char *fmt;
149                 fmt = "P%zu";
150                 if (dmm->channel_formats && dmm->channel_formats[ch_idx])
151                         fmt = dmm->channel_formats[ch_idx];
152                 ch_num = ch_idx + 1;
153                 snprintf(ch_name, sizeof(ch_name), fmt, ch_num);
154                 sr_channel_new(sdi, ch_idx, SR_CHANNEL_ANALOG, TRUE, ch_name);
155         }
156         devices = g_slist_append(devices, sdi);
157
158 scan_cleanup:
159         serial_close(serial);
160
161         return std_scan_complete(di, devices);
162 }
163
164 static int config_set(uint32_t key, GVariant *data,
165         const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
166 {
167         struct dev_context *devc;
168
169         (void)cg;
170
171         devc = sdi->priv;
172
173         return sr_sw_limits_config_set(&devc->limits, key, data);
174 }
175
176 static int config_list(uint32_t key, GVariant **data,
177         const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
178 {
179         return STD_CONFIG_LIST(key, data, sdi, cg, scanopts, drvopts, devopts);
180 }
181
182 static int dev_acquisition_start(const struct sr_dev_inst *sdi)
183 {
184         struct dev_context *devc;
185         struct sr_serial_dev_inst *serial;
186
187         devc = sdi->priv;
188
189         sr_sw_limits_acquisition_start(&devc->limits);
190         std_session_send_df_header(sdi);
191
192         serial = sdi->conn;
193         serial_source_add(sdi->session, serial, G_IO_IN, 50,
194                       receive_data, (void *)sdi);
195
196         return SR_OK;
197 }
198
199 #define DMM_CONN(ID, CHIPSET, VENDOR, MODEL, \
200                 CONN, SERIALCOMM, PACKETSIZE, TIMEOUT, DELAY, \
201                 REQUEST, VALID, PARSE, DETAILS) \
202         &((struct dmm_info) { \
203                 { \
204                         .name = ID, \
205                         .longname = VENDOR " " MODEL, \
206                         .api_version = 1, \
207                         .init = std_init, \
208                         .cleanup = std_cleanup, \
209                         .scan = scan, \
210                         .dev_list = std_dev_list, \
211                         .dev_clear = std_dev_clear, \
212                         .config_get = NULL, \
213                         .config_set = config_set, \
214                         .config_list = config_list, \
215                         .dev_open = std_serial_dev_open, \
216                         .dev_close = std_serial_dev_close, \
217                         .dev_acquisition_start = dev_acquisition_start, \
218                         .dev_acquisition_stop = std_serial_dev_acquisition_stop, \
219                         .context = NULL, \
220                 }, \
221                 VENDOR, MODEL, CONN, SERIALCOMM, PACKETSIZE, TIMEOUT, DELAY, \
222                 REQUEST, 1, NULL, VALID, PARSE, DETAILS, sizeof(struct CHIPSET##_info) \
223         }).di
224
225 #define DMM(ID, CHIPSET, VENDOR, MODEL, SERIALCOMM, PACKETSIZE, TIMEOUT, \
226                 DELAY, REQUEST, VALID, PARSE, DETAILS) \
227         DMM_CONN(ID, CHIPSET, VENDOR, MODEL, NULL, SERIALCOMM, PACKETSIZE, \
228                 TIMEOUT, DELAY, REQUEST, VALID, PARSE, DETAILS)
229
230 SR_REGISTER_DEV_DRIVER_LIST(serial_dmm_drivers,
231         /*
232          * The items are sorted by chipset first and then model name.
233          *
234          * This reflects the developer's perspective and is preferrable
235          * during maintenance, as a vendor/product based sort order does
236          * not work well for rebranded models, and from a support point
237          * of view it's more important to identify similarities between
238          * models and compatible devices.
239          *
240          * Fold marks {{{ }}} with matching braces were added, to further
241          * speed up navigation in the long list.
242          */
243         /* asycii based meters {{{ */
244         DMM(
245                 "metrix-mx56c", asycii, "Metrix", "MX56C",
246                 "2400/8n1", ASYCII_PACKET_SIZE, 0, 0, NULL,
247                 sr_asycii_packet_valid, sr_asycii_parse, NULL
248         ),
249         /* }}} */
250         /* bm25x based meters {{{ */
251         DMM(
252                 "brymen-bm25x", bm25x,
253                 "Brymen", "BM25x", "9600/8n1/rts=1/dtr=1",
254                 BRYMEN_BM25X_PACKET_SIZE, 0, 0, NULL,
255                 sr_brymen_bm25x_packet_valid, sr_brymen_bm25x_parse,
256                 NULL
257         ),
258         /* }}} */
259         /* bm86x based meters {{{ */
260         DMM_CONN(
261                 "brymen-bm86x", brymen_bm86x, "Brymen", "BM86x",
262                 "hid/bu86x", NULL, BRYMEN_BM86X_PACKET_SIZE, 500, 100,
263                 sr_brymen_bm86x_packet_request,
264                 sr_brymen_bm86x_packet_valid, sr_brymen_bm86x_parse,
265                 NULL
266         ),
267         /* }}} */
268         /* dtm0660 based meters {{{ */
269         DMM(
270                 "peaktech-3415", dtm0660,
271                 "PeakTech", "3415", "2400/8n1/rts=0/dtr=1",
272                 DTM0660_PACKET_SIZE, 0, 0, NULL,
273                 sr_dtm0660_packet_valid, sr_dtm0660_parse, NULL
274         ),
275         DMM(
276                 "velleman-dvm4100", dtm0660,
277                 "Velleman", "DVM4100", "2400/8n1/rts=0/dtr=1",
278                 DTM0660_PACKET_SIZE, 0, 0, NULL,
279                 sr_dtm0660_packet_valid, sr_dtm0660_parse, NULL
280         ),
281         /* }}} */
282         /* eev121gw based meters {{{ */
283         DMM(
284                 "eevblog-121gw", eev121gw, "EEVblog", "121GW",
285                 "115200/8n1", EEV121GW_PACKET_SIZE, 0, 0, NULL,
286                 sr_eev121gw_packet_valid, sr_eev121gw_3displays_parse, NULL
287         ),
288         /* }}} */
289         /* es519xx based meters {{{ */
290         DMM(
291                 "iso-tech-idm103n", es519xx,
292                 "ISO-TECH", "IDM103N", "2400/7o1/rts=0/dtr=1",
293                 ES519XX_11B_PACKET_SIZE, 0, 0, NULL,
294                 sr_es519xx_2400_11b_packet_valid, sr_es519xx_2400_11b_parse,
295                 NULL
296         ),
297         /*
298          * Note: ES51922 and ES51986 baudrate is actually 19230. This is
299          * "out" by .15%, and so is well within the typical 1% margin
300          * that is considered acceptable in UART communication, and thus
301          * should not cause an issue.
302          *
303          * However, using 19230 as baudrate here will not work, as most DMM
304          * cables do not support that baudrate!
305          */
306         DMM(
307                 "tenma-72-7750-ser", es519xx,
308                 "Tenma", "72-7750 (UT-D02 cable)", "19200/7o1/rts=0/dtr=1",
309                 ES519XX_11B_PACKET_SIZE, 0, 0, NULL,
310                 sr_es519xx_19200_11b_packet_valid, sr_es519xx_19200_11b_parse,
311                 NULL
312         ),
313         DMM(
314                 "uni-t-ut60g-ser", es519xx,
315                 "UNI-T", "UT60G (UT-D02 cable)", "19200/7o1/rts=0/dtr=1",
316                 ES519XX_11B_PACKET_SIZE, 0, 0, NULL,
317                 sr_es519xx_19200_11b_packet_valid, sr_es519xx_19200_11b_parse,
318                 NULL
319         ),
320         DMM(
321                 "uni-t-ut61e-ser", es519xx,
322                 "UNI-T", "UT61E (UT-D02 cable)", "19200/7o1/rts=0/dtr=1",
323                 ES519XX_14B_PACKET_SIZE, 0, 0, NULL,
324                 sr_es519xx_19200_14b_packet_valid, sr_es519xx_19200_14b_parse,
325                 NULL
326         ),
327         /* }}} */
328         /* fs9721 based meters {{{ */
329         DMM(
330                 "digitek-dt4000zc", fs9721,
331                 "Digitek", "DT4000ZC", "2400/8n1/dtr=1",
332                 FS9721_PACKET_SIZE, 0, 0, NULL,
333                 sr_fs9721_packet_valid, sr_fs9721_parse,
334                 sr_fs9721_10_temp_c
335         ),
336         DMM(
337                 "mastech-ms8250b", fs9721,
338                 "MASTECH", "MS8250B", "2400/8n1/rts=0/dtr=1",
339                 FS9721_PACKET_SIZE, 0, 0, NULL,
340                 sr_fs9721_packet_valid, sr_fs9721_parse,
341                 NULL
342         ),
343         DMM(
344                 "pce-pce-dm32", fs9721,
345                 "PCE", "PCE-DM32", "2400/8n1",
346                 FS9721_PACKET_SIZE, 0, 0, NULL,
347                 sr_fs9721_packet_valid, sr_fs9721_parse,
348                 sr_fs9721_01_10_temp_f_c
349         ),
350         DMM(
351                 "peaktech-3330", fs9721,
352                 "PeakTech", "3330", "2400/8n1/dtr=1",
353                 FS9721_PACKET_SIZE, 0, 0, NULL,
354                 sr_fs9721_packet_valid, sr_fs9721_parse,
355                 sr_fs9721_01_10_temp_f_c
356         ),
357         DMM(
358                 "tecpel-dmm-8061-ser", fs9721,
359                 "Tecpel", "DMM-8061 (UT-D02 cable)", "2400/8n1/rts=0/dtr=1",
360                 FS9721_PACKET_SIZE, 0, 0, NULL,
361                 sr_fs9721_packet_valid, sr_fs9721_parse,
362                 sr_fs9721_00_temp_c
363         ),
364         DMM(
365                 "tekpower-tp4000ZC", fs9721,
366                 "TekPower", "TP4000ZC", "2400/8n1/dtr=1",
367                 FS9721_PACKET_SIZE, 0, 0, NULL,
368                 sr_fs9721_packet_valid, sr_fs9721_parse,
369                 sr_fs9721_10_temp_c
370         ),
371         DMM(
372                 "tenma-72-7745-ser", fs9721,
373                 "Tenma", "72-7745 (UT-D02 cable)", "2400/8n1/rts=0/dtr=1",
374                 FS9721_PACKET_SIZE, 0, 0, NULL,
375                 sr_fs9721_packet_valid, sr_fs9721_parse,
376                 sr_fs9721_00_temp_c
377         ),
378         DMM(
379                 "uni-t-ut60a-ser", fs9721,
380                 "UNI-T", "UT60A (UT-D02 cable)", "2400/8n1/rts=0/dtr=1",
381                 FS9721_PACKET_SIZE, 0, 0, NULL,
382                 sr_fs9721_packet_valid, sr_fs9721_parse,
383                 NULL
384         ),
385         DMM(
386                 "uni-t-ut60e-ser", fs9721,
387                 "UNI-T", "UT60E (UT-D02 cable)", "2400/8n1/rts=0/dtr=1",
388                 FS9721_PACKET_SIZE, 0, 0, NULL,
389                 sr_fs9721_packet_valid, sr_fs9721_parse,
390                 sr_fs9721_00_temp_c
391         ),
392         DMM(
393                 "va-va18b", fs9721,
394                 "V&A", "VA18B", "2400/8n1",
395                 FS9721_PACKET_SIZE, 0, 0, NULL,
396                 sr_fs9721_packet_valid, sr_fs9721_parse,
397                 sr_fs9721_01_temp_c
398         ),
399         DMM(
400                 "va-va40b", fs9721,
401                 "V&A", "VA40B", "2400/8n1",
402                 FS9721_PACKET_SIZE, 0, 0, NULL,
403                 sr_fs9721_packet_valid, sr_fs9721_parse,
404                 sr_fs9721_max_c_min
405         ),
406         DMM(
407                 "voltcraft-vc820-ser", fs9721,
408                 "Voltcraft", "VC-820 (UT-D02 cable)", "2400/8n1/rts=0/dtr=1",
409                 FS9721_PACKET_SIZE, 0, 0, NULL,
410                 sr_fs9721_packet_valid, sr_fs9721_parse,
411                 NULL
412         ),
413         DMM(
414                 "voltcraft-vc840-ser", fs9721,
415                 "Voltcraft", "VC-840 (UT-D02 cable)", "2400/8n1/rts=0/dtr=1",
416                 FS9721_PACKET_SIZE, 0, 0, NULL,
417                 sr_fs9721_packet_valid, sr_fs9721_parse,
418                 sr_fs9721_00_temp_c
419         ),
420         /* }}} */
421         /* fs9922 based meters {{{ */
422         DMM(
423                 "sparkfun-70c", fs9922,
424                 "SparkFun", "70C", "2400/8n1/rts=0/dtr=1",
425                 FS9922_PACKET_SIZE, 0, 0, NULL,
426                 sr_fs9922_packet_valid, sr_fs9922_parse, NULL
427         ),
428         DMM(
429                 "uni-t-ut61b-ser", fs9922,
430                 "UNI-T", "UT61B (UT-D02 cable)", "2400/8n1/rts=0/dtr=1",
431                 FS9922_PACKET_SIZE, 0, 0, NULL,
432                 sr_fs9922_packet_valid, sr_fs9922_parse, NULL
433         ),
434         DMM(
435                 "uni-t-ut61c-ser", fs9922,
436                 "UNI-T", "UT61C (UT-D02 cable)", "2400/8n1/rts=0/dtr=1",
437                 FS9922_PACKET_SIZE, 0, 0, NULL,
438                 sr_fs9922_packet_valid, sr_fs9922_parse, NULL
439         ),
440         DMM(
441                 "uni-t-ut61d-ser", fs9922,
442                 "UNI-T", "UT61D (UT-D02 cable)", "2400/8n1/rts=0/dtr=1",
443                 FS9922_PACKET_SIZE, 0, 0, NULL,
444                 sr_fs9922_packet_valid, sr_fs9922_parse, NULL
445         ),
446         DMM_CONN(
447                 "victor-dmm", fs9922, "Victor", "Victor DMMs",
448                 "hid/victor", "2400/8n1", FS9922_PACKET_SIZE, 0, 0, NULL,
449                 sr_fs9922_packet_valid, sr_fs9922_parse, NULL
450         ),
451         DMM(
452                 /*
453                  * Note: The VC830 doesn't set the 'volt' and 'diode' bits of
454                  * the FS9922 protocol. Instead, it only sets the user-defined
455                  * bit "z1" to indicate "diode mode" and "voltage".
456                  */
457                 "voltcraft-vc830-ser", fs9922,
458                 "Voltcraft", "VC-830 (UT-D02 cable)", "2400/8n1/rts=0/dtr=1",
459                 FS9922_PACKET_SIZE, 0, 0, NULL,
460                 sr_fs9922_packet_valid, sr_fs9922_parse,
461                 &sr_fs9922_z1_diode
462         ),
463         /* }}} */
464         /* m2110 based meters {{{ */
465         DMM(
466                 "bbcgm-2010", m2110,
467                 "BBC Goertz Metrawatt", "M2110", "1200/7n2",
468                 BBCGM_M2110_PACKET_SIZE, 0, 0, NULL,
469                 sr_m2110_packet_valid, sr_m2110_parse,
470                 NULL
471         ),
472         /* }}} */
473         /* ms2115b based meters {{{ */
474         DMM(
475                 "mastech-ms2115b", ms2115b,
476                 "MASTECH", "MS2115B", "1200/8n1",
477                 MS2115B_PACKET_SIZE, 0, 0, NULL,
478                 sr_ms2115b_packet_valid, sr_ms2115b_parse,
479                 NULL
480         ),
481         /* }}} */
482         /* ms8250d based meters {{{ */
483         DMM(
484                 "mastech-ms8250d", ms8250d,
485                 "MASTECH", "MS8250D", "2400/8n1/rts=0/dtr=1",
486                 MS8250D_PACKET_SIZE, 0, 0, NULL,
487                 sr_ms8250d_packet_valid, sr_ms8250d_parse,
488                 NULL
489         ),
490         /* }}} */
491         /* metex14 based meters {{{ */
492         DMM(
493                 "mastech-mas345", metex14,
494                 "MASTECH", "MAS345", "600/7n2/rts=0/dtr=1",
495                 METEX14_PACKET_SIZE, 0, 0, sr_metex14_packet_request,
496                 sr_metex14_packet_valid, sr_metex14_parse,
497                 NULL
498         ),
499         DMM(
500                 "metex-m3640d", metex14,
501                 "Metex", "M-3640D", "1200/7n2/rts=0/dtr=1",
502                 METEX14_PACKET_SIZE, 0, 0, sr_metex14_packet_request,
503                 sr_metex14_packet_valid, sr_metex14_parse,
504                 NULL
505         ),
506         DMM(
507                 "metex-m3860m", metex14,
508                 "Metex", "M-3860M", "9600/7n2/rts=0/dtr=1",
509                 4 * METEX14_PACKET_SIZE, 0, 0, sr_metex14_packet_request,
510                 sr_metex14_4packets_valid, sr_metex14_4packets_parse,
511                 NULL
512         ),
513         DMM(
514                 "metex-m4650cr", metex14,
515                 "Metex", "M-4650CR", "1200/7n2/rts=0/dtr=1",
516                 METEX14_PACKET_SIZE, 0, 0, sr_metex14_packet_request,
517                 sr_metex14_packet_valid, sr_metex14_parse,
518                 NULL
519         ),
520         DMM(
521                 "metex-me21", metex14,
522                 "Metex", "ME-21", "2400/7n2/rts=0/dtr=1",
523                 METEX14_PACKET_SIZE, 0, 0, sr_metex14_packet_request,
524                 sr_metex14_packet_valid, sr_metex14_parse,
525                 NULL
526         ),
527         DMM(
528                 "metex-me31", metex14,
529                 "Metex", "ME-31", "600/7n2/rts=0/dtr=1",
530                 METEX14_PACKET_SIZE, 0, 0, sr_metex14_packet_request,
531                 sr_metex14_packet_valid, sr_metex14_parse,
532                 NULL
533         ),
534         DMM(
535                 "peaktech-3410", metex14,
536                 "PeakTech", "3410", "600/7n2/rts=0/dtr=1",
537                 METEX14_PACKET_SIZE, 0, 0, sr_metex14_packet_request,
538                 sr_metex14_packet_valid, sr_metex14_parse,
539                 NULL
540         ),
541         DMM(
542                 "peaktech-4370", metex14,
543                 "PeakTech", "4370", "1200/7n2/rts=0/dtr=1",
544                 METEX14_PACKET_SIZE, 0, 0, sr_metex14_packet_request,
545                 sr_metex14_packet_valid, sr_metex14_parse,
546                 NULL
547         ),
548         DMM(
549                 "peaktech-4390a", metex14,
550                 "PeakTech", "4390A", "9600/7n2/rts=0/dtr=1",
551                 4 * METEX14_PACKET_SIZE, 0, 0, sr_metex14_packet_request,
552                 sr_metex14_4packets_valid, sr_metex14_4packets_parse,
553                 NULL
554         ),
555         DMM(
556                 "radioshack-22-168", metex14,
557                 "RadioShack", "22-168", "1200/7n2/rts=0/dtr=1",
558                 METEX14_PACKET_SIZE, 0, 0, sr_metex14_packet_request,
559                 sr_metex14_packet_valid, sr_metex14_parse,
560                 NULL
561         ),
562         DMM(
563                 "radioshack-22-805", metex14,
564                 "RadioShack", "22-805", "600/7n2/rts=0/dtr=1",
565                 METEX14_PACKET_SIZE, 0, 0, sr_metex14_packet_request,
566                 sr_metex14_packet_valid, sr_metex14_parse,
567                 NULL
568         ),
569         DMM(
570                 "voltcraft-m3650cr", metex14,
571                 "Voltcraft", "M-3650CR", "1200/7n2/rts=0/dtr=1",
572                 METEX14_PACKET_SIZE, 150, 20, sr_metex14_packet_request,
573                 sr_metex14_packet_valid, sr_metex14_parse,
574                 NULL
575         ),
576         DMM(
577                 "voltcraft-m3650d", metex14,
578                 "Voltcraft", "M-3650D", "1200/7n2/rts=0/dtr=1",
579                 METEX14_PACKET_SIZE, 0, 0, sr_metex14_packet_request,
580                 sr_metex14_packet_valid, sr_metex14_parse,
581                 NULL
582         ),
583         DMM(
584                 "voltcraft-m4650cr", metex14,
585                 "Voltcraft", "M-4650CR", "1200/7n2/rts=0/dtr=1",
586                 METEX14_PACKET_SIZE, 0, 0, sr_metex14_packet_request,
587                 sr_metex14_packet_valid, sr_metex14_parse,
588                 NULL
589         ),
590         DMM(
591                 "voltcraft-me42", metex14,
592                 "Voltcraft", "ME-42", "600/7n2/rts=0/dtr=1",
593                 METEX14_PACKET_SIZE, 250, 60, sr_metex14_packet_request,
594                 sr_metex14_packet_valid, sr_metex14_parse,
595                 NULL
596         ),
597         /* }}} */
598         /* rs9lcd based meters {{{ */
599         DMM(
600                 "radioshack-22-812", rs9lcd,
601                 "RadioShack", "22-812", "4800/8n1/rts=0/dtr=1",
602                 RS9LCD_PACKET_SIZE, 0, 0, NULL,
603                 sr_rs9lcd_packet_valid, sr_rs9lcd_parse,
604                 NULL
605         ),
606         /* }}} */
607         /* ut71x based meters {{{ */
608         DMM(
609                 "tenma-72-7730-ser", ut71x,
610                 "Tenma", "72-7730 (UT-D02 cable)", "2400/7o1/rts=0/dtr=1",
611                 UT71X_PACKET_SIZE, 0, 0, NULL,
612                 sr_ut71x_packet_valid, sr_ut71x_parse, NULL
613         ),
614         DMM(
615                 "tenma-72-7732-ser", ut71x,
616                 "Tenma", "72-7732 (UT-D02 cable)", "2400/7o1/rts=0/dtr=1",
617                 UT71X_PACKET_SIZE, 0, 0, NULL,
618                 sr_ut71x_packet_valid, sr_ut71x_parse, NULL
619         ),
620         DMM(
621                 "tenma-72-9380a-ser", ut71x,
622                 "Tenma", "72-9380A (UT-D02 cable)", "2400/7o1/rts=0/dtr=1",
623                 UT71X_PACKET_SIZE, 0, 0, NULL,
624                 sr_ut71x_packet_valid, sr_ut71x_parse, NULL
625         ),
626         DMM(
627                 "uni-t-ut71a-ser", ut71x,
628                 "UNI-T", "UT71A (UT-D02 cable)", "2400/7o1/rts=0/dtr=1",
629                 UT71X_PACKET_SIZE, 0, 0, NULL,
630                 sr_ut71x_packet_valid, sr_ut71x_parse, NULL
631         ),
632         DMM(
633                 "uni-t-ut71b-ser", ut71x,
634                 "UNI-T", "UT71B (UT-D02 cable)", "2400/7o1/rts=0/dtr=1",
635                 UT71X_PACKET_SIZE, 0, 0, NULL,
636                 sr_ut71x_packet_valid, sr_ut71x_parse, NULL
637         ),
638         DMM(
639                 "uni-t-ut71c-ser", ut71x,
640                 "UNI-T", "UT71C (UT-D02 cable)", "2400/7o1/rts=0/dtr=1",
641                 UT71X_PACKET_SIZE, 0, 0, NULL,
642                 sr_ut71x_packet_valid, sr_ut71x_parse, NULL
643         ),
644         DMM(
645                 "uni-t-ut71d-ser", ut71x,
646                 "UNI-T", "UT71D (UT-D02 cable)", "2400/7o1/rts=0/dtr=1",
647                 UT71X_PACKET_SIZE, 0, 0, NULL,
648                 sr_ut71x_packet_valid, sr_ut71x_parse, NULL
649         ),
650         DMM(
651                 "uni-t-ut71e-ser", ut71x,
652                 "UNI-T", "UT71E (UT-D02 cable)", "2400/7o1/rts=0/dtr=1",
653                 UT71X_PACKET_SIZE, 0, 0, NULL,
654                 sr_ut71x_packet_valid, sr_ut71x_parse, NULL
655         ),
656         DMM(
657                 "uni-t-ut804-ser", ut71x,
658                 "UNI-T", "UT804", "2400/7o1/rts=0/dtr=1",
659                 UT71X_PACKET_SIZE, 0, 0, NULL,
660                 sr_ut71x_packet_valid, sr_ut71x_parse, NULL
661         ),
662         DMM(
663                 "voltcraft-vc920-ser", ut71x,
664                 "Voltcraft", "VC-920 (UT-D02 cable)", "2400/7o1/rts=0/dtr=1",
665                 UT71X_PACKET_SIZE, 0, 0, NULL,
666                 sr_ut71x_packet_valid, sr_ut71x_parse, NULL
667         ),
668         DMM(
669                 "voltcraft-vc940-ser", ut71x,
670                 "Voltcraft", "VC-940 (UT-D02 cable)", "2400/7o1/rts=0/dtr=1",
671                 UT71X_PACKET_SIZE, 0, 0, NULL,
672                 sr_ut71x_packet_valid, sr_ut71x_parse, NULL
673         ),
674         DMM(
675                 "voltcraft-vc960-ser", ut71x,
676                 "Voltcraft", "VC-960 (UT-D02 cable)", "2400/7o1/rts=0/dtr=1",
677                 UT71X_PACKET_SIZE, 0, 0, NULL,
678                 sr_ut71x_packet_valid, sr_ut71x_parse, NULL
679         ),
680         /* }}} */
681         /* vc870 based meters {{{ */
682         DMM(
683                 "voltcraft-vc870-ser", vc870,
684                 "Voltcraft", "VC-870 (UT-D02 cable)", "9600/8n1/rts=0/dtr=1",
685                 VC870_PACKET_SIZE, 0, 0, NULL,
686                 sr_vc870_packet_valid, sr_vc870_parse, NULL
687         ),
688         /* }}} */
689         /* vc96 based meters {{{ */
690         DMM(
691                 "voltcraft-vc96", vc96,
692                 "Voltcraft", "VC-96", "1200/8n2",
693                 VC96_PACKET_SIZE, 0, 0, NULL,
694                 sr_vc96_packet_valid, sr_vc96_parse,
695                 NULL
696         ),
697         /* }}} */
698         /*
699          * The list is sorted. Add new items in the respective chip's group.
700          */
701 );