22 #include <sys/types.h>
28 #include "libsigrok-internal.h"
31 #define LOG_PREFIX "hwdriver"
52 "Serial communication", NULL},
56 "Pre-trigger capture ratio", NULL},
60 "Trigger types", NULL},
62 "External clock mode", NULL},
64 "Swap channel order", NULL},
66 "Run Length Encoding", NULL},
68 "Trigger slope", NULL},
70 "Trigger source", NULL},
72 "Horizontal trigger position", NULL},
78 "Filter targets", NULL},
86 "Sound pressure level frequency weighting", NULL},
88 "Sound pressure level time weighting", NULL},
94 "Sound pressure level measurement range", NULL},
96 "Voltage threshold", NULL },
100 "Data source", NULL},
102 "Number of logic channels", NULL},
104 "Number of analog channels", NULL},
106 "Current output voltage", NULL},
108 "Maximum output voltage", NULL},
110 "Current output current", NULL},
112 "Maximum output current", NULL},
114 "Output enabled", NULL},
116 "Output channel modes", NULL},
118 "Over-voltage protection", NULL},
120 "Over-current protection", NULL},
122 "Sample limit", NULL},
125 {0, 0, NULL, NULL, NULL},
129 #ifdef HAVE_HW_APPA_55II
132 #ifdef HAVE_HW_ATTEN_PPS3XXX
135 #ifdef HAVE_HW_BRYMEN_BM86X
138 #ifdef HAVE_HW_BRYMEN_DMM
141 #ifdef HAVE_HW_CEM_DT_885X
144 #ifdef HAVE_HW_CENTER_3XX
148 #ifdef HAVE_HW_COLEAD_SLM
151 #ifdef HAVE_HW_CONRAD_DIGI_35_CPU
157 #ifdef HAVE_HW_GMC_MH_1X_2X
161 #ifdef HAVE_HW_HAMEG_HMO
164 #ifdef HAVE_HW_IKALOGIC_SCANALOGIC2
167 #ifdef HAVE_HW_IKALOGIC_SCANAPLUS
170 #ifdef HAVE_HW_KECHENG_KC_330B
173 #ifdef HAVE_HW_LASCAR_EL_USB
176 #ifdef HAVE_HW_MIC_985XX
180 #ifdef HAVE_HW_NORMA_DMM
186 #ifdef HAVE_HW_RIGOL_DS
189 #ifdef HAVE_HW_SALEAE_LOGIC16
192 #ifdef HAVE_HW_SYSCLK_LWLA
195 #ifdef HAVE_HW_TELEINFO
198 #ifdef HAVE_HW_TONDAJ_SL_814
201 #ifdef HAVE_HW_UNI_T_UT32X
204 #ifdef HAVE_HW_VICTOR_DMM
207 #ifdef HAVE_HW_ZEROPLUS_LOGIC_CUBE
210 #ifdef HAVE_HW_ASIX_SIGMA
213 #ifdef HAVE_HW_CHRONOVU_LA
216 #ifdef HAVE_HW_LINK_MSO19
219 #ifdef HAVE_HW_FX2LAFW
222 #ifdef HAVE_HW_HANTEK_DSO
225 #ifdef HAVE_HW_AGILENT_DMM
228 #ifdef HAVE_HW_FLUKE_DMM
231 #ifdef HAVE_HW_SERIAL_DMM
266 #ifdef HAVE_HW_UNI_T_DMM
284 #ifdef HAVE_HW_APPA_55II
285 &appa_55ii_driver_info,
287 #ifdef HAVE_HW_ATTEN_PPS3XXX
288 &atten_pps3203_driver_info,
290 #ifdef HAVE_HW_BRYMEN_BM86X
291 &brymen_bm86x_driver_info,
293 #ifdef HAVE_HW_BRYMEN_DMM
294 &brymen_bm857_driver_info,
296 #ifdef HAVE_HW_CEM_DT_885X
297 &cem_dt_885x_driver_info,
299 #ifdef HAVE_HW_CENTER_3XX
300 ¢er_309_driver_info,
301 &voltcraft_k204_driver_info,
303 #ifdef HAVE_HW_COLEAD_SLM
304 &colead_slm_driver_info,
306 #ifdef HAVE_HW_CONRAD_DIGI_35_CPU
307 &conrad_digi_35_cpu_driver_info,
312 #ifdef HAVE_HW_GMC_MH_1X_2X
313 &gmc_mh_1x_2x_rs232_driver_info,
314 &gmc_mh_2x_bd232_driver_info,
316 #ifdef HAVE_HW_HAMEG_HMO
317 &hameg_hmo_driver_info,
319 #ifdef HAVE_HW_IKALOGIC_SCANALOGIC2
320 &ikalogic_scanalogic2_driver_info,
322 #ifdef HAVE_HW_IKALOGIC_SCANAPLUS
323 &ikalogic_scanaplus_driver_info,
325 #ifdef HAVE_HW_KECHENG_KC_330B
326 &kecheng_kc_330b_driver_info,
328 #ifdef HAVE_HW_LASCAR_EL_USB
329 &lascar_el_usb_driver_info,
331 #ifdef HAVE_HW_MIC_985XX
332 &mic_98581_driver_info,
333 &mic_98583_driver_info,
335 #ifdef HAVE_HW_NORMA_DMM
336 &norma_dmm_driver_info,
341 #ifdef HAVE_HW_RIGOL_DS
342 &rigol_ds_driver_info,
344 #ifdef HAVE_HW_SALEAE_LOGIC16
345 &saleae_logic16_driver_info,
347 #ifdef HAVE_HW_SYSCLK_LWLA
348 &sysclk_lwla_driver_info,
350 #ifdef HAVE_HW_TELEINFO
351 &teleinfo_driver_info,
353 #ifdef HAVE_HW_TONDAJ_SL_814
354 &tondaj_sl_814_driver_info,
356 #ifdef HAVE_HW_UNI_T_UT32X
357 &uni_t_ut32x_driver_info,
359 #ifdef HAVE_HW_VICTOR_DMM
360 &victor_dmm_driver_info,
362 #ifdef HAVE_HW_ZEROPLUS_LOGIC_CUBE
363 &zeroplus_logic_cube_driver_info,
365 #ifdef HAVE_HW_ASIX_SIGMA
366 &asix_sigma_driver_info,
368 #ifdef HAVE_HW_CHRONOVU_LA
369 &chronovu_la_driver_info,
371 #ifdef HAVE_HW_LINK_MSO19
372 &link_mso19_driver_info,
374 #ifdef HAVE_HW_FX2LAFW
375 &fx2lafw_driver_info,
377 #ifdef HAVE_HW_HANTEK_DSO
378 &hantek_dso_driver_info,
380 #ifdef HAVE_HW_AGILENT_DMM
383 #ifdef HAVE_HW_FLUKE_DMM
384 &flukedmm_driver_info,
386 #ifdef HAVE_HW_SERIAL_DMM
387 &bbcgm_m2110_driver_info,
388 &digitek_dt4000zc_driver_info,
389 &tekpower_tp4000zc_driver_info,
390 &metex_me31_driver_info,
391 &peaktech_3410_driver_info,
392 &mastech_mas345_driver_info,
393 &va_va18b_driver_info,
394 &va_va40b_driver_info,
395 &metex_m3640d_driver_info,
396 &metex_m4650cr_driver_info,
397 &peaktech_4370_driver_info,
398 &pce_pce_dm32_driver_info,
399 &radioshack_22_168_driver_info,
400 &radioshack_22_805_driver_info,
401 &radioshack_22_812_driver_info,
402 &tecpel_dmm_8061_ser_driver_info,
403 &voltcraft_m3650cr_driver_info,
404 &voltcraft_m3650d_driver_info,
405 &voltcraft_m4650cr_driver_info,
406 &voltcraft_me42_driver_info,
407 &voltcraft_vc820_ser_driver_info,
408 &voltcraft_vc830_ser_driver_info,
409 &voltcraft_vc840_ser_driver_info,
410 &uni_t_ut60a_ser_driver_info,
411 &uni_t_ut60e_ser_driver_info,
412 &uni_t_ut60g_ser_driver_info,
413 &uni_t_ut61b_ser_driver_info,
414 &uni_t_ut61c_ser_driver_info,
415 &uni_t_ut61d_ser_driver_info,
416 &uni_t_ut61e_ser_driver_info,
417 &iso_tech_idm103n_driver_info,
418 &tenma_72_7745_ser_driver_info,
419 &tenma_72_7750_ser_driver_info,
421 #ifdef HAVE_HW_UNI_T_DMM
422 &tecpel_dmm_8061_driver_info,
423 &uni_t_ut60a_driver_info,
424 &uni_t_ut60e_driver_info,
425 &uni_t_ut60g_driver_info,
426 &uni_t_ut61b_driver_info,
427 &uni_t_ut61c_driver_info,
428 &uni_t_ut61d_driver_info,
429 &uni_t_ut61e_driver_info,
430 &voltcraft_vc820_driver_info,
431 &voltcraft_vc830_driver_info,
432 &voltcraft_vc840_driver_info,
433 &tenma_72_7745_driver_info,
434 &tenma_72_7750_driver_info,
476 sr_err(
"Invalid libsigrok context, can't initialize.");
481 sr_err(
"Invalid driver, can't initialize.");
485 sr_spew(
"Initializing driver '%s'.", driver->
name);
486 if ((ret = driver->
init(ctx)) < 0)
487 sr_err(
"Failed to initialize the driver: %d.", ret);
522 sr_err(
"Invalid driver, can't scan for devices.");
527 sr_err(
"Driver not initialized, can't scan for devices.");
531 l = driver->
scan(options);
533 sr_spew(
"Scan of '%s' found %d devices.", driver->
name,
541 SR_PRIV void sr_hw_cleanup_all(
void)
547 for (i = 0; drivers[i]; i++) {
561 if (!(src = g_try_malloc(
sizeof(
struct sr_config))))
564 src->
data = g_variant_ref_sink(data);
575 if (!src || !src->
data) {
576 sr_err(
"%s: invalid data!", __func__);
580 g_variant_unref(src->
data);
612 int key, GVariant **data)
616 if (!driver || !data)
625 g_variant_ref_sink(*data);
652 int key, GVariant *data)
656 g_variant_ref_sink(data);
658 if (!sdi || !sdi->
driver || !data)
665 g_variant_unref(data);
719 int key, GVariant **data)
723 if (!driver || !data)
728 g_variant_ref_sink(*data);
747 for (i = 0; sr_config_info_data[i].
key; i++) {
748 if (sr_config_info_data[i].key == key)
749 return &sr_config_info_data[i];
769 for (i = 0; sr_config_info_data[i].
key; i++) {
770 if (!strcmp(sr_config_info_data[i].
id, optname))
771 return &sr_config_info_data[i];
782 SR_PRIV int sr_source_remove(
int fd)
790 SR_PRIV int sr_source_add(
int fd,
int events,
int timeout,
Generic/unspecified error.
The device supports setting the number of logic channels.
The device supports setting the number of analog channels.
GSList *(* scan)(GSList *options)
Scan for devices.
The device supports setting a sample number limit (how many samples should be acquired).
The device supports Run Length Encoding.
GVariant * data
Key-specific data.
GSList * sr_driver_scan(struct sr_dev_driver *driver, GSList *options)
Tell a hardware driver to scan for devices.
Used for setting or getting value of a config item.
Channel output configuration.
Enabling/disabling output.
int sr_driver_init(struct sr_context *ctx, struct sr_dev_driver *driver)
Initialize a hardware driver.
Data source for acquisition.
const struct sr_config_info * sr_config_info_get(int key)
Get information about a configuration key, by key.
The public libsigrok header file to be used by frontends.
Logic low-high threshold range.
int key
Config key like SR_CONF_CONN, etc.
The device supports setting a pre/post-trigger capture ratio.
Horizontal trigger position.
Specification on how to connect to a device.
struct sr_dev_driver ** sr_driver_list(void)
Return the list of supported hardware drivers.
int sr_config_commit(const struct sr_dev_inst *sdi)
Apply configuration settings to the device hardware.
The device has internal storage, into which data is logged.
int(* cleanup)(void)
Called before driver is unloaded.
Over-voltage protection (OVP)
The device supports using an external clock.
The device supports setting its samplerate, in Hz.
Opaque structure representing a libsigrok context.
int sr_config_get(const struct sr_dev_driver *driver, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg, int key, GVariant **data)
Query value of a configuration key at the given driver or device instance.
int(* sr_receive_data_callback)(int fd, int revents, void *cb_data)
Type definition for callback function for data reception.
The device supports swapping channels.
int sr_config_list(const struct sr_dev_driver *driver, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg, int key, GVariant **data)
List all possible values for a configuration key.
Sound pressure level time weighting.
Over-current protection (OCP)
int(* init)(struct sr_context *sr_ctx)
Called when driver is loaded, e.g.
int key
Config key like SR_CONF_CONN, etc.
The device supports setting trigger slope.
Serial communication specification, in the form:
const struct sr_config_info * sr_config_info_name_get(const char *optname)
Get information about a configuration key, by name.
int(* config_get)(int id, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
Query value of a configuration key in driver or given device instance.
void * priv
Device driver private data.
int sr_config_set(const struct sr_dev_inst *sdi, const struct sr_channel_group *cg, int key, GVariant *data)
Set value of a configuration key in a device instance.
The device supports setting a pattern (pattern generator mode).
int(* config_list)(int info_id, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
List all possible values for a configuration key in a device instance.
int sr_session_source_remove(int fd)
Remove the source belonging to the specified file descriptor.
int(* config_commit)(const struct sr_dev_inst *sdi)
Apply configuration settings to the device hardware.
struct sr_dev_driver * driver
Device driver.
int(* config_set)(int id, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
Set value of a configuration key in driver or a given device instance.
Sound pressure level measurement range.
Information about a config key.
Structure for groups of channels that have common properties.
Sound pressure level frequency weighting.
int sr_session_source_add(int fd, int events, int timeout, sr_receive_data_callback cb, void *cb_data)
Add an event source for a file descriptor.
Choice of clock edge for external clock ("r" or "f").