X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fasix-sigma%2Fasix-sigma.c;h=723b2445f454a77cd7b1d4772d60b54a985996f8;hb=c37d2b1ba12b62d63590509879bf58adf842896d;hp=e7d6f7833103bd608a4a29344bbec7ec2ad9f4ea;hpb=719c5a934c7705466a449854b876b9962eb4cb5e;p=libsigrok.git diff --git a/hardware/asix-sigma/asix-sigma.c b/hardware/asix-sigma/asix-sigma.c index e7d6f783..723b2445 100644 --- a/hardware/asix-sigma/asix-sigma.c +++ b/hardware/asix-sigma/asix-sigma.c @@ -29,8 +29,8 @@ #include #include #include -#include -#include +#include "sigrok.h" +#include "sigrok-internal.h" #include "asix-sigma.h" #define USB_VENDOR 0xa600 @@ -40,6 +40,7 @@ #define USB_MODEL_NAME "SIGMA" #define USB_MODEL_VERSION "" #define TRIGGER_TYPES "rf10" +#define NUM_PROBES 16 static GSList *device_instances = NULL; @@ -57,6 +58,26 @@ static uint64_t supported_samplerates[] = { 0, }; +static const char *probe_names[NUM_PROBES + 1] = { + "0", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "10", + "11", + "12", + "13", + "14", + "15", + NULL, +}; + static struct sr_samplerates samplerates = { SR_KHZ(200), SR_MHZ(200), @@ -400,7 +421,7 @@ static int hw_init(const char *deviceinfo) struct sigma *sigma; /* Avoid compiler warnings. */ - deviceinfo = deviceinfo; + (void)deviceinfo; if (!(sigma = g_try_malloc(sizeof(struct sigma)))) { sr_err("sigma: %s: sigma malloc failed", __func__); @@ -724,7 +745,7 @@ static void *hw_get_device_info(int device_index, int device_info_id) void *info = NULL; if (!(sdi = sr_get_device_instance(device_instances, device_index))) { - fprintf(stderr, "It's NULL.\n"); + sr_err("It's NULL.\n"); return NULL; } @@ -735,7 +756,10 @@ static void *hw_get_device_info(int device_index, int device_info_id) info = sdi; break; case SR_DI_NUM_PROBES: - info = GINT_TO_POINTER(16); + info = GINT_TO_POINTER(NUM_PROBES); + break; + case SR_DI_PROBE_NAMES: + info = probe_names; break; case SR_DI_SAMPLERATES: info = &samplerates; @@ -997,8 +1021,9 @@ static int receive_data(int fd, int revents, void *session_data) uint64_t running_msec; struct timeval tv; - fd = fd; - revents = revents; + /* Avoid compiler warnings. */ + (void)fd; + (void)revents; numchunks = (sigma->state.stoppos + 511) / 512; @@ -1245,7 +1270,8 @@ static int hw_start_acquisition(int device_index, gpointer session_data) struct triggerinout triggerinout_conf; struct triggerlut lut; - session_data = session_data; + /* Avoid compiler warnings. */ + (void)session_data; if (!(sdi = sr_get_device_instance(device_instances, device_index))) return SR_ERR; @@ -1361,7 +1387,8 @@ static void hw_stop_acquisition(int device_index, gpointer session_data) sigma = sdi->priv; - session_data = session_data; + /* Avoid compiler warnings. */ + (void)session_data; /* Stop acquisition. */ sigma_set_register(WRITE_MODE, 0x11, sigma);