]> sigrok.org Git - libsigrok.git/commitdiff
Changed SR_T_NULL to SR_T_BOOL and adjusted RLE option.
authorGareth McMullin <redacted>
Sat, 19 Nov 2011 00:41:41 +0000 (13:41 +1300)
committerGareth McMullin <redacted>
Sat, 19 Nov 2011 00:41:41 +0000 (13:41 +1300)
hardware/openbench-logic-sniffer/ols.c
hwplugin.c
sigrok-proto.h
sigrok.h.in
strutil.c

index 35db8402f7b64a99eebb24304c9ede8fe1f3437a..57881f838c9a061b6a0da4615c2737069c929092 100644 (file)
@@ -618,7 +618,7 @@ static int hw_set_configuration(int device_index, int capability, void *value)
                        ret = SR_OK;
                break;
        case SR_HWCAP_RLE:
-               if (!strcmp(value, "on")) {
+               if (GPOINTER_TO_INT(value)) {
                        sr_info("ols: enabling RLE");
                        ols->flag_reg |= FLAG_RLE;
                }
index f3401dc784ec9a3b9e8c9d70a382e358e4e30871..43e6ef7912cf5be03df2eb505a4be41244f6cee9 100644 (file)
@@ -39,7 +39,7 @@ struct sr_hwcap_option sr_hwcap_options[] = {
        {SR_HWCAP_SAMPLERATE, SR_T_UINT64, "Sample rate", "samplerate"},
        {SR_HWCAP_CAPTURE_RATIO, SR_T_UINT64, "Pre-trigger capture ratio", "captureratio"},
        {SR_HWCAP_PATTERN_MODE, SR_T_CHAR, "Pattern generator mode", "patternmode"},
-       {SR_HWCAP_RLE, SR_T_CHAR, "Run Length Encoding", "rle"},
+       {SR_HWCAP_RLE, SR_T_BOOL, "Run Length Encoding", "rle"},
        {0, 0, NULL, NULL},
 };
 
@@ -115,7 +115,8 @@ int sr_init_hwplugins(struct sr_device_plugin *plugin)
        g_message("initializing %s plugin", plugin->name);
        num_devices = plugin->init(NULL);
        for (i = 0; i < num_devices; i++) {
-               num_probes = (int)plugin->get_device_info(i, SR_DI_NUM_PROBES);
+               num_probes = GPOINTER_TO_INT(
+                               plugin->get_device_info(i, SR_DI_NUM_PROBES));
                sr_device_new(plugin, i, num_probes);
        }
 
index ee099eccd9ef34457860f4adc99a415182f2d057..9a9614c52263e01fa8ac6c05236a5b0d5555192e 100644 (file)
@@ -144,5 +144,6 @@ char **sr_parse_triggerstring(struct sr_device *device,
                              const char *triggerstring);
 uint64_t sr_parse_sizestring(const char *sizestring);
 uint64_t sr_parse_timestring(const char *timestring);
+gboolean sr_parse_boolstring(const char *boolstring);
 
 #endif
index b3ca41aece36fec81508c22ecba6d1e2b7b925cb..929b5c3f402daf59291dc44a557751497cd61104 100644 (file)
@@ -81,7 +81,7 @@ typedef int (*sr_receive_data_callback) (int fd, int revents, void *user_data);
 enum {
        SR_T_UINT64,
        SR_T_CHAR,
-       SR_T_NULL,
+       SR_T_BOOL,
 };
 
 #if 0
index 9bdf4336e4394cc1ac851b4f3b50cbe6fc4cee31..380d78f59efdbb0bf72009c903484a85d9f87a06 100644 (file)
--- a/strutil.c
+++ b/strutil.c
@@ -267,3 +267,18 @@ uint64_t sr_parse_timestring(const char *timestring)
 
        return time_msec;
 }
+
+gboolean sr_parse_boolstring(const char *boolstr)
+{
+       if (!boolstr)
+               return FALSE;
+
+       if (!g_strcasecmp(boolstr, "true") || 
+           !g_strcasecmp(boolstr, "yes") ||
+           !g_strcasecmp(boolstr, "on") ||
+           !g_strcasecmp(boolstr, "1")) 
+               return TRUE;
+
+       return FALSE;
+}
+