Changed SR_T_NULL to SR_T_BOOL and adjusted RLE option.

This commit is contained in:
Gareth McMullin 2011-11-19 13:41:41 +13:00
parent 6bb5c5fadf
commit 4d436e71ba
5 changed files with 21 additions and 4 deletions

View 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;
}

View 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);
}

View 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

View 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

View File

@ -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;
}