X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fdemo%2Fdemo.c;h=6605d1e6c321f6fe5be8998d65a4799a5594cce3;hb=826938d81e2e5bf592fbed82523081fcb7fdf85e;hp=c06a814a789f2181cafa32b14fceebc197baf61e;hpb=9c939c5132d82575cc1ce8f8fef5b6c4289aec5b;p=libsigrok.git diff --git a/hardware/demo/demo.c b/hardware/demo/demo.c index c06a814a..6605d1e6 100644 --- a/hardware/demo/demo.c +++ b/hardware/demo/demo.c @@ -22,14 +22,14 @@ #include #include #include -#include -#include #ifdef _WIN32 #include #include #define pipe(fds) _pipe(fds, 4096, _O_BINARY) #endif #include "config.h" +#include "sigrok.h" +#include "sigrok-internal.h" /* TODO: Number of probes should be configurable. */ #define NUM_PROBES 8 @@ -102,6 +102,18 @@ static const char *pattern_strings[] = { NULL, }; +static const char *probe_names[NUM_PROBES + 1] = { + "0", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + NULL, +}; + static uint8_t pattern_sigrok[] = { 0x4c, 0x92, 0x92, 0x92, 0x64, 0x00, 0x00, 0x00, 0x82, 0xfe, 0xfe, 0x82, 0x00, 0x00, 0x00, 0x00, @@ -130,7 +142,7 @@ static int hw_init(const char *deviceinfo) struct sr_device_instance *sdi; /* Avoid compiler warnings. */ - deviceinfo = deviceinfo; + (void)deviceinfo; sdi = sr_device_instance_new(0, SR_ST_ACTIVE, DEMONAME, NULL, NULL); if (!sdi) { @@ -146,7 +158,7 @@ static int hw_init(const char *deviceinfo) static int hw_opendev(int device_index) { /* Avoid compiler warnings. */ - device_index = device_index; + (void)device_index; /* Nothing needed so far. */ @@ -156,7 +168,7 @@ static int hw_opendev(int device_index) static int hw_closedev(int device_index) { /* Avoid compiler warnings. */ - device_index = device_index; + (void)device_index; /* Nothing needed so far. */ @@ -185,6 +197,9 @@ static void *hw_get_device_info(int device_index, int device_info_id) case SR_DI_NUM_PROBES: info = GINT_TO_POINTER(NUM_PROBES); break; + case SR_DI_PROBE_NAMES: + info = probe_names; + break; case SR_DI_SAMPLERATES: info = &samplerates; break; @@ -202,7 +217,7 @@ static void *hw_get_device_info(int device_index, int device_info_id) static int hw_get_status(int device_index) { /* Avoid compiler warnings. */ - device_index = device_index; + (void)device_index; return SR_ST_ACTIVE; } @@ -218,7 +233,7 @@ static int hw_set_configuration(int device_index, int capability, void *value) char *stropt; /* Avoid compiler warnings. */ - device_index = device_index; + (void)device_index; if (capability == SR_HWCAP_PROBECONFIG) { /* Nothing to do, but must be supported */ @@ -359,8 +374,8 @@ static int receive_data(int fd, int revents, void *session_data) gsize z; /* Avoid compiler warnings. */ - fd = fd; - revents = revents; + (void)fd; + (void)revents; do { g_io_channel_read_chars(channels[0], @@ -471,8 +486,8 @@ static int hw_start_acquisition(int device_index, gpointer session_data) static void hw_stop_acquisition(int device_index, gpointer session_data) { /* Avoid compiler warnings. */ - device_index = device_index; - session_data = session_data; + (void)device_index; + (void)session_data; /* Stop generate thread. */ thread_running = 0;