]> sigrok.org Git - libsigrok.git/blame - src/hardware/gmc-mh-1x-2x/api.c
Construct driver array at runtime, from an array of per-file arrays.
[libsigrok.git] / src / hardware / gmc-mh-1x-2x / api.c
CommitLineData
7b4edcb6
MH
1/*
2 * This file is part of the libsigrok project.
3 *
c90beca7 4 * Copyright (C) 2013, 2014 Matthias Heidbrink <m-sigrok@heidbrink.biz>
7b4edcb6
MH
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
6392d599
MH
20/** @file
21 * Gossen Metrawatt Metrahit 1x/2x drivers
c90beca7 22 * @internal
6392d599
MH
23 */
24
f5792417 25#include <string.h>
7b4edcb6
MH
26#include "protocol.h"
27
f5792417
MH
28/* Serial communication parameters for Metrahit 1x/2x with 'RS232' adaptor */
29#define SERIALCOMM_1X_RS232 "8228/6n1/dtr=1/rts=1/flow=0" /* =8192, closer with divider */
30#define SERIALCOMM_2X_RS232 "9600/6n1/dtr=1/rts=1/flow=0"
6392d599 31#define SERIALCOMM_2X "9600/8n1/dtr=1/rts=1/flow=0"
f5792417
MH
32#define VENDOR_GMC "Gossen Metrawatt"
33
7b4edcb6 34SR_PRIV struct sr_dev_driver gmc_mh_1x_2x_rs232_driver_info;
c90beca7 35SR_PRIV struct sr_dev_driver gmc_mh_2x_bd232_driver_info;
7b4edcb6 36
a0e0bb41 37static const uint32_t scanopts[] = {
f5792417
MH
38 SR_CONF_CONN,
39 SR_CONF_SERIALCOMM,
40};
41
c90beca7 42/** Hardware capabilities for Metrahit 1x/2x devices in send mode. */
f254bc4b 43static const uint32_t devopts_sm[] = {
f5792417 44 SR_CONF_MULTIMETER,
6392d599 45 SR_CONF_THERMOMETER, /**< All GMC 1x/2x multimeters seem to support this */
f5792417 46 SR_CONF_CONTINUOUS,
5827f61b
BV
47 SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET,
48 SR_CONF_LIMIT_MSEC | SR_CONF_GET | SR_CONF_SET,
f5792417
MH
49};
50
c90beca7 51/** Hardware capabilities for Metrahit 2x devices in bidirectional Mode. */
f254bc4b 52static const uint32_t devopts_bd[] = {
c90beca7
MH
53 SR_CONF_MULTIMETER,
54 SR_CONF_THERMOMETER, /**< All GMC 1x/2x multimeters seem to support this */
c90beca7 55 SR_CONF_CONTINUOUS,
5827f61b
BV
56 SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET,
57 SR_CONF_LIMIT_MSEC | SR_CONF_GET | SR_CONF_SET,
58 SR_CONF_POWER_OFF | SR_CONF_GET | SR_CONF_SET,
c90beca7
MH
59};
60
61
6392d599
MH
62/* TODO:
63 * - For the 29S SR_CONF_ENERGYMETER, too.
64 * - SR_CONF_PATTERN_MODE for some 2x devices
65 * - SR_CONF_DATALOG for 22M, 26M, 29S and storage adaptors.
66 * Need to implement device-specific lists.
67 */
68
69/** Init driver gmc_mh_1x_2x_rs232. */
c90beca7
MH
70static int init_1x_2x_rs232(struct sr_context *sr_ctx)
71{
72 return std_init(sr_ctx, &gmc_mh_1x_2x_rs232_driver_info, LOG_PREFIX);
73}
74
75/** Init driver gmc_mh_2x_bd232. */
76static int init_2x_bd232(struct sr_context *sr_ctx)
7b4edcb6 77{
c90beca7 78 return std_init(sr_ctx, &gmc_mh_2x_bd232_driver_info, LOG_PREFIX);
7b4edcb6
MH
79}
80
fc348b77
UH
81/**
82 * Read single byte from serial port.
83 *
84 * @retval -1 Timeout or error.
85 * @retval other Byte.
f5792417
MH
86 */
87static int read_byte(struct sr_serial_dev_inst *serial, gint64 timeout)
7b4edcb6 88{
fc348b77 89 uint8_t result = 0;
f5792417
MH
90 int rc = 0;
91
92 for (;;) {
0714a010 93 rc = serial_read_nonblocking(serial, &result, 1);
f5792417
MH
94 if (rc == 1) {
95 sr_spew("read: 0x%02x/%d", result, result);
96 return result;
97 }
98 if (g_get_monotonic_time() > timeout)
99 return -1;
100 g_usleep(2000);
101 }
102}
103
fc348b77
UH
104/**
105 * Try to detect GMC 1x/2x multimeter model in send mode for max. 1 second.
f5792417 106 *
fc348b77
UH
107 * @param serial Configured, open serial port.
108 *
109 * @retval NULL Detection failed.
110 * @retval other Model code.
f5792417
MH
111 */
112static enum model scan_model_sm(struct sr_serial_dev_inst *serial)
113{
114 int byte, bytecnt, cnt;
115 enum model model;
116 gint64 timeout_us;
117
873e0c12 118 model = METRAHIT_NONE;
fc348b77 119 timeout_us = g_get_monotonic_time() + 1 * 1000 * 1000;
f5792417 120
fc348b77
UH
121 /*
122 * Try to find message consisting of device code and several
123 * (at least 4) data bytes.
124 */
f5792417
MH
125 for (bytecnt = 0; bytecnt < 100; bytecnt++) {
126 byte = read_byte(serial, timeout_us);
127 if ((byte == -1) || (timeout_us < g_get_monotonic_time()))
128 break;
129 if ((byte & MSGID_MASK) == MSGID_INF) {
873e0c12 130 if (!(model = gmc_decode_model_sm(byte & MSGC_MASK)))
f5792417 131 break;
fc348b77 132 /* Now expect (at least) 4 data bytes. */
f5792417
MH
133 for (cnt = 0; cnt < 4; cnt++) {
134 byte = read_byte(serial, timeout_us);
135 if ((byte == -1) ||
c90beca7 136 ((byte & MSGID_MASK) != MSGID_DATA))
f5792417 137 {
873e0c12 138 model = METRAHIT_NONE;
f5792417
MH
139 bytecnt = 100;
140 break;
141 }
142 }
143 break;
144 }
145 }
7b4edcb6 146
f5792417
MH
147 return model;
148}
149
fc348b77
UH
150/**
151 * Scan for Metrahit 1x and Metrahit 2x in send mode using Gossen Metrawatt
152 * 'RS232' interface.
153 *
154 * The older 1x models use 8192 baud and the newer 2x 9600 baud.
155 * The DMM usually sends up to about 20 messages per second. However, depending
156 * on configuration and measurement mode the intervals can be much larger and
157 * then the detection might not work.
f5792417 158 */
c90beca7 159static GSList *scan_1x_2x_rs232(GSList *options)
f5792417
MH
160{
161 struct sr_dev_inst *sdi;
162 struct drv_context *drvc;
163 struct dev_context *devc;
164 struct sr_config *src;
f5792417
MH
165 struct sr_serial_dev_inst *serial;
166 GSList *l, *devices;
167 const char *conn, *serialcomm;
168 enum model model;
169 gboolean serialcomm_given;
7b4edcb6
MH
170
171 devices = NULL;
6392d599 172 drvc = (&gmc_mh_1x_2x_rs232_driver_info)->priv;
7b4edcb6 173 drvc->instances = NULL;
f5792417 174 conn = serialcomm = NULL;
873e0c12 175 model = METRAHIT_NONE;
f5792417
MH
176 serialcomm_given = FALSE;
177
c90beca7 178 sr_spew("scan_1x_2x_rs232() called!");
f5792417
MH
179
180 for (l = options; l; l = l->next) {
181 src = l->data;
182 switch (src->key) {
183 case SR_CONF_CONN:
184 conn = g_variant_get_string(src->data, NULL);
185 break;
186 case SR_CONF_SERIALCOMM:
187 serialcomm = g_variant_get_string(src->data, NULL);
188 serialcomm_given = TRUE;
189 break;
190 }
191 }
192 if (!conn)
193 return NULL;
194 if (!serialcomm)
195 serialcomm = SERIALCOMM_2X_RS232;
196
91219afc 197 serial = sr_serial_dev_inst_new(conn, serialcomm);
f5792417 198
e13e354f 199 if (serial_open(serial, SERIAL_RDWR) != SR_OK) {
f5792417
MH
200 sr_serial_dev_inst_free(serial);
201 return NULL;
202 }
7b4edcb6 203
f5792417
MH
204 serial_flush(serial);
205
206 model = scan_model_sm(serial);
207
fc348b77
UH
208 /*
209 * If detection failed and no user-supplied parameters,
210 * try second baud rate.
211 */
873e0c12 212 if ((model == METRAHIT_NONE) && !serialcomm_given) {
f5792417
MH
213 serialcomm = SERIALCOMM_1X_RS232;
214 g_free(serial->serialcomm);
215 serial->serialcomm = g_strdup(serialcomm);
216 if (serial_set_paramstr(serial, serialcomm) == SR_OK) {
217 serial_flush(serial);
218 model = scan_model_sm(serial);
219 }
220 }
221
873e0c12
UH
222 if (model != METRAHIT_NONE) {
223 sr_spew("%s %s detected!", VENDOR_GMC, gmc_model_str(model));
aac29cc1 224 sdi = g_malloc0(sizeof(struct sr_dev_inst));
0af636be
UH
225 sdi->status = SR_ST_INACTIVE;
226 sdi->vendor = g_strdup(VENDOR_GMC);
227 sdi->model = g_strdup(gmc_model_str(model));
f57d8ffe 228 devc = g_malloc0(sizeof(struct dev_context));
f5792417
MH
229 devc->model = model;
230 devc->limit_samples = 0;
231 devc->limit_msec = 0;
232 devc->num_samples = 0;
233 devc->elapsed_msec = g_timer_new();
234 devc->settings_ok = FALSE;
f5792417
MH
235 sdi->conn = serial;
236 sdi->priv = devc;
6392d599 237 sdi->driver = &gmc_mh_1x_2x_rs232_driver_info;
5e23fcab 238 sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "P1");
f5792417
MH
239 drvc->instances = g_slist_append(drvc->instances, sdi);
240 devices = g_slist_append(devices, sdi);
241 }
7b4edcb6
MH
242
243 return devices;
244}
245
c90beca7
MH
246/** Scan for Metrahit 2x in a bidirectional mode using Gossen Metrawatt 'BD 232' interface.
247 *
248 */
249static GSList *scan_2x_bd232(GSList *options)
250{
251 struct sr_dev_inst *sdi;
252 struct drv_context *drvc;
253 struct dev_context *devc;
254 struct sr_config *src;
c90beca7
MH
255 struct sr_serial_dev_inst *serial;
256 GSList *l, *devices;
257 const char *conn, *serialcomm;
258 int cnt, byte;
259 gint64 timeout_us;
260
261 sdi = NULL;
262 devc = NULL;
263 conn = serialcomm = NULL;
264 devices = NULL;
265
266 drvc = (&gmc_mh_2x_bd232_driver_info)->priv;
267 drvc->instances = NULL;
268
269 sr_spew("scan_2x_bd232() called!");
270
271 for (l = options; l; l = l->next) {
272 src = l->data;
273 switch (src->key) {
274 case SR_CONF_CONN:
275 conn = g_variant_get_string(src->data, NULL);
276 break;
277 case SR_CONF_SERIALCOMM:
278 serialcomm = g_variant_get_string(src->data, NULL);
279 break;
280 }
281 }
282 if (!conn)
283 return NULL;
284 if (!serialcomm)
285 serialcomm = SERIALCOMM_2X;
286
91219afc 287 serial = sr_serial_dev_inst_new(conn, serialcomm);
c90beca7 288
e13e354f 289 if (serial_open(serial, SERIAL_RDWR) != SR_OK)
c90beca7
MH
290 goto exit_err;
291
f57d8ffe 292 devc = g_malloc0(sizeof(struct dev_context));
c90beca7 293
aac29cc1 294 sdi = g_malloc0(sizeof(struct sr_dev_inst));
0af636be
UH
295 sdi->status = SR_ST_INACTIVE;
296 sdi->vendor = g_strdup(VENDOR_GMC);
c90beca7
MH
297 sdi->priv = devc;
298
299 /* Send message 03 "Query multimeter version and status" */
300 sdi->conn = serial;
301 sdi->priv = devc;
302 if (req_stat14(sdi, TRUE) != SR_OK)
303 goto exit_err;
304
305 /* Wait for reply from device(s) for up to 2s. */
306 timeout_us = g_get_monotonic_time() + 2*1000*1000;
307
308 while (timeout_us > g_get_monotonic_time()) {
309 /* Receive reply (14 bytes) */
310 devc->buflen = 0;
311 for (cnt = 0; cnt < 14; cnt++) {
312 byte = read_byte(serial, timeout_us);
313 if (byte != -1)
314 devc->buf[devc->buflen++] = (byte & MASK_6BITS);
315 }
316
317 if (devc->buflen != 14)
318 continue;
319
320 devc->addr = devc->buf[0];
321 process_msg14(sdi);
322 devc->buflen = 0;
323
324 if (devc->model != METRAHIT_NONE) {
325 sr_spew("%s %s detected!", VENDOR_GMC, gmc_model_str(devc->model));
c90beca7 326 devc->elapsed_msec = g_timer_new();
c90beca7
MH
327 sdi->model = g_strdup(gmc_model_str(devc->model));
328 sdi->version = g_strdup_printf("Firmware %d.%d", devc->fw_ver_maj, devc->fw_ver_min);
329 sdi->conn = serial;
330 sdi->priv = devc;
331 sdi->driver = &gmc_mh_2x_bd232_driver_info;
5e23fcab 332 sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "P1");
c90beca7
MH
333 drvc->instances = g_slist_append(drvc->instances, sdi);
334 devices = g_slist_append(devices, sdi);
f57d8ffe 335 devc = g_malloc0(sizeof(struct dev_context));
aac29cc1 336 sdi = g_malloc0(sizeof(struct sr_dev_inst));
0af636be
UH
337 sdi->status = SR_ST_INACTIVE;
338 sdi->vendor = g_strdup(VENDOR_GMC);
c90beca7
MH
339 }
340 };
341
342 /* Free last alloc if no device found */
343 if (devc->model == METRAHIT_NONE) {
344 g_free(devc);
345 sr_dev_inst_free(sdi);
346 }
347
348 return devices;
349
350exit_err:
351 sr_info("scan_2x_bd232(): Error!");
352
353 if (serial)
354 sr_serial_dev_inst_free(serial);
355 if (devc)
356 g_free(devc);
357 if (sdi)
358 sr_dev_inst_free(sdi);
359
360 return NULL;
361}
362
363/** Driver device list function */
364static GSList *dev_list_1x_2x_rs232(void)
365{
366 return ((struct drv_context *)(gmc_mh_1x_2x_rs232_driver_info.priv))->instances;
367}
368
369/** Driver device list function */
370static GSList *dev_list_2x_bd232(void)
7b4edcb6 371{
c90beca7
MH
372 return ((struct drv_context *)(gmc_mh_2x_bd232_driver_info.priv))
373 ->instances;
7b4edcb6
MH
374}
375
7b4edcb6
MH
376static int dev_close(struct sr_dev_inst *sdi)
377{
f5792417 378 struct dev_context *devc;
7b4edcb6 379
bf2c987f 380 std_serial_dev_close(sdi);
7b4edcb6
MH
381
382 sdi->status = SR_ST_INACTIVE;
383
f5792417
MH
384 /* Free dynamically allocated resources. */
385 if ((devc = sdi->priv) && devc->elapsed_msec) {
386 g_timer_destroy(devc->elapsed_msec);
387 devc->elapsed_msec = NULL;
873e0c12 388 devc->model = METRAHIT_NONE;
f5792417
MH
389 }
390
7b4edcb6
MH
391 return SR_OK;
392}
393
c90beca7
MH
394static int cleanup_sm_rs232(void)
395{
a6630742 396 return std_dev_clear(&gmc_mh_1x_2x_rs232_driver_info, NULL);
c90beca7
MH
397}
398
399static int cleanup_2x_bd232(void)
7b4edcb6 400{
a6630742 401 return std_dev_clear(&gmc_mh_2x_bd232_driver_info, NULL);
7b4edcb6
MH
402}
403
6392d599 404/** Get value of configuration item */
584560f1
BV
405static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
406 const struct sr_channel_group *cg)
7b4edcb6
MH
407{
408 int ret;
fadd0707 409 struct dev_context *devc;
c90beca7 410
53b4680f 411 (void)cg;
c90beca7 412
6392d599 413 ret = SR_OK;
7b4edcb6 414
6392d599
MH
415 if (!sdi || !(devc = sdi->priv))
416 return SR_ERR_ARG;
417
7b4edcb6
MH
418 ret = SR_OK;
419 switch (key) {
6392d599
MH
420 case SR_CONF_LIMIT_SAMPLES:
421 *data = g_variant_new_uint64(devc->limit_samples);
422 break;
423 case SR_CONF_LIMIT_MSEC:
424 *data = g_variant_new_uint64(devc->limit_msec);
425 break;
c90beca7
MH
426 case SR_CONF_POWER_OFF:
427 *data = g_variant_new_boolean(FALSE);
428 break;
7b4edcb6
MH
429 default:
430 return SR_ERR_NA;
431 }
432
433 return ret;
434}
435
c90beca7 436/** Implementation of config_list, auxiliary function for common parts, */
584560f1
BV
437static int config_list_common(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
438 const struct sr_channel_group *cg)
7b4edcb6 439{
c90beca7 440 (void)sdi;
53b4680f 441 (void)cg;
7b4edcb6 442
7b4edcb6 443 switch (key) {
c90beca7 444 case SR_CONF_SCAN_OPTIONS:
584560f1 445 *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,
5827f61b 446 scanopts, ARRAY_SIZE(scanopts), sizeof(uint32_t));
f5792417 447 break;
7b4edcb6 448 default:
f5792417 449 return SR_ERR_NA;
7b4edcb6
MH
450 }
451
f5792417 452 return SR_OK;
7b4edcb6
MH
453}
454
c90beca7 455/** Implementation of config_list for Metrahit 1x/2x send mode */
584560f1 456static int config_list_sm(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
53b4680f 457 const struct sr_channel_group *cg)
7b4edcb6 458{
7b4edcb6 459 switch (key) {
c90beca7 460 case SR_CONF_DEVICE_OPTIONS:
584560f1 461 *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,
5827f61b 462 devopts_sm, ARRAY_SIZE(devopts_sm), sizeof(uint32_t));
f5792417 463 break;
c90beca7 464 default:
53b4680f 465 return config_list_common(key, data, sdi, cg);
c90beca7
MH
466 }
467
468 return SR_OK;
469}
470
471/** Implementation of config_list for Metrahit 2x bidirectional mode */
584560f1 472static int config_list_bd(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
53b4680f 473 const struct sr_channel_group *cg)
c90beca7 474{
c90beca7 475 switch (key) {
f5792417 476 case SR_CONF_DEVICE_OPTIONS:
584560f1 477 *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,
5827f61b 478 devopts_bd, ARRAY_SIZE(devopts_bd), sizeof(uint32_t));
f5792417 479 break;
7b4edcb6 480 default:
53b4680f 481 return config_list_common(key, data, sdi, cg);
7b4edcb6
MH
482 }
483
f5792417 484 return SR_OK;
7b4edcb6
MH
485}
486
c90beca7
MH
487static int dev_acquisition_start_1x_2x_rs232(const struct sr_dev_inst *sdi,
488 void *cb_data)
7b4edcb6 489{
f5792417
MH
490 struct dev_context *devc;
491 struct sr_serial_dev_inst *serial;
492
493 if (!sdi || !cb_data || !(devc = sdi->priv))
494 return SR_ERR_BUG;
7b4edcb6
MH
495
496 if (sdi->status != SR_ST_ACTIVE)
497 return SR_ERR_DEV_CLOSED;
498
f5792417
MH
499 devc->cb_data = cb_data;
500 devc->settings_ok = FALSE;
501 devc->buflen = 0;
502
503 /* Send header packet to the session bus. */
504 std_session_send_df_header(cb_data, LOG_PREFIX);
505
506 /* Start timer, if required. */
507 if (devc->limit_msec)
508 g_timer_start(devc->elapsed_msec);
509
510 /* Poll every 40ms, or whenever some data comes in. */
511 serial = sdi->conn;
102f1239
BV
512 serial_source_add(sdi->session, serial, G_IO_IN, 40,
513 gmc_mh_1x_2x_receive_data, (void *)sdi);
7b4edcb6
MH
514
515 return SR_OK;
516}
517
c90beca7
MH
518static int dev_acquisition_start_2x_bd232(const struct sr_dev_inst *sdi,
519 void *cb_data)
520{
521 struct dev_context *devc;
522 struct sr_serial_dev_inst *serial;
523
524 if (!sdi || !cb_data || !(devc = sdi->priv))
525 return SR_ERR_BUG;
526
527 if (sdi->status != SR_ST_ACTIVE)
528 return SR_ERR_DEV_CLOSED;
529
530 devc->cb_data = cb_data;
531 devc->settings_ok = FALSE;
532 devc->buflen = 0;
533
534 /* Send header packet to the session bus. */
535 std_session_send_df_header(cb_data, LOG_PREFIX);
536
537 /* Start timer, if required. */
538 if (devc->limit_msec)
539 g_timer_start(devc->elapsed_msec);
540
541 /* Poll every 40ms, or whenever some data comes in. */
542 serial = sdi->conn;
102f1239
BV
543 serial_source_add(sdi->session, serial, G_IO_IN, 40,
544 gmc_mh_2x_receive_data, (void *)sdi);
c90beca7
MH
545
546 /* Send start message */
547 return req_meas14(sdi);
548}
549
27fd2eaa 550static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
7b4edcb6 551{
f5792417 552 struct dev_context *devc;
7b4edcb6 553
f5792417
MH
554 /* Stop timer, if required. */
555 if (sdi && (devc = sdi->priv) && devc->limit_msec)
556 g_timer_stop(devc->elapsed_msec);
7b4edcb6 557
d43b0908 558 return std_serial_dev_acquisition_stop(sdi, cb_data, dev_close,
f5792417 559 sdi->conn, LOG_PREFIX);
7b4edcb6
MH
560}
561
562SR_PRIV struct sr_dev_driver gmc_mh_1x_2x_rs232_driver_info = {
563 .name = "gmc-mh-1x-2x-rs232",
a90061e5 564 .longname = "Gossen Metrawatt Metrahit 1x/2x, RS232 interface",
7b4edcb6 565 .api_version = 1,
c90beca7
MH
566 .init = init_1x_2x_rs232,
567 .cleanup = cleanup_sm_rs232,
568 .scan = scan_1x_2x_rs232,
569 .dev_list = dev_list_1x_2x_rs232,
a6630742 570 .dev_clear = NULL,
c90beca7
MH
571 .config_get = config_get,
572 .config_set = config_set,
573 .config_list = config_list_sm,
574 .dev_open = std_serial_dev_open,
575 .dev_close = dev_close,
576 .dev_acquisition_start = dev_acquisition_start_1x_2x_rs232,
577 .dev_acquisition_stop = dev_acquisition_stop,
578 .priv = NULL,
579};
580
581SR_PRIV struct sr_dev_driver gmc_mh_2x_bd232_driver_info = {
582 .name = "gmc-mh-2x-bd232",
a90061e5 583 .longname = "Gossen Metrawatt Metrahit 2x, BD232/SI232-II interface",
c90beca7
MH
584 .api_version = 1,
585 .init = init_2x_bd232,
586 .cleanup = cleanup_2x_bd232,
587 .scan = scan_2x_bd232,
588 .dev_list = dev_list_2x_bd232,
a6630742 589 .dev_clear = NULL,
7b4edcb6
MH
590 .config_get = config_get,
591 .config_set = config_set,
c90beca7 592 .config_list = config_list_bd,
854434de 593 .dev_open = std_serial_dev_open,
7b4edcb6 594 .dev_close = dev_close,
c90beca7 595 .dev_acquisition_start = dev_acquisition_start_2x_bd232,
27fd2eaa 596 .dev_acquisition_stop = dev_acquisition_stop,
7b4edcb6
MH
597 .priv = NULL,
598};