#include <inttypes.h>
#include <glib.h>
#include <libudev.h>
-#include <sigrok.h>
#include <arpa/inet.h>
-#include <sigrok-internal.h>
+#include "sigrok.h"
+#include "sigrok-internal.h"
#include "config.h"
#include "link-mso19.h"
#define USB_VENDOR "3195"
#define USB_PRODUCT "f190"
+#define NUM_PROBES 8
+
static int capabilities[] = {
SR_HWCAP_LOGIC_ANALYZER,
// SR_HWCAP_OSCILLOSCOPE,
0,
};
+static const char *probe_names[NUM_PROBES + 1] = {
+ "0",
+ "1",
+ "2",
+ "3",
+ "4",
+ "5",
+ "6",
+ "7",
+ NULL,
+};
+
static uint64_t supported_samplerates[] = {
SR_HZ(100),
SR_HZ(200),
return SR_OK;
}
-static void hw_closedev(int device_index)
+static int hw_closedev(int device_index)
{
struct sr_device_instance *sdi;
- if (!(sdi = sr_get_device_instance(device_instances, device_index)))
- return;
+ if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
+ sr_err("mso19: %s: sdi was NULL", __func__);
+ return SR_ERR; /* TODO: SR_ERR_ARG? */
+ }
+ /* TODO */
if (sdi->serial->fd != -1) {
serial_close(sdi->serial->fd);
sdi->serial->fd = -1;
sdi->status = SR_ST_INACTIVE;
}
+
+ return SR_OK;
}
static void *hw_get_device_info(int device_index, int device_info_id)
info = sdi;
break;
case SR_DI_NUM_PROBES: /* FIXME: How to report analog probe? */
- info = GINT_TO_POINTER(8);
+ info = GINT_TO_POINTER(NUM_PROBES);
+ break;
+ case SR_DI_PROBE_NAMES:
+ info = probe_names;
break;
case SR_DI_SAMPLERATES:
info = &samplerates;
.api_version = 1,
.init = hw_init,
.cleanup = hw_cleanup,
- .open = hw_opendev,
- .close = hw_closedev,
+ .opendev = hw_opendev,
+ .closedev = hw_closedev,
.get_device_info = hw_get_device_info,
.get_status = hw_get_status,
.get_capabilities = hw_get_capabilities,