22 #include <sys/types.h>
28 #include "libsigrok-internal.h"
31 #define LOG_PREFIX "hwdriver: "
32 #define sr_log(l, s, args...) sr_log(l, LOG_PREFIX s, ## args)
33 #define sr_spew(s, args...) sr_spew(LOG_PREFIX s, ## args)
34 #define sr_dbg(s, args...) sr_dbg(LOG_PREFIX s, ## args)
35 #define sr_info(s, args...) sr_info(LOG_PREFIX s, ## args)
36 #define sr_warn(s, args...) sr_warn(LOG_PREFIX s, ## args)
37 #define sr_err(s, args...) sr_err(LOG_PREFIX s, ## args)
57 "Serial communication", NULL},
61 "Pre-trigger capture ratio", NULL},
63 "Pattern generator mode", NULL},
65 "Trigger types", NULL},
67 "External clock mode", NULL},
69 "Swap channel order", NULL},
71 "Run Length Encoding", NULL},
73 "Trigger slope", NULL},
75 "Trigger source", NULL},
77 "Horizontal trigger position", NULL},
83 "Filter targets", NULL},
91 "Sound pressure level frequency weighting", NULL},
93 "Sound pressure level time weighting", NULL},
99 "Sound pressure level measurement range", NULL},
101 "Voltage threshold", NULL },
105 "Data source", NULL},
106 {0, 0, NULL, NULL, NULL},
110 #ifdef HAVE_HW_BRYMEN_DMM
113 #ifdef HAVE_HW_CEM_DT_885X
116 #ifdef HAVE_HW_CENTER_3XX
120 #ifdef HAVE_HW_COLEAD_SLM
126 #ifdef HAVE_HW_IKALOGIC_SCANALOGIC2
129 #ifdef HAVE_HW_IKALOGIC_SCANAPLUS
132 #ifdef HAVE_HW_KECHENG_KC_330B
135 #ifdef HAVE_HW_LASCAR_EL_USB
138 #ifdef HAVE_HW_MIC_985XX
142 #ifdef HAVE_HW_NORMA_DMM
148 #ifdef HAVE_HW_RIGOL_DS1XX2
151 #ifdef HAVE_HW_SALEAE_LOGIC16
154 #ifdef HAVE_HW_TELEINFO
157 #ifdef HAVE_HW_TONDAJ_SL_814
160 #ifdef HAVE_HW_UNI_T_UT32X
163 #ifdef HAVE_HW_VICTOR_DMM
166 #ifdef HAVE_HW_ZEROPLUS_LOGIC_CUBE
169 #ifdef HAVE_HW_ASIX_SIGMA
172 #ifdef HAVE_HW_CHRONOVU_LA8
175 #ifdef HAVE_HW_LINK_MSO19
181 #ifdef HAVE_HW_FX2LAFW
184 #ifdef HAVE_HW_HANTEK_DSO
187 #ifdef HAVE_HW_AGILENT_DMM
190 #ifdef HAVE_HW_FLUKE_DMM
193 #ifdef HAVE_HW_SERIAL_DMM
219 #ifdef HAVE_HW_UNI_T_DMM
232 #ifdef HAVE_HW_BRYMEN_DMM
233 &brymen_bm857_driver_info,
235 #ifdef HAVE_HW_CEM_DT_885X
236 &cem_dt_885x_driver_info,
238 #ifdef HAVE_HW_CENTER_3XX
239 ¢er_309_driver_info,
240 &voltcraft_k204_driver_info,
242 #ifdef HAVE_HW_COLEAD_SLM
243 &colead_slm_driver_info,
248 #ifdef HAVE_HW_IKALOGIC_SCANALOGIC2
249 &ikalogic_scanalogic2_driver_info,
251 #ifdef HAVE_HW_IKALOGIC_SCANAPLUS
252 &ikalogic_scanaplus_driver_info,
254 #ifdef HAVE_HW_KECHENG_KC_330B
255 &kecheng_kc_330b_driver_info,
257 #ifdef HAVE_HW_LASCAR_EL_USB
258 &lascar_el_usb_driver_info,
260 #ifdef HAVE_HW_MIC_985XX
261 &mic_98581_driver_info,
262 &mic_98583_driver_info,
264 #ifdef HAVE_HW_NORMA_DMM
265 &norma_dmm_driver_info,
270 #ifdef HAVE_HW_RIGOL_DS1XX2
271 &rigol_ds1xx2_driver_info,
273 #ifdef HAVE_HW_SALEAE_LOGIC16
274 &saleae_logic16_driver_info,
276 #ifdef HAVE_HW_TELEINFO
277 &teleinfo_driver_info,
279 #ifdef HAVE_HW_TONDAJ_SL_814
280 &tondaj_sl_814_driver_info,
282 #ifdef HAVE_HW_UNI_T_UT32X
283 &uni_t_ut32x_driver_info,
285 #ifdef HAVE_HW_VICTOR_DMM
286 &victor_dmm_driver_info,
288 #ifdef HAVE_HW_ZEROPLUS_LOGIC_CUBE
289 &zeroplus_logic_cube_driver_info,
291 #ifdef HAVE_HW_ASIX_SIGMA
292 &asix_sigma_driver_info,
294 #ifdef HAVE_HW_CHRONOVU_LA8
295 &chronovu_la8_driver_info,
297 #ifdef HAVE_HW_LINK_MSO19
298 &link_mso19_driver_info,
303 #ifdef HAVE_HW_FX2LAFW
304 &fx2lafw_driver_info,
306 #ifdef HAVE_HW_HANTEK_DSO
307 &hantek_dso_driver_info,
309 #ifdef HAVE_HW_AGILENT_DMM
312 #ifdef HAVE_HW_FLUKE_DMM
313 &flukedmm_driver_info,
315 #ifdef HAVE_HW_SERIAL_DMM
316 &digitek_dt4000zc_driver_info,
317 &tekpower_tp4000zc_driver_info,
318 &metex_me31_driver_info,
319 &peaktech_3410_driver_info,
320 &mastech_mas345_driver_info,
321 &va_va18b_driver_info,
322 &metex_m3640d_driver_info,
323 &metex_m4650cr_driver_info,
324 &peaktech_4370_driver_info,
325 &pce_pce_dm32_driver_info,
326 &radioshack_22_168_driver_info,
327 &radioshack_22_805_driver_info,
328 &radioshack_22_812_driver_info,
329 &tecpel_dmm_8061_ser_driver_info,
330 &voltcraft_m3650d_driver_info,
331 &voltcraft_m4650cr_driver_info,
332 &voltcraft_vc820_ser_driver_info,
333 &voltcraft_vc830_ser_driver_info,
334 &voltcraft_vc840_ser_driver_info,
335 &uni_t_ut60a_ser_driver_info,
336 &uni_t_ut60e_ser_driver_info,
337 &uni_t_ut61d_ser_driver_info,
338 &uni_t_ut61e_ser_driver_info,
339 &iso_tech_idm103n_driver_info,
341 #ifdef HAVE_HW_UNI_T_DMM
342 &tecpel_dmm_8061_driver_info,
343 &uni_t_ut60a_driver_info,
344 &uni_t_ut60e_driver_info,
345 &uni_t_ut61d_driver_info,
346 &uni_t_ut61e_driver_info,
347 &voltcraft_vc820_driver_info,
348 &voltcraft_vc830_driver_info,
349 &voltcraft_vc840_driver_info,
386 sr_err(
"Invalid libsigrok context, can't initialize.");
391 sr_err(
"Invalid driver, can't initialize.");
395 sr_spew(
"Initializing driver '%s'.", driver->
name);
396 if ((ret = driver->
init(ctx)) < 0)
397 sr_err(
"Failed to initialize the driver: %d.", ret);
430 sr_err(
"Invalid driver, can't scan for devices.");
435 sr_err(
"Driver not initialized, can't scan for devices.");
439 l = driver->
scan(options);
441 sr_spew(
"Scan of '%s' found %d devices.", driver->
name,
448 SR_PRIV void sr_hw_cleanup_all(
void)
454 for (i = 0; drivers[i]; i++) {
466 if (!(src = g_try_malloc(
sizeof(
struct sr_config))))
469 src->
data = g_variant_ref_sink(data);
478 if (!src || !src->
data) {
479 sr_err(
"%s: invalid data!", __func__);
483 g_variant_unref(src->
data);
512 if (!driver || !data)
521 g_variant_ref_sink(*data);
545 g_variant_ref_sink(data);
547 if (!sdi || !sdi->
driver || !data)
554 g_variant_unref(data);
582 if (!driver || !data)
587 g_variant_ref_sink(*data);
604 for (i = 0; sr_config_info_data[i].
key; i++) {
605 if (sr_config_info_data[i].key == key)
606 return &sr_config_info_data[i];
624 for (i = 0; sr_config_info_data[i].
key; i++) {
625 if (!strcmp(sr_config_info_data[i].
id, optname))
626 return &sr_config_info_data[i];
635 SR_PRIV int sr_source_remove(
int fd)
641 SR_PRIV int sr_source_add(
int fd,
int events,
int timeout,
int(* init)(struct sr_context *sr_ctx)
int(* config_list)(int info_id, GVariant **data, const struct sr_dev_inst *sdi)
The device supports Run Length Encoding.
GSList *(* scan)(GSList *options)
Serial communication specification, in the form:
Specification on how to connect to a device.
int(* config_get)(int id, GVariant **data, const struct sr_dev_inst *sdi)
int sr_session_source_remove(int fd)
Remove the source belonging to the specified file descriptor.
The device supports setting its samplerate, in Hz.
The public libsigrok header file to be used by frontends.
Data source for acquisition.
int(* config_set)(int id, GVariant *data, const struct sr_dev_inst *sdi)
Generic/unspecified error.
struct sr_config_info * sr_config_info_get(int key)
Get information about a configuration key.
Sound pressure level time weighting.
struct sr_dev_driver * driver
#define sr_spew(s, args...)
The device supports setting trigger slope.
Logic low-high threshold range.
The device supports swapping channels.
#define sr_err(s, args...)
GSList * sr_driver_scan(struct sr_dev_driver *driver, GSList *options)
Tell a hardware driver to scan for devices.
The device supports setting a pre/post-trigger capture ratio.
struct sr_config_info * sr_config_info_name_get(const char *optname)
Get information about an configuration key, by name.
int(* sr_receive_data_callback_t)(int fd, int revents, void *cb_data)
int sr_config_set(const struct sr_dev_inst *sdi, int key, GVariant *data)
Set a configuration key in a device instance.
int sr_driver_init(struct sr_context *ctx, struct sr_dev_driver *driver)
Initialize a hardware driver.
The device has internal storage, into which data is logged.
The device supports setting a pattern (pattern generator mode).
struct sr_dev_driver ** sr_driver_list(void)
Return the list of supported hardware drivers.
Sound pressure level measurement range.
Sound pressure level frequency weighting.
int sr_session_source_add(int fd, int events, int timeout, sr_receive_data_callback_t cb, void *cb_data)
Add an event source for a file descriptor.
Horizontal trigger position.
The device supports using a external clock.
int sr_config_get(const struct sr_dev_driver *driver, int key, GVariant **data, const struct sr_dev_inst *sdi)
Returns information about the given driver or device instance.
int sr_config_list(const struct sr_dev_driver *driver, int key, GVariant **data, const struct sr_dev_inst *sdi)
List all possible values for a configuration key.