]>
Commit | Line | Data |
---|---|---|
16e76bae MS |
1 | /* |
2 | * This file is part of the libsigrok project. | |
3 | * | |
4 | * Copyright (C) 2013 Marc Schink <sigrok-dev@marcschink.de> | |
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 | ||
20 | #include "protocol.h" | |
21 | ||
f254bc4b | 22 | static const uint32_t devopts[] = { |
e52e712d | 23 | SR_CONF_LOGIC_ANALYZER, |
5827f61b BV |
24 | SR_CONF_LIMIT_SAMPLES | SR_CONF_SET | SR_CONF_LIST, |
25 | SR_CONF_SAMPLERATE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST, | |
26 | SR_CONF_TRIGGER_MATCH | SR_CONF_LIST, | |
27 | SR_CONF_CAPTURE_RATIO | SR_CONF_GET | SR_CONF_SET, | |
e52e712d MS |
28 | }; |
29 | ||
02d5c0d8 BV |
30 | static const int32_t trigger_matches[] = { |
31 | SR_TRIGGER_RISING, | |
32 | SR_TRIGGER_FALLING, | |
33 | SR_TRIGGER_EDGE, | |
34 | }; | |
35 | ||
79914b3a | 36 | SR_PRIV const uint64_t sl2_samplerates[NUM_SAMPLERATES] = { |
e52e712d MS |
37 | SR_KHZ(1.25), |
38 | SR_KHZ(10), | |
39 | SR_KHZ(50), | |
40 | SR_KHZ(100), | |
41 | SR_KHZ(250), | |
42 | SR_KHZ(500), | |
43 | SR_MHZ(1), | |
44 | SR_MHZ(2.5), | |
45 | SR_MHZ(5), | |
46 | SR_MHZ(10), | |
c824eb63 | 47 | SR_MHZ(20), |
e52e712d MS |
48 | }; |
49 | ||
3f239f08 | 50 | static const char *channel_names[NUM_CHANNELS + 1] = { |
e52e712d | 51 | "0", "1", "2", "3", |
c824eb63 | 52 | NULL, |
e52e712d MS |
53 | }; |
54 | ||
16e76bae MS |
55 | SR_PRIV struct sr_dev_driver ikalogic_scanalogic2_driver_info; |
56 | static struct sr_dev_driver *di = &ikalogic_scanalogic2_driver_info; | |
57 | ||
16e76bae MS |
58 | static int init(struct sr_context *sr_ctx) |
59 | { | |
e52e712d | 60 | return std_init(sr_ctx, di, LOG_PREFIX); |
16e76bae MS |
61 | } |
62 | ||
63 | static GSList *scan(GSList *options) | |
64 | { | |
e52e712d | 65 | GSList *usb_devices, *devices, *l; |
16e76bae | 66 | struct drv_context *drvc; |
e52e712d | 67 | struct sr_dev_inst *sdi; |
ba7dd8bb | 68 | struct sr_channel *ch; |
e52e712d MS |
69 | struct dev_context *devc; |
70 | struct sr_usb_dev_inst *usb; | |
71 | struct device_info dev_info; | |
65340dd5 | 72 | int ret, i; |
e52e712d | 73 | char *fw_ver_str; |
16e76bae MS |
74 | |
75 | (void)options; | |
76 | ||
77 | devices = NULL; | |
78 | drvc = di->priv; | |
79 | drvc->instances = NULL; | |
e52e712d MS |
80 | |
81 | usb_devices = sr_usb_find(drvc->sr_ctx->libusb_ctx, USB_VID_PID); | |
82 | ||
83 | if (usb_devices == NULL) | |
84 | return NULL; | |
85 | ||
c824eb63 | 86 | for (l = usb_devices; l; l = l->next) { |
e52e712d MS |
87 | usb = l->data; |
88 | ||
79914b3a UH |
89 | if ((ret = sl2_get_device_info(*usb, &dev_info)) < 0) { |
90 | sr_warn("Failed to get device information: %d.", ret); | |
e52e712d MS |
91 | sr_usb_dev_inst_free(usb); |
92 | continue; | |
93 | } | |
94 | ||
c824eb63 | 95 | if (!(devc = g_try_malloc(sizeof(struct dev_context)))) { |
e52e712d MS |
96 | sr_err("Device instance malloc failed."); |
97 | sr_usb_dev_inst_free(usb); | |
98 | continue; | |
99 | } | |
100 | ||
101 | if (!(devc->xfer_in = libusb_alloc_transfer(0))) { | |
102 | sr_err("Transfer malloc failed."); | |
103 | sr_usb_dev_inst_free(usb); | |
104 | g_free(devc); | |
105 | continue; | |
106 | } | |
107 | ||
108 | if (!(devc->xfer_out = libusb_alloc_transfer(0))) { | |
109 | sr_err("Transfer malloc failed."); | |
110 | sr_usb_dev_inst_free(usb); | |
111 | libusb_free_transfer(devc->xfer_in); | |
112 | g_free(devc); | |
113 | continue; | |
114 | } | |
115 | ||
116 | fw_ver_str = g_strdup_printf("%u.%u", dev_info.fw_ver_major, | |
117 | dev_info.fw_ver_minor); | |
e52e712d MS |
118 | if (!fw_ver_str) { |
119 | sr_err("Firmware string malloc failed."); | |
120 | sr_usb_dev_inst_free(usb); | |
121 | libusb_free_transfer(devc->xfer_in); | |
122 | libusb_free_transfer(devc->xfer_out); | |
123 | g_free(devc); | |
124 | continue; | |
125 | } | |
126 | ||
65340dd5 | 127 | sdi = sr_dev_inst_new(SR_ST_INACTIVE, VENDOR_NAME, |
e52e712d | 128 | MODEL_NAME, fw_ver_str); |
e52e712d | 129 | g_free(fw_ver_str); |
e52e712d MS |
130 | if (!sdi) { |
131 | sr_err("sr_dev_inst_new failed."); | |
132 | sr_usb_dev_inst_free(usb); | |
133 | libusb_free_transfer(devc->xfer_in); | |
134 | libusb_free_transfer(devc->xfer_out); | |
135 | g_free(devc); | |
136 | continue; | |
137 | } | |
138 | ||
139 | sdi->priv = devc; | |
140 | sdi->driver = di; | |
141 | sdi->inst_type = SR_INST_USB; | |
142 | sdi->conn = usb; | |
65340dd5 | 143 | sdi->serial_num = g_strdup_printf("%d", dev_info.serial); |
e52e712d | 144 | |
ba7dd8bb | 145 | for (i = 0; channel_names[i]; i++) { |
3f239f08 | 146 | ch = sr_channel_new(i, SR_CHANNEL_LOGIC, TRUE, |
ba7dd8bb UH |
147 | channel_names[i]); |
148 | sdi->channels = g_slist_append(sdi->channels, ch); | |
149 | devc->channels[i] = ch; | |
e52e712d MS |
150 | } |
151 | ||
152 | devc->state = STATE_IDLE; | |
153 | devc->next_state = STATE_IDLE; | |
154 | ||
155 | /* Set default samplerate. */ | |
79914b3a | 156 | sl2_set_samplerate(sdi, DEFAULT_SAMPLERATE); |
e52e712d MS |
157 | |
158 | /* Set default capture ratio. */ | |
159 | devc->capture_ratio = 0; | |
160 | ||
161 | /* Set default after trigger delay. */ | |
162 | devc->after_trigger_delay = 0; | |
163 | ||
164 | memset(devc->xfer_buf_in, 0, LIBUSB_CONTROL_SETUP_SIZE + | |
165 | PACKET_LENGTH); | |
166 | memset(devc->xfer_buf_out, 0, LIBUSB_CONTROL_SETUP_SIZE + | |
167 | PACKET_LENGTH); | |
168 | ||
169 | libusb_fill_control_setup(devc->xfer_buf_in, | |
fb8d593c | 170 | USB_REQUEST_TYPE_IN, USB_HID_GET_REPORT, |
e52e712d MS |
171 | USB_HID_REPORT_TYPE_FEATURE, USB_INTERFACE, |
172 | PACKET_LENGTH); | |
173 | libusb_fill_control_setup(devc->xfer_buf_out, | |
174 | USB_REQUEST_TYPE_OUT, USB_HID_SET_REPORT, | |
175 | USB_HID_REPORT_TYPE_FEATURE, USB_INTERFACE, | |
176 | PACKET_LENGTH); | |
177 | ||
178 | devc->xfer_data_in = devc->xfer_buf_in + | |
179 | LIBUSB_CONTROL_SETUP_SIZE; | |
180 | devc->xfer_data_out = devc->xfer_buf_out + | |
181 | LIBUSB_CONTROL_SETUP_SIZE; | |
182 | ||
183 | drvc->instances = g_slist_append(drvc->instances, sdi); | |
184 | devices = g_slist_append(devices, sdi); | |
e52e712d | 185 | } |
16e76bae | 186 | |
e52e712d | 187 | g_slist_free(usb_devices); |
16e76bae MS |
188 | |
189 | return devices; | |
190 | } | |
191 | ||
192 | static GSList *dev_list(void) | |
193 | { | |
c824eb63 | 194 | return ((struct drv_context *)(di->priv))->instances; |
16e76bae MS |
195 | } |
196 | ||
e52e712d MS |
197 | static void clear_dev_context(void *priv) |
198 | { | |
c824eb63 UH |
199 | struct dev_context *devc; |
200 | ||
201 | devc = priv; | |
e52e712d | 202 | |
c824eb63 | 203 | sr_dbg("Device context cleared."); |
e52e712d MS |
204 | |
205 | libusb_free_transfer(devc->xfer_in); | |
206 | libusb_free_transfer(devc->xfer_out); | |
207 | g_free(devc); | |
208 | } | |
209 | ||
16e76bae MS |
210 | static int dev_clear(void) |
211 | { | |
e52e712d | 212 | return std_dev_clear(di, &clear_dev_context); |
16e76bae MS |
213 | } |
214 | ||
215 | static int dev_open(struct sr_dev_inst *sdi) | |
216 | { | |
e52e712d MS |
217 | struct drv_context *drvc; |
218 | struct dev_context *devc; | |
219 | struct sr_usb_dev_inst *usb; | |
220 | uint8_t buffer[PACKET_LENGTH]; | |
221 | int ret; | |
222 | ||
223 | if (!(drvc = di->priv)) { | |
224 | sr_err("Driver was not initialized."); | |
225 | return SR_ERR; | |
226 | } | |
227 | ||
228 | usb = sdi->conn; | |
229 | devc = sdi->priv; | |
16e76bae | 230 | |
e52e712d MS |
231 | if (sr_usb_open(drvc->sr_ctx->libusb_ctx, usb) != SR_OK) |
232 | return SR_ERR; | |
233 | ||
234 | /* | |
235 | * Determine if a kernel driver is active on this interface and, if so, | |
236 | * detach it. | |
237 | */ | |
238 | if (libusb_kernel_driver_active(usb->devhdl, USB_INTERFACE) == 1) { | |
239 | ret = libusb_detach_kernel_driver(usb->devhdl, USB_INTERFACE); | |
e52e712d | 240 | if (ret < 0) { |
9526f2d4 | 241 | sr_err("Failed to detach kernel driver: %s.", |
e52e712d MS |
242 | libusb_error_name(ret)); |
243 | return SR_ERR; | |
244 | } | |
245 | } | |
246 | ||
79914b3a | 247 | if ((ret = libusb_claim_interface(usb->devhdl, USB_INTERFACE)) < 0) { |
e52e712d MS |
248 | sr_err("Failed to claim interface: %s.", |
249 | libusb_error_name(ret)); | |
250 | return SR_ERR; | |
251 | } | |
252 | ||
253 | libusb_fill_control_transfer(devc->xfer_in, usb->devhdl, | |
79914b3a | 254 | devc->xfer_buf_in, sl2_receive_transfer_in, |
e52e712d MS |
255 | sdi, USB_TIMEOUT); |
256 | ||
257 | libusb_fill_control_transfer(devc->xfer_out, usb->devhdl, | |
79914b3a | 258 | devc->xfer_buf_out, sl2_receive_transfer_out, |
e52e712d MS |
259 | sdi, USB_TIMEOUT); |
260 | ||
261 | memset(buffer, 0, sizeof(buffer)); | |
262 | ||
263 | buffer[0] = CMD_RESET; | |
79914b3a | 264 | if ((ret = sl2_transfer_out(usb->devhdl, buffer)) != PACKET_LENGTH) { |
e52e712d MS |
265 | sr_err("Device reset failed: %s.", libusb_error_name(ret)); |
266 | return SR_ERR; | |
267 | } | |
268 | ||
269 | /* | |
270 | * Set the device to idle state. If the device is not in idle state it | |
c824eb63 UH |
271 | * possibly will reset itself after a few seconds without being used |
272 | * and thereby close the connection. | |
e52e712d MS |
273 | */ |
274 | buffer[0] = CMD_IDLE; | |
79914b3a | 275 | if ((ret = sl2_transfer_out(usb->devhdl, buffer)) != PACKET_LENGTH) { |
e52e712d MS |
276 | sr_err("Failed to set device in idle state: %s.", |
277 | libusb_error_name(ret)); | |
278 | return SR_ERR; | |
279 | } | |
16e76bae MS |
280 | |
281 | sdi->status = SR_ST_ACTIVE; | |
282 | ||
283 | return SR_OK; | |
284 | } | |
285 | ||
286 | static int dev_close(struct sr_dev_inst *sdi) | |
287 | { | |
e52e712d MS |
288 | struct sr_usb_dev_inst *usb; |
289 | ||
290 | if (!di->priv) { | |
291 | sr_err("Driver was not initialized."); | |
292 | return SR_ERR; | |
293 | } | |
294 | ||
295 | usb = sdi->conn; | |
296 | ||
297 | if (!usb->devhdl) | |
298 | return SR_OK; | |
16e76bae | 299 | |
e52e712d MS |
300 | libusb_release_interface(usb->devhdl, USB_INTERFACE); |
301 | libusb_close(usb->devhdl); | |
16e76bae | 302 | |
e52e712d | 303 | usb->devhdl = NULL; |
16e76bae MS |
304 | sdi->status = SR_ST_INACTIVE; |
305 | ||
306 | return SR_OK; | |
307 | } | |
308 | ||
309 | static int cleanup(void) | |
310 | { | |
c824eb63 | 311 | return dev_clear(); |
16e76bae MS |
312 | } |
313 | ||
584560f1 | 314 | static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, |
53b4680f | 315 | const struct sr_channel_group *cg) |
16e76bae | 316 | { |
e52e712d | 317 | struct dev_context *devc; |
16e76bae MS |
318 | int ret; |
319 | ||
53b4680f | 320 | (void)cg; |
d3c74a6f | 321 | |
16e76bae | 322 | ret = SR_OK; |
e52e712d MS |
323 | devc = sdi->priv; |
324 | ||
16e76bae | 325 | switch (key) { |
e52e712d MS |
326 | case SR_CONF_SAMPLERATE: |
327 | *data = g_variant_new_uint64(devc->samplerate); | |
328 | break; | |
329 | case SR_CONF_CAPTURE_RATIO: | |
330 | *data = g_variant_new_uint64(devc->capture_ratio); | |
331 | break; | |
16e76bae MS |
332 | default: |
333 | return SR_ERR_NA; | |
334 | } | |
335 | ||
336 | return ret; | |
337 | } | |
338 | ||
584560f1 | 339 | static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, |
53b4680f | 340 | const struct sr_channel_group *cg) |
16e76bae | 341 | { |
e52e712d | 342 | uint64_t samplerate, limit_samples, capture_ratio; |
16e76bae MS |
343 | int ret; |
344 | ||
53b4680f | 345 | (void)cg; |
d3c74a6f | 346 | |
16e76bae MS |
347 | if (sdi->status != SR_ST_ACTIVE) |
348 | return SR_ERR_DEV_CLOSED; | |
349 | ||
350 | ret = SR_OK; | |
e52e712d | 351 | |
16e76bae | 352 | switch (key) { |
e52e712d MS |
353 | case SR_CONF_LIMIT_SAMPLES: |
354 | limit_samples = g_variant_get_uint64(data); | |
79914b3a | 355 | ret = sl2_set_limit_samples(sdi, limit_samples); |
e52e712d MS |
356 | break; |
357 | case SR_CONF_SAMPLERATE: | |
358 | samplerate = g_variant_get_uint64(data); | |
79914b3a | 359 | ret = sl2_set_samplerate(sdi, samplerate); |
e52e712d MS |
360 | break; |
361 | case SR_CONF_CAPTURE_RATIO: | |
362 | capture_ratio = g_variant_get_uint64(data); | |
79914b3a | 363 | ret = sl2_set_capture_ratio(sdi, capture_ratio); |
e52e712d | 364 | break; |
16e76bae | 365 | default: |
e52e712d | 366 | return SR_ERR_NA; |
16e76bae MS |
367 | } |
368 | ||
369 | return ret; | |
370 | } | |
371 | ||
584560f1 | 372 | static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, |
53b4680f | 373 | const struct sr_channel_group *cg) |
16e76bae | 374 | { |
f0de2dd0 | 375 | GVariant *gvar, *grange[2]; |
e52e712d | 376 | GVariantBuilder gvb; |
16e76bae MS |
377 | int ret; |
378 | ||
379 | (void)sdi; | |
53b4680f | 380 | (void)cg; |
16e76bae MS |
381 | |
382 | ret = SR_OK; | |
e52e712d | 383 | |
16e76bae | 384 | switch (key) { |
e52e712d | 385 | case SR_CONF_DEVICE_OPTIONS: |
584560f1 | 386 | *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, |
f254bc4b | 387 | devopts, ARRAY_SIZE(devopts), sizeof(uint32_t)); |
e52e712d MS |
388 | break; |
389 | case SR_CONF_SAMPLERATE: | |
390 | g_variant_builder_init(&gvb, G_VARIANT_TYPE("a{sv}")); | |
391 | gvar = g_variant_new_fixed_array(G_VARIANT_TYPE("t"), | |
79914b3a | 392 | sl2_samplerates, ARRAY_SIZE(sl2_samplerates), |
e52e712d MS |
393 | sizeof(uint64_t)); |
394 | g_variant_builder_add(&gvb, "{sv}", "samplerates", gvar); | |
395 | *data = g_variant_builder_end(&gvb); | |
396 | break; | |
02d5c0d8 BV |
397 | case SR_CONF_TRIGGER_MATCH: |
398 | *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, | |
399 | trigger_matches, ARRAY_SIZE(trigger_matches), | |
400 | sizeof(int32_t)); | |
e52e712d | 401 | break; |
f0de2dd0 BV |
402 | case SR_CONF_LIMIT_SAMPLES: |
403 | grange[0] = g_variant_new_uint64(0); | |
404 | grange[1] = g_variant_new_uint64(MAX_SAMPLES); | |
405 | *data = g_variant_new_tuple(grange, 2); | |
406 | break; | |
16e76bae MS |
407 | default: |
408 | return SR_ERR_NA; | |
409 | } | |
410 | ||
411 | return ret; | |
412 | } | |
413 | ||
e52e712d | 414 | static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) |
16e76bae | 415 | { |
e52e712d MS |
416 | struct drv_context *drvc; |
417 | struct dev_context *devc; | |
418 | uint16_t trigger_bytes, tmp; | |
419 | unsigned int i, j; | |
420 | int ret; | |
16e76bae MS |
421 | |
422 | if (sdi->status != SR_ST_ACTIVE) | |
423 | return SR_ERR_DEV_CLOSED; | |
424 | ||
e52e712d MS |
425 | devc = sdi->priv; |
426 | drvc = di->priv; | |
427 | ||
428 | devc->cb_data = cb_data; | |
429 | devc->wait_data_ready_locked = TRUE; | |
430 | devc->stopping_in_progress = FALSE; | |
431 | devc->transfer_error = FALSE; | |
432 | devc->samples_processed = 0; | |
433 | devc->channel = 0; | |
434 | devc->sample_packet = 0; | |
435 | ||
436 | /* | |
437 | * The trigger must be configured first because the calculation of the | |
438 | * pre and post trigger samples depends on a configured trigger. | |
439 | */ | |
02d5c0d8 | 440 | sl2_convert_trigger(sdi); |
79914b3a | 441 | sl2_calculate_trigger_samples(sdi); |
e52e712d MS |
442 | |
443 | trigger_bytes = devc->pre_trigger_bytes + devc->post_trigger_bytes; | |
444 | ||
445 | /* Calculate the number of expected sample packets. */ | |
446 | devc->num_sample_packets = trigger_bytes / PACKET_NUM_SAMPLE_BYTES; | |
447 | ||
448 | /* Round up the number of expected sample packets. */ | |
449 | if (trigger_bytes % PACKET_NUM_SAMPLE_BYTES != 0) | |
450 | devc->num_sample_packets++; | |
451 | ||
ba7dd8bb | 452 | devc->num_enabled_channels = 0; |
e52e712d MS |
453 | |
454 | /* | |
ba7dd8bb | 455 | * Count the number of enabled channels and number them for a sequential |
e52e712d MS |
456 | * access. |
457 | */ | |
3f239f08 | 458 | for (i = 0, j = 0; i < NUM_CHANNELS; i++) { |
ba7dd8bb UH |
459 | if (devc->channels[i]->enabled) { |
460 | devc->num_enabled_channels++; | |
461 | devc->channel_map[j] = i; | |
e52e712d MS |
462 | j++; |
463 | } | |
464 | } | |
465 | ||
ba7dd8bb | 466 | sr_dbg("Number of enabled channels: %i.", devc->num_enabled_channels); |
e52e712d MS |
467 | |
468 | /* Set up the transfer buffer for the acquisition. */ | |
469 | devc->xfer_data_out[0] = CMD_SAMPLE; | |
470 | devc->xfer_data_out[1] = 0x00; | |
471 | ||
472 | tmp = GUINT16_TO_LE(devc->pre_trigger_bytes); | |
473 | memcpy(devc->xfer_data_out + 2, &tmp, sizeof(tmp)); | |
474 | ||
475 | tmp = GUINT16_TO_LE(devc->post_trigger_bytes); | |
476 | memcpy(devc->xfer_data_out + 4, &tmp, sizeof(tmp)); | |
477 | ||
478 | devc->xfer_data_out[6] = devc->samplerate_id; | |
479 | devc->xfer_data_out[7] = devc->trigger_type; | |
480 | devc->xfer_data_out[8] = devc->trigger_channel; | |
481 | devc->xfer_data_out[9] = 0x00; | |
482 | ||
483 | tmp = GUINT16_TO_LE(devc->after_trigger_delay); | |
484 | memcpy(devc->xfer_data_out + 10, &tmp, sizeof(tmp)); | |
485 | ||
e52e712d | 486 | if ((ret = libusb_submit_transfer(devc->xfer_out)) != 0) { |
c824eb63 | 487 | sr_err("Submit transfer failed: %s.", libusb_error_name(ret)); |
e52e712d MS |
488 | return SR_ERR; |
489 | } | |
490 | ||
102f1239 BV |
491 | usb_source_add(sdi->session, drvc->sr_ctx, 100, |
492 | ikalogic_scanalogic2_receive_data, (void *)sdi); | |
e52e712d MS |
493 | |
494 | sr_dbg("Acquisition started successfully."); | |
495 | ||
496 | /* Send header packet to the session bus. */ | |
497 | std_session_send_df_header(cb_data, LOG_PREFIX); | |
498 | ||
499 | devc->next_state = STATE_SAMPLE; | |
16e76bae MS |
500 | |
501 | return SR_OK; | |
502 | } | |
503 | ||
504 | static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data) | |
505 | { | |
506 | (void)cb_data; | |
507 | ||
508 | if (sdi->status != SR_ST_ACTIVE) | |
509 | return SR_ERR_DEV_CLOSED; | |
510 | ||
e52e712d MS |
511 | sr_dbg("Stopping acquisition."); |
512 | ||
513 | sdi->status = SR_ST_STOPPING; | |
16e76bae MS |
514 | |
515 | return SR_OK; | |
516 | } | |
517 | ||
518 | SR_PRIV struct sr_dev_driver ikalogic_scanalogic2_driver_info = { | |
519 | .name = "ikalogic-scanalogic2", | |
e52e712d | 520 | .longname = "IKALOGIC Scanalogic-2", |
16e76bae MS |
521 | .api_version = 1, |
522 | .init = init, | |
523 | .cleanup = cleanup, | |
524 | .scan = scan, | |
525 | .dev_list = dev_list, | |
526 | .dev_clear = dev_clear, | |
527 | .config_get = config_get, | |
528 | .config_set = config_set, | |
529 | .config_list = config_list, | |
530 | .dev_open = dev_open, | |
531 | .dev_close = dev_close, | |
532 | .dev_acquisition_start = dev_acquisition_start, | |
533 | .dev_acquisition_stop = dev_acquisition_stop, | |
534 | .priv = NULL, | |
535 | }; |