From: Bert Vermeulen Date: Tue, 16 Sep 2014 15:49:20 +0000 (+0200) Subject: Change type of SR_CONF keys to uint32_t. X-Git-Tag: libsigrok-0.4.0~999 X-Git-Url: https://sigrok.org/gitweb/?p=libsigrok.git;a=commitdiff_plain;h=584560f142e1b17b9f4ef9069bd3724f2f77e750 Change type of SR_CONF keys to uint32_t. --- diff --git a/include/libsigrok/libsigrok.h b/include/libsigrok/libsigrok.h index 3ecc460a..c029f117 100644 --- a/include/libsigrok/libsigrok.h +++ b/include/libsigrok/libsigrok.h @@ -486,7 +486,7 @@ struct sr_channel_group { /** Used for setting or getting value of a config item. */ struct sr_config { /** Config key like SR_CONF_CONN, etc. */ - int key; + uint32_t key; /** Key-specific data. */ GVariant *data; }; @@ -494,7 +494,7 @@ struct sr_config { /** Information about a config key. */ struct sr_config_info { /** Config key like SR_CONF_CONN, etc. */ - int key; + uint32_t key; /** Data type like SR_T_STRING, etc. */ int datatype; /** Id string, e.g. "serialcomm". */ @@ -930,12 +930,12 @@ struct sr_dev_driver { /** Query value of a configuration key in driver or given device instance. * @see sr_config_get(). */ - int (*config_get) (int id, GVariant **data, + int (*config_get) (uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg); /** Set value of a configuration key in driver or a given device instance. * @see sr_config_set(). */ - int (*config_set) (int id, GVariant *data, + int (*config_set) (uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg); /** Channel status change. @@ -948,7 +948,7 @@ struct sr_dev_driver { /** List all possible values for a configuration key in a device instance. * @see sr_config_list(). */ - int (*config_list) (int info_id, GVariant **data, + int (*config_list) (uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg); diff --git a/include/libsigrok/proto.h b/include/libsigrok/proto.h index e8aa7ab1..68e7a1ab 100644 --- a/include/libsigrok/proto.h +++ b/include/libsigrok/proto.h @@ -64,16 +64,16 @@ SR_API GSList *sr_driver_scan(struct sr_dev_driver *driver, GSList *options); SR_API int sr_config_get(const struct sr_dev_driver *driver, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg, - int key, GVariant **data); + uint32_t key, GVariant **data); SR_API int sr_config_set(const struct sr_dev_inst *sdi, const struct sr_channel_group *cg, - int key, GVariant *data); + uint32_t key, GVariant *data); SR_API int sr_config_commit(const struct sr_dev_inst *sdi); SR_API int sr_config_list(const struct sr_dev_driver *driver, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg, - int key, GVariant **data); -SR_API const struct sr_config_info *sr_config_info_get(int key); + uint32_t key, GVariant **data); +SR_API const struct sr_config_info *sr_config_info_get(uint32_t key); SR_API const struct sr_config_info *sr_config_info_name_get(const char *optname); /*--- session.c -------------------------------------------------------------*/ diff --git a/src/hardware/agilent-dmm/api.c b/src/hardware/agilent-dmm/api.c index 55f87416..df2d94e8 100644 --- a/src/hardware/agilent-dmm/api.c +++ b/src/hardware/agilent-dmm/api.c @@ -27,12 +27,12 @@ #include "libsigrok-internal.h" #include "agilent-dmm.h" -static const int32_t hwopts[] = { +static const uint32_t hwopts[] = { SR_CONF_CONN, SR_CONF_SERIALCOMM, }; -static const int32_t hwcaps[] = { +static const uint32_t hwcaps[] = { SR_CONF_MULTIMETER, SR_CONF_LIMIT_SAMPLES, SR_CONF_LIMIT_MSEC, @@ -178,7 +178,7 @@ static int cleanup(void) return std_dev_clear(di, NULL); } -static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, +static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -193,7 +193,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, return SR_ERR_BUG; } - switch (id) { + switch (key) { case SR_CONF_LIMIT_MSEC: /* TODO: not yet implemented */ if (g_variant_get_uint64(data) == 0) { @@ -216,7 +216,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, return SR_OK; } -static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { (void)sdi; @@ -224,12 +224,12 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, switch (key) { case SR_CONF_SCAN_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwopts, ARRAY_SIZE(hwopts), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwopts, ARRAY_SIZE(hwopts), sizeof(uint32_t)); break; case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwcaps, ARRAY_SIZE(hwcaps), sizeof(uint32_t)); break; default: return SR_ERR_NA; diff --git a/src/hardware/appa-55ii/api.c b/src/hardware/appa-55ii/api.c index de71e338..f57a3b90 100644 --- a/src/hardware/appa-55ii/api.c +++ b/src/hardware/appa-55ii/api.c @@ -20,12 +20,12 @@ #include #include "protocol.h" -static const int32_t hwopts[] = { +static const uint32_t hwopts[] = { SR_CONF_CONN, SR_CONF_SERIALCOMM, }; -static const int32_t hwcaps[] = { +static const uint32_t hwcaps[] = { SR_CONF_THERMOMETER, SR_CONF_LIMIT_SAMPLES, SR_CONF_LIMIT_MSEC, @@ -137,7 +137,7 @@ static int cleanup(void) return std_dev_clear(di, NULL); } -static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc = sdi->priv; @@ -161,7 +161,7 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, return SR_OK; } -static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, +static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -205,7 +205,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, return SR_OK; } -static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { (void)sdi; @@ -213,12 +213,12 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, switch (key) { case SR_CONF_SCAN_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwopts, ARRAY_SIZE(hwopts), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwopts, ARRAY_SIZE(hwopts), sizeof(uint32_t)); break; case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwcaps, ARRAY_SIZE(hwcaps), sizeof(uint32_t)); break; case SR_CONF_DATA_SOURCE: *data = g_variant_new_strv(data_sources, ARRAY_SIZE(data_sources)); diff --git a/src/hardware/asix-sigma/asix-sigma.c b/src/hardware/asix-sigma/asix-sigma.c index bfd69484..55c6026c 100644 --- a/src/hardware/asix-sigma/asix-sigma.c +++ b/src/hardware/asix-sigma/asix-sigma.c @@ -71,7 +71,7 @@ static const char *channel_names[] = { "9", "10", "11", "12", "13", "14", "15", "16", }; -static const int32_t hwcaps[] = { +static const uint32_t hwcaps[] = { SR_CONF_LOGIC_ANALYZER, SR_CONF_SAMPLERATE, SR_CONF_TRIGGER_MATCH, @@ -813,7 +813,7 @@ static int cleanup(void) return dev_clear(); } -static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, +static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -824,7 +824,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, return SR_ERR; devc = sdi->priv; - switch (id) { + switch (key) { case SR_CONF_SAMPLERATE: *data = g_variant_new_uint64(devc->cur_samplerate); break; @@ -841,7 +841,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, return SR_OK; } -static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, +static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -856,7 +856,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, devc = sdi->priv; ret = SR_OK; - switch (id) { + switch (key) { case SR_CONF_SAMPLERATE: ret = set_samplerate(sdi, g_variant_get_uint64(data)); break; @@ -885,7 +885,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, return ret; } -static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { GVariant *gvar; @@ -896,8 +896,8 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, switch (key) { case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwcaps, ARRAY_SIZE(hwcaps), sizeof(uint32_t)); break; case SR_CONF_SAMPLERATE: g_variant_builder_init(&gvb, G_VARIANT_TYPE("a{sv}")); @@ -907,7 +907,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, *data = g_variant_builder_end(&gvb); break; case SR_CONF_TRIGGER_MATCH: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, trigger_matches, ARRAY_SIZE(trigger_matches), sizeof(int32_t)); break; diff --git a/src/hardware/atten-pps3xxx/api.c b/src/hardware/atten-pps3xxx/api.c index b6eae3cc..0df8bcf0 100644 --- a/src/hardware/atten-pps3xxx/api.c +++ b/src/hardware/atten-pps3xxx/api.c @@ -31,19 +31,19 @@ */ #define SERIALCOMM "9600/8n2" -static const int32_t scanopts[] = { +static const uint32_t scanopts[] = { SR_CONF_CONN, SR_CONF_SERIALCOMM, }; -static const int32_t devopts[] = { +static const uint32_t devopts[] = { SR_CONF_POWER_SUPPLY, SR_CONF_CONTINUOUS, SR_CONF_OUTPUT_CHANNEL_CONFIG, SR_CONF_OVER_CURRENT_PROTECTION_ENABLED, }; -static const int32_t devopts_cg[] = { +static const uint32_t devopts_cg[] = { SR_CONF_OUTPUT_VOLTAGE, SR_CONF_OUTPUT_VOLTAGE_MAX, SR_CONF_OUTPUT_CURRENT, @@ -205,7 +205,7 @@ static int cleanup(void) return std_dev_clear(di, NULL); } -static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -274,7 +274,7 @@ static int find_str(const char *str, const char **strings, int array_size) return idx; } -static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, +static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -358,7 +358,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, return ret; } -static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -369,8 +369,8 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, /* Always available, even without sdi. */ if (key == SR_CONF_SCAN_OPTIONS) { - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - scanopts, ARRAY_SIZE(scanopts), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + scanopts, ARRAY_SIZE(scanopts), sizeof(uint32_t)); return SR_OK; } @@ -383,8 +383,8 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, /* No channel group: global options. */ switch (key) { case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - devopts, ARRAY_SIZE(devopts), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + devopts, ARRAY_SIZE(devopts), sizeof(uint32_t)); break; case SR_CONF_OUTPUT_CHANNEL_CONFIG: if (devc->model->channel_modes == CHANMODE_INDEPENDENT) { @@ -408,8 +408,8 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, switch (key) { case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - devopts_cg, ARRAY_SIZE(devopts_cg), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + devopts_cg, ARRAY_SIZE(devopts_cg), sizeof(uint32_t)); break; case SR_CONF_OUTPUT_VOLTAGE_MAX: g_variant_builder_init(&gvb, G_VARIANT_TYPE_ARRAY); diff --git a/src/hardware/beaglelogic/api.c b/src/hardware/beaglelogic/api.c index c86925be..b5850314 100644 --- a/src/hardware/beaglelogic/api.c +++ b/src/hardware/beaglelogic/api.c @@ -24,7 +24,7 @@ SR_PRIV struct sr_dev_driver beaglelogic_driver_info; static struct sr_dev_driver *di = &beaglelogic_driver_info; /* Hardware capabiities */ -static const int32_t hwcaps[] = { +static const uint32_t hwcaps[] = { SR_CONF_LOGIC_ANALYZER, SR_CONF_SAMPLERATE, SR_CONF_TRIGGER_MATCH, @@ -223,7 +223,7 @@ static int cleanup(void) return SR_OK; } -static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc = sdi->priv; @@ -249,7 +249,7 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, return SR_OK; } -static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, +static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc = sdi->priv; @@ -289,7 +289,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, return SR_OK; } -static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { int ret; @@ -303,8 +303,8 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, ret = SR_OK; switch (key) { case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwcaps, ARRAY_SIZE(hwcaps), sizeof(uint32_t)); break; case SR_CONF_SAMPLERATE: g_variant_builder_init(&gvb, G_VARIANT_TYPE("a{sv}")); @@ -314,7 +314,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, *data = g_variant_builder_end(&gvb); break; case SR_CONF_TRIGGER_MATCH: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, soft_trigger_matches, ARRAY_SIZE(soft_trigger_matches), sizeof(int32_t)); break; diff --git a/src/hardware/brymen-bm86x/api.c b/src/hardware/brymen-bm86x/api.c index be21583b..f47c01ed 100644 --- a/src/hardware/brymen-bm86x/api.c +++ b/src/hardware/brymen-bm86x/api.c @@ -21,11 +21,11 @@ #define BRYMEN_BC86X "0820.0001" -static const int32_t hwopts[] = { +static const uint32_t hwopts[] = { SR_CONF_CONN, }; -static const int32_t hwcaps[] = { +static const uint32_t hwcaps[] = { SR_CONF_MULTIMETER, SR_CONF_LIMIT_SAMPLES, SR_CONF_LIMIT_MSEC, @@ -182,7 +182,7 @@ static int cleanup(void) return std_dev_clear(di, NULL); } -static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc = sdi->priv; @@ -203,7 +203,7 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, return SR_OK; } -static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, +static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -234,7 +234,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, return SR_OK; } -static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { (void)sdi; @@ -242,12 +242,12 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, switch (key) { case SR_CONF_SCAN_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwopts, ARRAY_SIZE(hwopts), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwopts, ARRAY_SIZE(hwopts), sizeof(uint32_t)); break; case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwcaps, ARRAY_SIZE(hwcaps), sizeof(uint32_t)); break; default: return SR_ERR_NA; diff --git a/src/hardware/brymen-dmm/api.c b/src/hardware/brymen-dmm/api.c index 1ccd18af..f0ba3923 100644 --- a/src/hardware/brymen-dmm/api.c +++ b/src/hardware/brymen-dmm/api.c @@ -19,12 +19,12 @@ #include "protocol.h" -static const int32_t hwopts[] = { +static const uint32_t hwopts[] = { SR_CONF_CONN, SR_CONF_SERIALCOMM, }; -static const int32_t hwcaps[] = { +static const uint32_t hwcaps[] = { SR_CONF_MULTIMETER, SR_CONF_LIMIT_SAMPLES, SR_CONF_CONTINUOUS, @@ -149,7 +149,7 @@ static int cleanup(void) return std_dev_clear(di, NULL); } -static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, +static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -166,7 +166,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, } ret = SR_OK; - switch (id) { + switch (key) { case SR_CONF_LIMIT_SAMPLES: devc->limit_samples = g_variant_get_uint64(data); break; @@ -180,7 +180,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, return ret; } -static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { (void)sdi; @@ -188,12 +188,12 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, switch (key) { case SR_CONF_SCAN_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwopts, ARRAY_SIZE(hwopts), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwopts, ARRAY_SIZE(hwopts), sizeof(uint32_t)); break; case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwcaps, ARRAY_SIZE(hwcaps), sizeof(uint32_t)); break; default: return SR_ERR_NA; diff --git a/src/hardware/cem-dt-885x/api.c b/src/hardware/cem-dt-885x/api.c index 9aed5473..943377a3 100644 --- a/src/hardware/cem-dt-885x/api.c +++ b/src/hardware/cem-dt-885x/api.c @@ -24,11 +24,11 @@ /* 23ms is the longest interval between tokens. */ #define MAX_SCAN_TIME 25 * 1000 -static const int32_t hwopts[] = { +static const uint32_t hwopts[] = { SR_CONF_CONN, }; -static const int32_t hwcaps[] = { +static const uint32_t hwcaps[] = { SR_CONF_SOUNDLEVELMETER, SR_CONF_LIMIT_SAMPLES, SR_CONF_CONTINUOUS, @@ -165,7 +165,7 @@ static int cleanup(void) return std_dev_clear(di, NULL); } -static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -237,7 +237,7 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, return ret; } -static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, +static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -327,7 +327,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, return ret; } -static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { GVariant *tuple, *range[2]; @@ -341,12 +341,12 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, ret = SR_OK; switch (key) { case SR_CONF_SCAN_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwopts, ARRAY_SIZE(hwopts), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwopts, ARRAY_SIZE(hwopts), sizeof(uint32_t)); break; case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwcaps, ARRAY_SIZE(hwcaps), sizeof(uint32_t)); break; case SR_CONF_SPL_WEIGHT_FREQ: *data = g_variant_new_strv(weight_freq, ARRAY_SIZE(weight_freq)); diff --git a/src/hardware/center-3xx/api.c b/src/hardware/center-3xx/api.c index 0f80cf83..edaecd7b 100644 --- a/src/hardware/center-3xx/api.c +++ b/src/hardware/center-3xx/api.c @@ -20,12 +20,12 @@ #include "protocol.h" -static const int32_t hwopts[] = { +static const uint32_t hwopts[] = { SR_CONF_CONN, SR_CONF_SERIALCOMM, }; -static const int32_t hwcaps[] = { +static const uint32_t hwcaps[] = { SR_CONF_THERMOMETER, SR_CONF_LIMIT_SAMPLES, SR_CONF_LIMIT_MSEC, @@ -158,7 +158,7 @@ static int cleanup(int idx) return dev_clear(idx); } -static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, +static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -170,7 +170,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, devc = sdi->priv; - switch (id) { + switch (key) { case SR_CONF_LIMIT_SAMPLES: if (g_variant_get_uint64(data) == 0) return SR_ERR_ARG; @@ -188,7 +188,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, return SR_OK; } -static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { (void)sdi; @@ -196,12 +196,12 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, switch (key) { case SR_CONF_SCAN_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwopts, ARRAY_SIZE(hwopts), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwopts, ARRAY_SIZE(hwopts), sizeof(uint32_t)); break; case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwcaps, ARRAY_SIZE(hwcaps), sizeof(uint32_t)); break; default: return SR_ERR_NA; diff --git a/src/hardware/chronovu-la/api.c b/src/hardware/chronovu-la/api.c index 5a8a3d36..f4b19894 100644 --- a/src/hardware/chronovu-la/api.c +++ b/src/hardware/chronovu-la/api.c @@ -23,7 +23,7 @@ SR_PRIV struct sr_dev_driver chronovu_la_driver_info; static struct sr_dev_driver *di = &chronovu_la_driver_info; -static const int32_t hwcaps[] = { +static const uint32_t hwcaps[] = { SR_CONF_LOGIC_ANALYZER, SR_CONF_SAMPLERATE, SR_CONF_TRIGGER_MATCH, @@ -285,14 +285,14 @@ static int cleanup(void) return dev_clear(); } -static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, +static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; (void)cg; - switch (id) { + switch (key) { case SR_CONF_SAMPLERATE: if (!sdi || !(devc = sdi->priv)) return SR_ERR_BUG; @@ -305,7 +305,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, return SR_OK; } -static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, +static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -318,7 +318,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, if (!(devc = sdi->priv)) return SR_ERR_BUG; - switch (id) { + switch (key) { case SR_CONF_SAMPLERATE: if (cv_set_samplerate(sdi, g_variant_get_uint64(data)) < 0) return SR_ERR; @@ -340,7 +340,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, return SR_OK; } -static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { GVariant *gvar, *grange[2]; @@ -351,8 +351,8 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, switch (key) { case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwcaps, ARRAY_SIZE(hwcaps), sizeof(uint32_t)); break; case SR_CONF_SAMPLERATE: if (!sdi || !sdi->priv || !(devc = sdi->priv)) @@ -379,7 +379,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, case SR_CONF_TRIGGER_MATCH: if (!sdi || !sdi->priv || !(devc = sdi->priv) || !devc->prof) return SR_ERR_BUG; - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, trigger_matches, devc->prof->num_trigger_matches, sizeof(int32_t)); break; diff --git a/src/hardware/colead-slm/api.c b/src/hardware/colead-slm/api.c index d5fc9ac1..8e48552d 100644 --- a/src/hardware/colead-slm/api.c +++ b/src/hardware/colead-slm/api.c @@ -30,12 +30,12 @@ /* The Colead SL-5868P uses this. */ #define SERIALCOMM "2400/8n1" -static const int32_t hwopts[] = { +static const uint32_t hwopts[] = { SR_CONF_CONN, SR_CONF_SERIALCOMM, }; -static const int32_t hwcaps[] = { +static const uint32_t hwcaps[] = { SR_CONF_SOUNDLEVELMETER, SR_CONF_LIMIT_SAMPLES, SR_CONF_LIMIT_MSEC, @@ -129,7 +129,7 @@ static int cleanup(void) return std_dev_clear(di, NULL); } -static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, +static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -144,7 +144,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, return SR_ERR_BUG; } - switch (id) { + switch (key) { case SR_CONF_LIMIT_MSEC: /* TODO: not yet implemented */ if (g_variant_get_uint64(data) == 0) { @@ -167,7 +167,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, return SR_OK; } -static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { (void)sdi; @@ -175,12 +175,12 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, switch (key) { case SR_CONF_SCAN_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwopts, ARRAY_SIZE(hwopts), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwopts, ARRAY_SIZE(hwopts), sizeof(uint32_t)); break; case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwcaps, ARRAY_SIZE(hwcaps), sizeof(uint32_t)); break; default: return SR_ERR_NA; diff --git a/src/hardware/conrad-digi-35-cpu/api.c b/src/hardware/conrad-digi-35-cpu/api.c index 6a1f31c9..a2a88159 100644 --- a/src/hardware/conrad-digi-35-cpu/api.c +++ b/src/hardware/conrad-digi-35-cpu/api.c @@ -26,12 +26,12 @@ #define SERIALCOMM "9600/8n1" -static const int32_t hwopts[] = { +static const uint32_t hwopts[] = { SR_CONF_CONN, SR_CONF_SERIALCOMM, }; -static const int32_t hwcaps[] = { +static const uint32_t hwcaps[] = { SR_CONF_POWER_SUPPLY, SR_CONF_OUTPUT_VOLTAGE, SR_CONF_OUTPUT_CURRENT, @@ -121,7 +121,7 @@ static int cleanup(void) return std_dev_clear(di, NULL); } -static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, +static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { int ret; @@ -164,7 +164,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, return ret; } -static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { int ret; @@ -175,12 +175,12 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, ret = SR_OK; switch (key) { case SR_CONF_SCAN_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwopts, ARRAY_SIZE(hwopts), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwopts, ARRAY_SIZE(hwopts), sizeof(uint32_t)); break; case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwcaps, ARRAY_SIZE(hwcaps), sizeof(uint32_t)); break; default: return SR_ERR_NA; diff --git a/src/hardware/demo/demo.c b/src/hardware/demo/demo.c index 7fc959f4..d2fddde4 100644 --- a/src/hardware/demo/demo.c +++ b/src/hardware/demo/demo.c @@ -128,7 +128,7 @@ struct dev_context { GHashTable *ch_ag; }; -static const int32_t scanopts[] = { +static const uint32_t scanopts[] = { SR_CONF_NUM_LOGIC_CHANNELS, SR_CONF_NUM_ANALOG_CHANNELS, }; @@ -398,7 +398,7 @@ static int cleanup(void) return std_dev_clear(di, clear_helper); } -static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, +static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -410,7 +410,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, return SR_ERR_ARG; devc = sdi->priv; - switch (id) { + switch (key) { case SR_CONF_SAMPLERATE: *data = g_variant_new_uint64(devc->cur_samplerate); break; @@ -458,7 +458,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, return SR_OK; } -static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, +static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -475,7 +475,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, return SR_ERR_DEV_CLOSED; ret = SR_OK; - switch (id) { + switch (key) { case SR_CONF_SAMPLERATE: devc->cur_samplerate = g_variant_get_uint64(data); sr_dbg("Setting samplerate to %" PRIu64, devc->cur_samplerate); @@ -552,7 +552,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, return ret; } -static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct sr_channel *ch; @@ -562,8 +562,8 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, (void)sdi; if (key == SR_CONF_SCAN_OPTIONS) { - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - scanopts, ARRAY_SIZE(scanopts), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + scanopts, ARRAY_SIZE(scanopts), sizeof(uint32_t)); return SR_OK; } @@ -573,8 +573,8 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, if (!cg) { switch (key) { case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - devopts, ARRAY_SIZE(devopts), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + devopts, ARRAY_SIZE(devopts), sizeof(uint32_t)); break; case SR_CONF_SAMPLERATE: g_variant_builder_init(&gvb, G_VARIANT_TYPE("a{sv}")); @@ -594,11 +594,11 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, if (ch->type == SR_CHANNEL_LOGIC) *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, devopts_cg_logic, ARRAY_SIZE(devopts_cg_logic), - sizeof(int32_t)); + sizeof(uint32_t)); else if (ch->type == SR_CHANNEL_ANALOG) *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, devopts_cg_analog, ARRAY_SIZE(devopts_cg_analog), - sizeof(int32_t)); + sizeof(uint32_t)); else return SR_ERR_BUG; break; diff --git a/src/hardware/fluke-dmm/api.c b/src/hardware/fluke-dmm/api.c index 3d739a18..50576557 100644 --- a/src/hardware/fluke-dmm/api.c +++ b/src/hardware/fluke-dmm/api.c @@ -27,12 +27,12 @@ #include "libsigrok-internal.h" #include "fluke-dmm.h" -static const int32_t hwopts[] = { +static const uint32_t hwopts[] = { SR_CONF_CONN, SR_CONF_SERIALCOMM, }; -static const int32_t hwcaps[] = { +static const uint32_t hwcaps[] = { SR_CONF_MULTIMETER, SR_CONF_LIMIT_SAMPLES, SR_CONF_LIMIT_MSEC, @@ -203,7 +203,7 @@ static int cleanup(void) return std_dev_clear(di, NULL); } -static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, +static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -218,7 +218,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, return SR_ERR_BUG; } - switch (id) { + switch (key) { case SR_CONF_LIMIT_MSEC: /* TODO: not yet implemented */ if (g_variant_get_uint64(data) == 0) { @@ -241,7 +241,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, return SR_OK; } -static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { (void)sdi; @@ -249,12 +249,12 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, switch (key) { case SR_CONF_SCAN_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwopts, ARRAY_SIZE(hwopts), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwopts, ARRAY_SIZE(hwopts), sizeof(uint32_t)); break; case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwcaps, ARRAY_SIZE(hwcaps), sizeof(uint32_t)); break; default: return SR_ERR_NA; diff --git a/src/hardware/fx2lafw/api.c b/src/hardware/fx2lafw/api.c index d4643ff7..a233cbc8 100644 --- a/src/hardware/fx2lafw/api.c +++ b/src/hardware/fx2lafw/api.c @@ -73,11 +73,11 @@ static const struct fx2lafw_profile supported_fx2[] = { { 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -static const int32_t hwopts[] = { +static const uint32_t hwopts[] = { SR_CONF_CONN, }; -static const int32_t hwcaps[] = { +static const uint32_t hwcaps[] = { SR_CONF_LOGIC_ANALYZER, SR_CONF_TRIGGER_MATCH, SR_CONF_SAMPLERATE, @@ -385,7 +385,7 @@ static int cleanup(void) return ret; } -static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, +static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -399,7 +399,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, devc = sdi->priv; - switch (id) { + switch (key) { case SR_CONF_CONN: if (!sdi->conn) return SR_ERR_ARG; @@ -424,7 +424,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, return SR_OK; } -static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, +static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -444,8 +444,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, ret = SR_OK; - switch (id) - { + switch (key) { case SR_CONF_SAMPLERATE: arg = g_variant_get_uint64(data); for (i = 0; i < ARRAY_SIZE(samplerates); i++) { @@ -467,7 +466,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, return ret; } -static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { GVariant *gvar; @@ -478,12 +477,12 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, switch (key) { case SR_CONF_SCAN_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwopts, ARRAY_SIZE(hwopts), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwopts, ARRAY_SIZE(hwopts), sizeof(uint32_t)); break; case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwcaps, ARRAY_SIZE(hwcaps), sizeof(uint32_t)); break; case SR_CONF_SAMPLERATE: g_variant_builder_init(&gvb, G_VARIANT_TYPE("a{sv}")); diff --git a/src/hardware/gmc-mh-1x-2x/api.c b/src/hardware/gmc-mh-1x-2x/api.c index 96621bbf..f2d06c26 100644 --- a/src/hardware/gmc-mh-1x-2x/api.c +++ b/src/hardware/gmc-mh-1x-2x/api.c @@ -34,13 +34,13 @@ SR_PRIV struct sr_dev_driver gmc_mh_1x_2x_rs232_driver_info; SR_PRIV struct sr_dev_driver gmc_mh_2x_bd232_driver_info; -static const int32_t hwopts[] = { +static const uint32_t hwopts[] = { SR_CONF_CONN, SR_CONF_SERIALCOMM, }; /** Hardware capabilities for Metrahit 1x/2x devices in send mode. */ -static const int32_t hwcaps_sm[] = { +static const uint32_t hwcaps_sm[] = { SR_CONF_MULTIMETER, SR_CONF_THERMOMETER, /**< All GMC 1x/2x multimeters seem to support this */ SR_CONF_LIMIT_SAMPLES, @@ -49,7 +49,7 @@ static const int32_t hwcaps_sm[] = { }; /** Hardware capabilities for Metrahit 2x devices in bidirectional Mode. */ -static const int32_t hwcaps_bd[] = { +static const uint32_t hwcaps_bd[] = { SR_CONF_MULTIMETER, SR_CONF_THERMOMETER, /**< All GMC 1x/2x multimeters seem to support this */ SR_CONF_LIMIT_SAMPLES, @@ -422,8 +422,8 @@ static int cleanup_2x_bd232(void) } /** Get value of configuration item */ -static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *cg) +static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, + const struct sr_channel_group *cg) { int ret; struct dev_context *devc; @@ -454,16 +454,16 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, } /** Implementation of config_list, auxiliary function for common parts, */ -static int config_list_common(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *cg) +static int config_list_common(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, + const struct sr_channel_group *cg) { (void)sdi; (void)cg; switch (key) { case SR_CONF_SCAN_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwopts, ARRAY_SIZE(hwopts), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwopts, ARRAY_SIZE(hwopts), sizeof(uint32_t)); break; default: return SR_ERR_NA; @@ -473,13 +473,13 @@ static int config_list_common(int key, GVariant **data, const struct sr_dev_inst } /** Implementation of config_list for Metrahit 1x/2x send mode */ -static int config_list_sm(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_list_sm(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { switch (key) { case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwcaps_sm, ARRAY_SIZE(hwcaps_sm), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwcaps_sm, ARRAY_SIZE(hwcaps_sm), sizeof(uint32_t)); break; default: return config_list_common(key, data, sdi, cg); @@ -489,13 +489,13 @@ static int config_list_sm(int key, GVariant **data, const struct sr_dev_inst *sd } /** Implementation of config_list for Metrahit 2x bidirectional mode */ -static int config_list_bd(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_list_bd(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { switch (key) { case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwcaps_bd, ARRAY_SIZE(hwcaps_bd), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwcaps_bd, ARRAY_SIZE(hwcaps_bd), sizeof(uint32_t)); break; default: return config_list_common(key, data, sdi, cg); diff --git a/src/hardware/gmc-mh-1x-2x/protocol.c b/src/hardware/gmc-mh-1x-2x/protocol.c index bcdc93fc..06cae38b 100644 --- a/src/hardware/gmc-mh-1x-2x/protocol.c +++ b/src/hardware/gmc-mh-1x-2x/protocol.c @@ -1500,8 +1500,8 @@ SR_PRIV const char *gmc_model_str(enum model mcode) /** @copydoc sr_dev_driver.config_set */ -SR_PRIV int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *cg) +SR_PRIV int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, + const struct sr_channel_group *cg) { struct dev_context *devc; uint8_t params[9]; diff --git a/src/hardware/gmc-mh-1x-2x/protocol.h b/src/hardware/gmc-mh-1x-2x/protocol.h index 6f751224..3d0eab42 100644 --- a/src/hardware/gmc-mh-1x-2x/protocol.h +++ b/src/hardware/gmc-mh-1x-2x/protocol.h @@ -120,7 +120,7 @@ struct dev_context { }; /* Forward declarations */ -SR_PRIV int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, +SR_PRIV int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg); SR_PRIV void create_cmd_14(guchar addr, guchar func, guchar* params, guchar* buf); SR_PRIV void dump_msg14(guchar* buf, gboolean raw); diff --git a/src/hardware/hameg-hmo/api.c b/src/hardware/hameg-hmo/api.c index 8db1e76a..4950d89f 100644 --- a/src/hardware/hameg-hmo/api.c +++ b/src/hardware/hameg-hmo/api.c @@ -29,7 +29,7 @@ static const char *manufacturers[] = { "HAMEG", }; -static const int32_t scanopts[] = { +static const uint32_t scanopts[] = { SR_CONF_CONN, SR_CONF_SERIALCOMM, }; @@ -196,7 +196,7 @@ static int check_channel_group(struct dev_context *devc, return CG_INVALID; } -static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { int ret, cg_type; @@ -320,7 +320,7 @@ static GVariant *build_tuples(const uint64_t (*array)[][2], unsigned int n) return g_variant_builder_end(&gvb); } -static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, +static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { int ret, cg_type; @@ -492,7 +492,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, return ret; } -static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { int cg_type; @@ -509,21 +509,21 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, switch (key) { case SR_CONF_SCAN_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - scanopts, ARRAY_SIZE(scanopts), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + scanopts, ARRAY_SIZE(scanopts), sizeof(uint32_t)); break; case SR_CONF_DEVICE_OPTIONS: if (cg_type == CG_NONE) { - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, model->hw_caps, model->num_hwcaps, - sizeof(int32_t)); + sizeof(uint32_t)); } else if (cg_type == CG_ANALOG) { - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, model->analog_hwcaps, model->num_analog_hwcaps, - sizeof(int32_t)); + sizeof(uint32_t)); } else { - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - NULL, 0, sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + NULL, 0, sizeof(uint32_t)); } break; case SR_CONF_COUPLING: diff --git a/src/hardware/hameg-hmo/protocol.c b/src/hardware/hameg-hmo/protocol.c index 1a788407..a1cee6aa 100644 --- a/src/hardware/hameg-hmo/protocol.c +++ b/src/hardware/hameg-hmo/protocol.c @@ -45,7 +45,7 @@ static const char *hameg_scpi_dialect[] = { [SCPI_CMD_SET_ANALOG_CHAN_STATE] = ":CHAN%d:STAT %d", }; -static const int32_t hmo_hwcaps[] = { +static const uint32_t hmo_hwcaps[] = { SR_CONF_OSCILLOSCOPE, SR_CONF_TRIGGER_SOURCE, SR_CONF_TIMEBASE, @@ -56,7 +56,7 @@ static const int32_t hmo_hwcaps[] = { SR_CONF_LIMIT_FRAMES, }; -static const int32_t hmo_analog_caps[] = { +static const uint32_t hmo_analog_caps[] = { SR_CONF_NUM_VDIV, SR_CONF_COUPLING, SR_CONF_VDIV, diff --git a/src/hardware/hameg-hmo/protocol.h b/src/hardware/hameg-hmo/protocol.h index 932e3ec3..1df319e3 100644 --- a/src/hardware/hameg-hmo/protocol.h +++ b/src/hardware/hameg-hmo/protocol.h @@ -40,10 +40,10 @@ struct scope_config { const char *(*analog_names)[]; const char *(*digital_names)[]; - const int32_t (*hw_caps)[]; + const uint32_t (*hw_caps)[]; const uint8_t num_hwcaps; - const int32_t (*analog_hwcaps)[]; + const uint32_t (*analog_hwcaps)[]; const uint8_t num_analog_hwcaps; const char *(*coupling_options)[]; diff --git a/src/hardware/hantek-dso/api.c b/src/hardware/hantek-dso/api.c index c948e421..abc3c08e 100644 --- a/src/hardware/hantek-dso/api.c +++ b/src/hardware/hantek-dso/api.c @@ -40,11 +40,11 @@ #define NUM_TIMEBASE 10 #define NUM_VDIV 8 -static const int32_t scanopts[] = { +static const uint32_t scanopts[] = { SR_CONF_CONN, }; -static const int32_t devopts[] = { +static const uint32_t devopts[] = { SR_CONF_OSCILLOSCOPE, SR_CONF_LIMIT_FRAMES, SR_CONF_CONTINUOUS, @@ -422,7 +422,7 @@ static int cleanup(void) return dev_clear(); } -static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, +static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct sr_usb_dev_inst *usb; @@ -430,7 +430,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, (void)cg; - switch (id) { + switch (key) { case SR_CONF_CONN: if (!sdi || !sdi->conn) return SR_ERR_ARG; @@ -455,7 +455,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, return SR_OK; } -static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, +static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -473,7 +473,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, ret = SR_OK; devc = sdi->priv; - switch (id) { + switch (key) { case SR_CONF_LIMIT_FRAMES: devc->limit_frames = g_variant_get_uint64(data); break; @@ -586,7 +586,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, return ret; } -static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -598,12 +598,12 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, switch (key) { case SR_CONF_SCAN_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - scanopts, ARRAY_SIZE(scanopts), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + scanopts, ARRAY_SIZE(scanopts), sizeof(uint32_t)); break; case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - devopts, ARRAY_SIZE(devopts), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + devopts, ARRAY_SIZE(devopts), sizeof(uint32_t)); break; case SR_CONF_BUFFERSIZE: if (!sdi) diff --git a/src/hardware/ikalogic-scanalogic2/api.c b/src/hardware/ikalogic-scanalogic2/api.c index b4c697f9..25cebb5f 100644 --- a/src/hardware/ikalogic-scanalogic2/api.c +++ b/src/hardware/ikalogic-scanalogic2/api.c @@ -19,7 +19,7 @@ #include "protocol.h" -static const int hwcaps[] = { +static const uint32_t hwcaps[] = { SR_CONF_LOGIC_ANALYZER, SR_CONF_SAMPLERATE, SR_CONF_LIMIT_SAMPLES, @@ -313,7 +313,7 @@ static int cleanup(void) return dev_clear(); } -static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -338,7 +338,7 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, return ret; } -static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, +static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { uint64_t samplerate, limit_samples, capture_ratio; @@ -371,7 +371,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, return ret; } -static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { GVariant *gvar, *grange[2]; @@ -385,8 +385,8 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, switch (key) { case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, hwcaps, - ARRAY_SIZE(hwcaps), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwcaps, ARRAY_SIZE(hwcaps), sizeof(uint32_t)); break; case SR_CONF_SAMPLERATE: g_variant_builder_init(&gvb, G_VARIANT_TYPE("a{sv}")); diff --git a/src/hardware/ikalogic-scanaplus/api.c b/src/hardware/ikalogic-scanaplus/api.c index ce00478e..e4ebb267 100644 --- a/src/hardware/ikalogic-scanaplus/api.c +++ b/src/hardware/ikalogic-scanaplus/api.c @@ -28,7 +28,7 @@ #define SAMPLE_BUF_SIZE (8 * 1024 * 1024) -static const int32_t hwcaps[] = { +static const uint32_t hwcaps[] = { SR_CONF_LOGIC_ANALYZER, SR_CONF_SAMPLERATE, SR_CONF_LIMIT_MSEC, @@ -280,13 +280,13 @@ static int cleanup(void) return dev_clear(); } -static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, +static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { (void)sdi; (void)cg; - switch (id) { + switch (key) { case SR_CONF_SAMPLERATE: /* The ScanaPLUS samplerate is 100MHz and can't be changed. */ *data = g_variant_new_uint64(SR_MHZ(100)); @@ -298,7 +298,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, return SR_OK; } -static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, +static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -310,7 +310,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, devc = sdi->priv; - switch (id) { + switch (key) { case SR_CONF_SAMPLERATE: if (g_variant_get_uint64(data) != SR_MHZ(100)) { sr_err("ScanaPLUS only supports samplerate = 100MHz."); @@ -335,7 +335,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, return SR_OK; } -static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { GVariant *gvar; @@ -346,8 +346,8 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, switch (key) { case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwcaps, ARRAY_SIZE(hwcaps), sizeof(uint32_t)); break; case SR_CONF_SAMPLERATE: g_variant_builder_init(&gvb, G_VARIANT_TYPE("a{sv}")); diff --git a/src/hardware/kecheng-kc-330b/api.c b/src/hardware/kecheng-kc-330b/api.c index 71bdc012..293d3c85 100644 --- a/src/hardware/kecheng-kc-330b/api.c +++ b/src/hardware/kecheng-kc-330b/api.c @@ -24,7 +24,7 @@ #define VENDOR "Kecheng" #define USB_INTERFACE 0 -static const int32_t hwcaps[] = { +static const uint32_t hwcaps[] = { SR_CONF_SOUNDLEVELMETER, SR_CONF_LIMIT_SAMPLES, SR_CONF_CONTINUOUS, @@ -248,7 +248,7 @@ static int cleanup(void) return ret; } -static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -297,7 +297,7 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, return SR_OK; } -static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, +static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -377,7 +377,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, return ret; } -static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { GVariant *tuple, *rational[2]; @@ -389,8 +389,8 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, switch (key) { case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwcaps, ARRAY_SIZE(hwcaps), sizeof(uint32_t)); break; case SR_CONF_SAMPLE_INTERVAL: g_variant_builder_init(&gvb, G_VARIANT_TYPE_ARRAY); diff --git a/src/hardware/lascar-el-usb/api.c b/src/hardware/lascar-el-usb/api.c index 04f844b3..0ffe3f48 100644 --- a/src/hardware/lascar-el-usb/api.c +++ b/src/hardware/lascar-el-usb/api.c @@ -26,11 +26,11 @@ SR_PRIV struct sr_dev_driver lascar_el_usb_driver_info; static struct sr_dev_driver *di = &lascar_el_usb_driver_info; -static const int32_t hwopts[] = { +static const uint32_t hwopts[] = { SR_CONF_CONN, }; -static const int32_t hwcaps[] = { +static const uint32_t hwcaps[] = { SR_CONF_THERMOMETER, SR_CONF_HYGROMETER, SR_CONF_DATALOG, @@ -158,7 +158,7 @@ static int cleanup(void) return ret; } -static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, +static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -169,7 +169,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, (void)cg; devc = sdi->priv; - switch (id) { + switch (key) { case SR_CONF_CONN: if (!sdi || !sdi->conn) return SR_ERR_ARG; @@ -194,7 +194,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, return SR_OK; } -static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, +static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -212,7 +212,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, devc = sdi->priv; ret = SR_OK; - switch (id) { + switch (key) { case SR_CONF_DATALOG: if (g_variant_get_boolean(data)) { /* Start logging. */ @@ -234,7 +234,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, return ret; } -static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { (void)sdi; @@ -242,12 +242,12 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, switch (key) { case SR_CONF_SCAN_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwopts, ARRAY_SIZE(hwopts), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwopts, ARRAY_SIZE(hwopts), sizeof(uint32_t)); break; case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwcaps, ARRAY_SIZE(hwcaps), sizeof(uint32_t)); break; default: return SR_ERR_NA; diff --git a/src/hardware/link-mso19/api.c b/src/hardware/link-mso19/api.c index 13c29720..829530e0 100644 --- a/src/hardware/link-mso19/api.c +++ b/src/hardware/link-mso19/api.c @@ -21,7 +21,7 @@ #include "protocol.h" -static const int32_t hwcaps[] = { +static const uint32_t hwcaps[] = { SR_CONF_OSCILLOSCOPE, SR_CONF_LOGIC_ANALYZER, SR_CONF_SAMPLERATE, @@ -380,8 +380,8 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, switch (key) { case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwcaps, ARRAY_SIZE(hwcaps), sizeof(uint32_t)); break; case SR_CONF_SAMPLERATE: g_variant_builder_init(&gvb, G_VARIANT_TYPE("a{sv}")); diff --git a/src/hardware/manson-hcs-3xxx/api.c b/src/hardware/manson-hcs-3xxx/api.c index faa093f1..7218d9b5 100644 --- a/src/hardware/manson-hcs-3xxx/api.c +++ b/src/hardware/manson-hcs-3xxx/api.c @@ -26,12 +26,12 @@ #include "protocol.h" -static const int32_t hwopts[] = { +static const uint32_t hwopts[] = { SR_CONF_CONN, SR_CONF_SERIALCOMM, }; -static const int32_t devopts[] = { +static const uint32_t devopts[] = { /* Device class */ SR_CONF_POWER_SUPPLY, /* Aquisition modes. */ @@ -216,7 +216,7 @@ static int cleanup(void) return dev_clear(); } -static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -257,7 +257,7 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, return SR_OK; } -static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, +static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -320,7 +320,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, return SR_OK; } -static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -337,12 +337,12 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, switch (key) { case SR_CONF_SCAN_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwopts, ARRAY_SIZE(hwopts), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwopts, ARRAY_SIZE(hwopts), sizeof(uint32_t)); break; case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - devopts, ARRAY_SIZE(devopts), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + devopts, ARRAY_SIZE(devopts), sizeof(uint32_t)); break; case SR_CONF_OUTPUT_CURRENT_MAX: g_variant_builder_init(&gvb, G_VARIANT_TYPE_ARRAY); diff --git a/src/hardware/mic-985xx/api.c b/src/hardware/mic-985xx/api.c index 39173145..0a1e2582 100644 --- a/src/hardware/mic-985xx/api.c +++ b/src/hardware/mic-985xx/api.c @@ -20,12 +20,12 @@ #include "protocol.h" -static const int32_t hwopts[] = { +static const uint32_t hwopts[] = { SR_CONF_CONN, SR_CONF_SERIALCOMM, }; -static const int32_t hwcaps[] = { +static const uint32_t hwcaps[] = { SR_CONF_THERMOMETER, SR_CONF_HYGROMETER, SR_CONF_LIMIT_SAMPLES, @@ -160,7 +160,7 @@ static int cleanup(int idx) return dev_clear(idx); } -static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, +static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -172,7 +172,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, devc = sdi->priv; - switch (id) { + switch (key) { case SR_CONF_LIMIT_SAMPLES: devc->limit_samples = g_variant_get_uint64(data); sr_dbg("Setting sample limit to %" PRIu64 ".", @@ -190,7 +190,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, return SR_OK; } -static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { (void)sdi; @@ -198,12 +198,12 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, switch (key) { case SR_CONF_SCAN_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwopts, ARRAY_SIZE(hwopts), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwopts, ARRAY_SIZE(hwopts), sizeof(uint32_t)); break; case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwcaps, ARRAY_SIZE(hwcaps), sizeof(uint32_t)); break; default: return SR_ERR_NA; diff --git a/src/hardware/motech-lps-30x/api.c b/src/hardware/motech-lps-30x/api.c index ae08317a..a52b2f28 100644 --- a/src/hardware/motech-lps-30x/api.c +++ b/src/hardware/motech-lps-30x/api.c @@ -44,13 +44,13 @@ SR_PRIV int lps_query_status(struct sr_dev_inst* sdi); #define VENDOR_MOTECH "Motech" /** Driver scanning options. */ -static const int32_t hwopts[] = { +static const uint32_t hwopts[] = { SR_CONF_CONN, SR_CONF_SERIALCOMM, }; /** Hardware capabilities generic. */ -static const int32_t hwcaps[] = { +static const uint32_t hwcaps[] = { /* Device class */ SR_CONF_POWER_SUPPLY, /* Aquisition modes. */ @@ -62,7 +62,7 @@ static const int32_t hwcaps[] = { }; /** Hardware capabilities channel 1, 2. */ -static const int32_t hwcaps_ch12[] = { +static const uint32_t hwcaps_ch12[] = { SR_CONF_OUTPUT_VOLTAGE, SR_CONF_OUTPUT_VOLTAGE_MAX, SR_CONF_OUTPUT_CURRENT, @@ -71,7 +71,7 @@ static const int32_t hwcaps_ch12[] = { }; /** Hardware capabilities channel 3. (LPS-304/305 only). */ -static const int32_t hwcaps_ch3[] = { +static const uint32_t hwcaps_ch3[] = { SR_CONF_OUTPUT_VOLTAGE, SR_CONF_OUTPUT_ENABLED, }; @@ -540,7 +540,7 @@ static int cleanup(void) return dev_clear_lps301(); } -static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -595,7 +595,7 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, return SR_OK; } -static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, +static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -717,7 +717,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, return SR_OK; } -static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -731,8 +731,8 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, /* Driver options, no device instance necessary. */ switch (key) { case SR_CONF_SCAN_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwopts, ARRAY_SIZE(hwopts), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwopts, ARRAY_SIZE(hwopts), sizeof(uint32_t)); return SR_OK; default: if (sdi == NULL) @@ -741,12 +741,12 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, devc = sdi->priv; } - /* Device options, independant from channel groups. */ + /* Device options, independent from channel groups. */ if (cg == NULL) { switch (key) { case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwcaps, ARRAY_SIZE(hwcaps), sizeof(uint32_t)); return SR_OK; case SR_CONF_OUTPUT_CHANNEL_CONFIG: if (devc->model->modelid <= LPS_303) { @@ -769,11 +769,11 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, switch (key) { case SR_CONF_DEVICE_OPTIONS: if ((ch_idx == 0) || (ch_idx == 1)) /* CH1, CH2 */ - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwcaps_ch12, ARRAY_SIZE(hwcaps_ch12), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwcaps_ch12, ARRAY_SIZE(hwcaps_ch12), sizeof(uint32_t)); else /* Must be CH3 */ - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwcaps_ch3, ARRAY_SIZE(hwcaps_ch3), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwcaps_ch3, ARRAY_SIZE(hwcaps_ch3), sizeof(uint32_t)); break; case SR_CONF_OUTPUT_VOLTAGE_MAX: g_variant_builder_init(&gvb, G_VARIANT_TYPE_ARRAY); diff --git a/src/hardware/norma-dmm/api.c b/src/hardware/norma-dmm/api.c index 798b60e1..1eda0cf9 100644 --- a/src/hardware/norma-dmm/api.c +++ b/src/hardware/norma-dmm/api.c @@ -24,12 +24,12 @@ #include "protocol.h" -static const int32_t hwopts[] = { +static const uint32_t hwopts[] = { SR_CONF_CONN, SR_CONF_SERIALCOMM, }; -static const int32_t hwcaps[] = { +static const uint32_t hwcaps[] = { SR_CONF_MULTIMETER, SR_CONF_LIMIT_SAMPLES, SR_CONF_LIMIT_MSEC, @@ -235,7 +235,7 @@ static int cleanup_siemens_b102x(void) return std_dev_clear(&siemens_b102x_driver_info, NULL); } -static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, +static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -272,7 +272,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, return SR_OK; } -static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { (void)sdi; @@ -280,12 +280,12 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, switch (key) { case SR_CONF_SCAN_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwopts, ARRAY_SIZE(hwopts), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwopts, ARRAY_SIZE(hwopts), sizeof(uint32_t)); break; case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwcaps, ARRAY_SIZE(hwcaps), sizeof(uint32_t)); break; default: return SR_ERR_NA; diff --git a/src/hardware/openbench-logic-sniffer/api.c b/src/hardware/openbench-logic-sniffer/api.c index cd9d817e..ac69250c 100644 --- a/src/hardware/openbench-logic-sniffer/api.c +++ b/src/hardware/openbench-logic-sniffer/api.c @@ -22,12 +22,12 @@ #define SERIALCOMM "115200/8n1" -static const int32_t hwopts[] = { +static const uint32_t hwopts[] = { SR_CONF_CONN, SR_CONF_SERIALCOMM, }; -static const int32_t hwcaps[] = { +static const uint32_t hwcaps[] = { SR_CONF_LOGIC_ANALYZER, SR_CONF_SAMPLERATE, SR_CONF_TRIGGER_MATCH, @@ -215,7 +215,7 @@ static int cleanup(void) return std_dev_clear(di, NULL); } -static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, +static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -226,7 +226,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, return SR_ERR_ARG; devc = sdi->priv; - switch (id) { + switch (key) { case SR_CONF_SAMPLERATE: *data = g_variant_new_uint64(devc->cur_samplerate); break; @@ -254,7 +254,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, return SR_OK; } -static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, +static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -270,7 +270,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, devc = sdi->priv; - switch (id) { + switch (key) { case SR_CONF_SAMPLERATE: tmp_u64 = g_variant_get_uint64(data); if (tmp_u64 < samplerates[0] || tmp_u64 > samplerates[1]) @@ -351,7 +351,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, return ret; } -static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -363,12 +363,12 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, switch (key) { case SR_CONF_SCAN_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwopts, ARRAY_SIZE(hwopts), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwopts, ARRAY_SIZE(hwopts), sizeof(uint32_t)); break; case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwcaps, ARRAY_SIZE(hwcaps), sizeof(uint32_t)); break; case SR_CONF_SAMPLERATE: g_variant_builder_init(&gvb, G_VARIANT_TYPE("a{sv}")); diff --git a/src/hardware/pipistrello-ols/api.c b/src/hardware/pipistrello-ols/api.c index 01d82a6f..89282179 100644 --- a/src/hardware/pipistrello-ols/api.c +++ b/src/hardware/pipistrello-ols/api.c @@ -19,7 +19,7 @@ #include "protocol.h" -static const int32_t hwcaps[] = { +static const uint32_t hwcaps[] = { SR_CONF_LOGIC_ANALYZER, SR_CONF_SAMPLERATE, SR_CONF_TRIGGER_MATCH, @@ -236,7 +236,7 @@ static int cleanup(void) } -static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, +static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -247,7 +247,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, return SR_ERR_ARG; devc = sdi->priv; - switch (id) { + switch (key) { case SR_CONF_SAMPLERATE: *data = g_variant_new_uint64(devc->cur_samplerate); break; @@ -278,7 +278,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, return SR_OK; } -static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, +static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -294,7 +294,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, devc = sdi->priv; - switch (id) { + switch (key) { case SR_CONF_SAMPLERATE: tmp_u64 = g_variant_get_uint64(data); if (tmp_u64 < samplerates[0] || tmp_u64 > samplerates[1]) @@ -375,7 +375,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, return ret; } -static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -387,8 +387,8 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, switch (key) { case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwcaps, ARRAY_SIZE(hwcaps), sizeof(uint32_t)); break; case SR_CONF_SAMPLERATE: g_variant_builder_init(&gvb, G_VARIANT_TYPE("a{sv}")); diff --git a/src/hardware/rigol-ds/api.c b/src/hardware/rigol-ds/api.c index 500362be..f11d233d 100644 --- a/src/hardware/rigol-ds/api.c +++ b/src/hardware/rigol-ds/api.c @@ -29,12 +29,12 @@ #include "libsigrok-internal.h" #include "protocol.h" -static const int32_t hwopts[] = { +static const uint32_t hwopts[] = { SR_CONF_CONN, SR_CONF_SERIALCOMM }; -static const int32_t hwcaps[] = { +static const uint32_t hwcaps[] = { SR_CONF_OSCILLOSCOPE, SR_CONF_TIMEBASE, SR_CONF_TRIGGER_SOURCE, @@ -45,7 +45,7 @@ static const int32_t hwcaps[] = { SR_CONF_SAMPLERATE, }; -static const int32_t analog_hwcaps[] = { +static const uint32_t analog_hwcaps[] = { SR_CONF_NUM_VDIV, SR_CONF_VDIV, SR_CONF_COUPLING, @@ -489,7 +489,7 @@ static int digital_frame_size(const struct sr_dev_inst *sdi) } } -static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, +static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -521,7 +521,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, } } - switch (id) { + switch (key) { case SR_CONF_NUM_TIMEBASE: *data = g_variant_new_int32(devc->model->series->num_horizontal_divs); break; @@ -609,7 +609,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, return SR_OK; } -static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, +static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -633,7 +633,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, } ret = SR_OK; - switch (id) { + switch (key) { case SR_CONF_LIMIT_FRAMES: devc->limit_frames = g_variant_get_uint64(data); break; @@ -759,7 +759,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, return ret; } -static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { GVariant *tuple, *rational[2]; @@ -771,12 +771,12 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, devc = sdi->priv; if (key == SR_CONF_SCAN_OPTIONS) { - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwopts, ARRAY_SIZE(hwopts), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwopts, ARRAY_SIZE(hwopts), sizeof(uint32_t)); return SR_OK; } else if (key == SR_CONF_DEVICE_OPTIONS && cg == NULL) { - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwcaps, ARRAY_SIZE(hwcaps), sizeof(uint32_t)); return SR_OK; } @@ -802,14 +802,14 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, return SR_ERR_CHANNEL_GROUP; } if (cg == devc->digital_group) { - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - NULL, 0, sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + NULL, 0, sizeof(uint32_t)); return SR_OK; } else { for (i = 0; i < devc->model->analog_channels; i++) { if (cg == devc->analog_groups[i]) { - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - analog_hwcaps, ARRAY_SIZE(analog_hwcaps), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + analog_hwcaps, ARRAY_SIZE(analog_hwcaps), sizeof(uint32_t)); return SR_OK; } } diff --git a/src/hardware/saleae-logic16/api.c b/src/hardware/saleae-logic16/api.c index 6bd539ca..f20eadcb 100644 --- a/src/hardware/saleae-logic16/api.c +++ b/src/hardware/saleae-logic16/api.c @@ -41,11 +41,11 @@ SR_PRIV struct sr_dev_driver saleae_logic16_driver_info; static struct sr_dev_driver *di = &saleae_logic16_driver_info; -static const int32_t hwopts[] = { +static const uint32_t hwopts[] = { SR_CONF_CONN, }; -static const int32_t hwcaps[] = { +static const uint32_t hwcaps[] = { SR_CONF_LOGIC_ANALYZER, SR_CONF_SAMPLERATE, SR_CONF_VOLTAGE_THRESHOLD, @@ -436,7 +436,7 @@ static int cleanup(void) return ret; } -static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -490,7 +490,7 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, return ret; } -static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, +static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -533,7 +533,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, return ret; } -static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { GVariant *gvar, *range[2]; @@ -547,12 +547,12 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, ret = SR_OK; switch (key) { case SR_CONF_SCAN_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwopts, ARRAY_SIZE(hwopts), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwopts, ARRAY_SIZE(hwopts), sizeof(uint32_t)); break; case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwcaps, ARRAY_SIZE(hwcaps), sizeof(uint32_t)); break; case SR_CONF_SAMPLERATE: g_variant_builder_init(&gvb, G_VARIANT_TYPE("a{sv}")); diff --git a/src/hardware/scpi-pps/api.c b/src/hardware/scpi-pps/api.c index 2f4bdc93..aea3bd5e 100644 --- a/src/hardware/scpi-pps/api.c +++ b/src/hardware/scpi-pps/api.c @@ -25,7 +25,7 @@ static struct sr_dev_driver *di = &scpi_pps_driver_info; extern unsigned int num_pps_profiles; extern const struct scpi_pps pps_profiles[]; -static const int32_t scanopts[] = { +static const uint32_t scanopts[] = { SR_CONF_CONN, SR_CONF_SERIALCOMM, }; @@ -190,7 +190,7 @@ static int cleanup(void) return SR_OK; } -static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -313,7 +313,7 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, return ret; } -static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, +static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct sr_channel *ch; @@ -396,7 +396,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, return ret; } -static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -409,8 +409,8 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, /* Always available, even without sdi. */ if (key == SR_CONF_SCAN_OPTIONS) { - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - scanopts, ARRAY_SIZE(scanopts), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + scanopts, ARRAY_SIZE(scanopts), sizeof(uint32_t)); return SR_OK; } @@ -423,9 +423,9 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, /* No channel group: global options. */ switch (key) { case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, devc->device->devopts, devc->device->num_devopts, - sizeof(int32_t)); + sizeof(uint32_t)); break; case SR_CONF_OUTPUT_CHANNEL_CONFIG: /* Not used. */ @@ -460,9 +460,9 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, switch (key) { case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, devc->device->devopts_cg, devc->device->num_devopts_cg, - sizeof(int32_t)); + sizeof(uint32_t)); break; case SR_CONF_OUTPUT_VOLTAGE_MAX: ch_spec = &(devc->device->channels[ch->index]); diff --git a/src/hardware/scpi-pps/profiles.c b/src/hardware/scpi-pps/profiles.c index 34f4a6a3..925b6db8 100644 --- a/src/hardware/scpi-pps/profiles.c +++ b/src/hardware/scpi-pps/profiles.c @@ -39,16 +39,16 @@ const char *get_vendor(const char *raw_vendor) return raw_vendor; } -static const int32_t devopts_none[] = { }; +static const uint32_t devopts_none[] = { }; /* Rigol DP800 series */ -static const int32_t rigol_dp800_devopts[] = { +static const uint32_t rigol_dp800_devopts[] = { SR_CONF_POWER_SUPPLY, SR_CONF_CONTINUOUS, SR_CONF_OVER_TEMPERATURE_PROTECTION, }; -static const int32_t rigol_dp800_devopts_cg[] = { +static const uint32_t rigol_dp800_devopts_cg[] = { SR_CONF_OUTPUT_REGULATION, SR_CONF_OVER_VOLTAGE_PROTECTION_ENABLED, SR_CONF_OVER_VOLTAGE_PROTECTION_ACTIVE, @@ -108,7 +108,7 @@ struct scpi_command rigol_dp800_cmd[] = { }; /* HP 663xx series */ -static const int32_t hp_6632b_devopts[] = { +static const uint32_t hp_6632b_devopts[] = { SR_CONF_POWER_SUPPLY, SR_CONF_CONTINUOUS, SR_CONF_OUTPUT_ENABLED, diff --git a/src/hardware/scpi-pps/protocol.h b/src/hardware/scpi-pps/protocol.h index d6695add..552d5030 100644 --- a/src/hardware/scpi-pps/protocol.h +++ b/src/hardware/scpi-pps/protocol.h @@ -71,9 +71,9 @@ struct scpi_pps { char *vendor; char *model; uint64_t features; - const int32_t *devopts; + const uint32_t *devopts; unsigned int num_devopts; - const int32_t *devopts_cg; + const uint32_t *devopts_cg; unsigned int num_devopts_cg; struct channel_spec *channels; unsigned int num_channels; diff --git a/src/hardware/serial-dmm/api.c b/src/hardware/serial-dmm/api.c index a401dd65..d92b6fc1 100644 --- a/src/hardware/serial-dmm/api.c +++ b/src/hardware/serial-dmm/api.c @@ -29,12 +29,12 @@ #include "libsigrok-internal.h" #include "protocol.h" -static const int32_t hwopts[] = { +static const uint32_t hwopts[] = { SR_CONF_CONN, SR_CONF_SERIALCOMM, }; -static const int32_t hwcaps[] = { +static const uint32_t hwcaps[] = { SR_CONF_MULTIMETER, SR_CONF_LIMIT_SAMPLES, SR_CONF_LIMIT_MSEC, @@ -465,7 +465,7 @@ static int cleanup(int dmm) return dev_clear(dmm); } -static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, +static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -480,7 +480,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, return SR_ERR_BUG; } - switch (id) { + switch (key) { case SR_CONF_LIMIT_SAMPLES: devc->limit_samples = g_variant_get_uint64(data); sr_dbg("Setting sample limit to %" PRIu64 ".", @@ -498,7 +498,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, return SR_OK; } -static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { (void)sdi; @@ -506,12 +506,12 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, switch (key) { case SR_CONF_SCAN_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwopts, ARRAY_SIZE(hwopts), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwopts, ARRAY_SIZE(hwopts), sizeof(uint32_t)); break; case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwcaps, ARRAY_SIZE(hwcaps), sizeof(uint32_t)); break; default: return SR_ERR_NA; diff --git a/src/hardware/sysclk-lwla/api.c b/src/hardware/sysclk-lwla/api.c index a4346a01..d2aeb301 100644 --- a/src/hardware/sysclk-lwla/api.c +++ b/src/hardware/sysclk-lwla/api.c @@ -25,11 +25,11 @@ #include #include -static const int32_t hwopts[] = { +static const uint32_t hwopts[] = { SR_CONF_CONN, }; -static const int32_t hwcaps[] = { +static const uint32_t hwcaps[] = { SR_CONF_LOGIC_ANALYZER, SR_CONF_SAMPLERATE, SR_CONF_EXTERNAL_CLOCK, @@ -271,7 +271,7 @@ static int cleanup(void) return dev_clear(); } -static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -343,7 +343,7 @@ static int lookup_index(GVariant *value, const char *const *table, int len) return -1; } -static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, +static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { uint64_t value; @@ -445,7 +445,7 @@ static int config_commit(const struct sr_dev_inst *sdi) return lwla_set_clock_config(sdi); } -static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { GVariant *gvar; @@ -456,12 +456,12 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, switch (key) { case SR_CONF_SCAN_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwopts, G_N_ELEMENTS(hwopts), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwopts, G_N_ELEMENTS(hwopts), sizeof(uint32_t)); break; case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwcaps, G_N_ELEMENTS(hwcaps), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwcaps, G_N_ELEMENTS(hwcaps), sizeof(uint32_t)); break; case SR_CONF_SAMPLERATE: g_variant_builder_init(&gvb, G_VARIANT_TYPE("a{sv}")); diff --git a/src/hardware/teleinfo/api.c b/src/hardware/teleinfo/api.c index c4fd8467..48d77543 100644 --- a/src/hardware/teleinfo/api.c +++ b/src/hardware/teleinfo/api.c @@ -23,12 +23,12 @@ #include "libsigrok-internal.h" #include "protocol.h" -static const int32_t hwopts[] = { +static const uint32_t hwopts[] = { SR_CONF_CONN, SR_CONF_SERIALCOMM, }; -static const int32_t hwcaps[] = { +static const uint32_t hwcaps[] = { SR_CONF_ENERGYMETER, SR_CONF_LIMIT_SAMPLES, SR_CONF_LIMIT_MSEC, @@ -177,7 +177,7 @@ static int cleanup(void) return std_dev_clear(di, NULL); } -static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, +static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -208,7 +208,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, return SR_OK; } -static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { (void)sdi; @@ -216,12 +216,12 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, switch (key) { case SR_CONF_SCAN_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwopts, ARRAY_SIZE(hwopts), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwopts, ARRAY_SIZE(hwopts), sizeof(uint32_t)); break; case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwcaps, ARRAY_SIZE(hwcaps), sizeof(uint32_t)); break; default: return SR_ERR_NA; diff --git a/src/hardware/testo/api.c b/src/hardware/testo/api.c index 2b4c9634..c0604da6 100644 --- a/src/hardware/testo/api.c +++ b/src/hardware/testo/api.c @@ -26,11 +26,11 @@ SR_PRIV struct sr_dev_driver testo_driver_info; static struct sr_dev_driver *di = &testo_driver_info; static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data); -static const int32_t scanopts[] = { +static const uint32_t scanopts[] = { SR_CONF_CONN, }; -static const int32_t devopts[] = { +static const uint32_t devopts[] = { SR_CONF_MULTIMETER, SR_CONF_LIMIT_MSEC, SR_CONF_LIMIT_SAMPLES, @@ -241,7 +241,7 @@ static int cleanup(void) return ret; } -static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct sr_usb_dev_inst *usb; @@ -264,7 +264,7 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, return SR_OK; } -static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, +static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -303,7 +303,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, return ret; } -static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { (void)sdi; @@ -311,12 +311,12 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, switch (key) { case SR_CONF_SCAN_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - scanopts, ARRAY_SIZE(scanopts), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + scanopts, ARRAY_SIZE(scanopts), sizeof(uint32_t)); break; case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - devopts, ARRAY_SIZE(devopts), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + devopts, ARRAY_SIZE(devopts), sizeof(uint32_t)); break; default: return SR_ERR_NA; diff --git a/src/hardware/tondaj-sl-814/api.c b/src/hardware/tondaj-sl-814/api.c index 7917c8d2..11885c72 100644 --- a/src/hardware/tondaj-sl-814/api.c +++ b/src/hardware/tondaj-sl-814/api.c @@ -26,12 +26,12 @@ #define SERIALCOMM "9600/8e1" -static const int32_t hwopts[] = { +static const uint32_t hwopts[] = { SR_CONF_CONN, SR_CONF_SERIALCOMM, }; -static const int32_t hwcaps[] = { +static const uint32_t hwcaps[] = { SR_CONF_SOUNDLEVELMETER, SR_CONF_LIMIT_SAMPLES, SR_CONF_CONTINUOUS, @@ -128,7 +128,7 @@ static int cleanup(void) return std_dev_clear(di, NULL); } -static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, +static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -140,7 +140,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, devc = sdi->priv; - switch (id) { + switch (key) { case SR_CONF_LIMIT_SAMPLES: devc->limit_samples = g_variant_get_uint64(data); sr_dbg("Setting sample limit to %" PRIu64 ".", @@ -153,7 +153,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, return SR_OK; } -static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { (void)sdi; @@ -161,12 +161,12 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, switch (key) { case SR_CONF_SCAN_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwopts, ARRAY_SIZE(hwopts), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwopts, ARRAY_SIZE(hwopts), sizeof(uint32_t)); break; case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwcaps, ARRAY_SIZE(hwcaps), sizeof(uint32_t)); break; default: return SR_ERR_NA; diff --git a/src/hardware/uni-t-dmm/api.c b/src/hardware/uni-t-dmm/api.c index f0fcc1fd..46158f32 100644 --- a/src/hardware/uni-t-dmm/api.c +++ b/src/hardware/uni-t-dmm/api.c @@ -26,11 +26,11 @@ #define UNI_T_UT_D04_NEW "1a86.e008" -static const int32_t hwopts[] = { +static const uint32_t hwopts[] = { SR_CONF_CONN, }; -static const int32_t hwcaps[] = { +static const uint32_t hwcaps[] = { SR_CONF_MULTIMETER, SR_CONF_LIMIT_SAMPLES, SR_CONF_LIMIT_MSEC, @@ -267,7 +267,7 @@ static int cleanup(int dmm) return dev_clear(dmm); } -static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, +static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -276,7 +276,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, devc = sdi->priv; - switch (id) { + switch (key) { case SR_CONF_LIMIT_MSEC: if (g_variant_get_uint64(data) == 0) { sr_err("Time limit cannot be 0."); @@ -302,7 +302,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, return SR_OK; } -static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { (void)sdi; @@ -310,12 +310,12 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, switch (key) { case SR_CONF_SCAN_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwopts, ARRAY_SIZE(hwopts), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwopts, ARRAY_SIZE(hwopts), sizeof(uint32_t)); break; case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwcaps, ARRAY_SIZE(hwcaps), sizeof(uint32_t)); break; default: return SR_ERR_NA; diff --git a/src/hardware/uni-t-ut32x/api.c b/src/hardware/uni-t-ut32x/api.c index 81024dc7..52f0c476 100644 --- a/src/hardware/uni-t-ut32x/api.c +++ b/src/hardware/uni-t-ut32x/api.c @@ -21,7 +21,7 @@ #include -static const int32_t hwcaps[] = { +static const uint32_t hwcaps[] = { SR_CONF_THERMOMETER, SR_CONF_LIMIT_SAMPLES, SR_CONF_CONTINUOUS, @@ -199,7 +199,7 @@ static int cleanup(void) return ret; } -static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -224,7 +224,7 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, return SR_OK; } -static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, +static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -265,7 +265,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, return ret; } -static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { @@ -274,8 +274,8 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, switch (key) { case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwcaps, ARRAY_SIZE(hwcaps), sizeof(uint32_t)); break; case SR_CONF_DATA_SOURCE: *data = g_variant_new_strv(data_sources, ARRAY_SIZE(data_sources)); diff --git a/src/hardware/victor-dmm/api.c b/src/hardware/victor-dmm/api.c index 56c53e50..92a1ace8 100644 --- a/src/hardware/victor-dmm/api.c +++ b/src/hardware/victor-dmm/api.c @@ -35,11 +35,11 @@ SR_PRIV struct sr_dev_driver victor_dmm_driver_info; static struct sr_dev_driver *di = &victor_dmm_driver_info; static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data); -static const int32_t hwopts[] = { +static const uint32_t hwopts[] = { SR_CONF_CONN, }; -static const int32_t hwcaps[] = { +static const uint32_t hwcaps[] = { SR_CONF_MULTIMETER, SR_CONF_LIMIT_MSEC, SR_CONF_LIMIT_SAMPLES, @@ -201,7 +201,7 @@ static int cleanup(void) return ret; } -static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, +static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct sr_usb_dev_inst *usb; @@ -209,7 +209,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, (void)cg; - switch (id) { + switch (key) { case SR_CONF_CONN: if (!sdi || !sdi->conn) return SR_ERR_ARG; @@ -224,7 +224,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, return SR_OK; } -static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, +static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -243,7 +243,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, devc = sdi->priv; ret = SR_OK; - switch (id) { + switch (key) { case SR_CONF_LIMIT_MSEC: devc->limit_msec = g_variant_get_uint64(data); now = g_get_monotonic_time() / 1000; @@ -263,7 +263,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, return ret; } -static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { (void)sdi; @@ -271,12 +271,12 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, switch (key) { case SR_CONF_SCAN_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwopts, ARRAY_SIZE(hwopts), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwopts, ARRAY_SIZE(hwopts), sizeof(uint32_t)); break; case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwcaps, ARRAY_SIZE(hwcaps), sizeof(uint32_t)); break; default: return SR_ERR_NA; diff --git a/src/hardware/yokogawa-dlm/api.c b/src/hardware/yokogawa-dlm/api.c index 070c6bd0..276ff0ff 100644 --- a/src/hardware/yokogawa-dlm/api.c +++ b/src/hardware/yokogawa-dlm/api.c @@ -189,7 +189,7 @@ static int check_channel_group(struct dev_context *devc, return CG_INVALID; } -static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { int ret, cg_type; @@ -307,7 +307,7 @@ static GVariant *build_tuples(const uint64_t (*array)[][2], unsigned int n) return g_variant_builder_end(&gvb); } -static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, +static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { int ret, cg_type; @@ -461,7 +461,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, return ret; } -static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { int cg_type; @@ -482,14 +482,14 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, break; case SR_CONF_DEVICE_OPTIONS: if (cg_type == CG_NONE) { - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - model->hw_caps, model->num_hwcaps, sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + model->hw_caps, model->num_hwcaps, sizeof(uint32_t)); } else if (cg_type == CG_ANALOG) { - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - model->analog_hwcaps, model->num_analog_hwcaps, sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + model->analog_hwcaps, model->num_analog_hwcaps, sizeof(uint32_t)); } else { - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - NULL, 0, sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + NULL, 0, sizeof(uint32_t)); } break; case SR_CONF_COUPLING: diff --git a/src/hardware/yokogawa-dlm/protocol.c b/src/hardware/yokogawa-dlm/protocol.c index 8f95f187..5148c8d7 100644 --- a/src/hardware/yokogawa-dlm/protocol.c +++ b/src/hardware/yokogawa-dlm/protocol.c @@ -25,7 +25,7 @@ #include "protocol.h" -static const int32_t dlm_hwcaps[] = { +static const uint32_t dlm_hwcaps[] = { SR_CONF_LOGIC_ANALYZER, SR_CONF_OSCILLOSCOPE, SR_CONF_TRIGGER_SLOPE, @@ -35,7 +35,7 @@ static const int32_t dlm_hwcaps[] = { SR_CONF_HORIZ_TRIGGERPOS, }; -static const int32_t dlm_analog_caps[] = { +static const uint32_t dlm_analog_caps[] = { SR_CONF_VDIV, SR_CONF_COUPLING, SR_CONF_NUM_VDIV, diff --git a/src/hardware/yokogawa-dlm/protocol.h b/src/hardware/yokogawa-dlm/protocol.h index 0950267a..523403d5 100644 --- a/src/hardware/yokogawa-dlm/protocol.h +++ b/src/hardware/yokogawa-dlm/protocol.h @@ -57,10 +57,10 @@ struct scope_config { const char *(*analog_names)[]; const char *(*digital_names)[]; - const int32_t (*hw_caps)[]; + const uint32_t (*hw_caps)[]; const uint8_t num_hwcaps; - const int32_t (*analog_hwcaps)[]; + const uint32_t (*analog_hwcaps)[]; const uint8_t num_analog_hwcaps; const char *(*coupling_options)[]; diff --git a/src/hardware/zeroplus-logic-cube/api.c b/src/hardware/zeroplus-logic-cube/api.c index a49f0748..3a0e4d8c 100644 --- a/src/hardware/zeroplus-logic-cube/api.c +++ b/src/hardware/zeroplus-logic-cube/api.c @@ -52,7 +52,7 @@ static const struct zp_model zeroplus_models[] = { { 0, 0, 0, 0, 0, 0 } }; -static const int32_t hwcaps[] = { +static const uint32_t hwcaps[] = { SR_CONF_LOGIC_ANALYZER, SR_CONF_SAMPLERATE, SR_CONF_TRIGGER_MATCH, @@ -382,14 +382,14 @@ static int cleanup(void) return std_dev_clear(di, NULL); } -static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, +static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; (void)cg; - switch (id) { + switch (key) { case SR_CONF_SAMPLERATE: if (sdi) { devc = sdi->priv; @@ -423,7 +423,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, return SR_OK; } -static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, +static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -439,7 +439,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, return SR_ERR_ARG; } - switch (id) { + switch (key) { case SR_CONF_SAMPLERATE: return zp_set_samplerate(devc, g_variant_get_uint64(data)); case SR_CONF_LIMIT_SAMPLES: @@ -456,7 +456,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, return SR_OK; } -static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -469,8 +469,8 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, switch (key) { case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwcaps, ARRAY_SIZE(hwcaps), sizeof(uint32_t)); break; case SR_CONF_SAMPLERATE: devc = sdi->priv; diff --git a/src/hwdriver.c b/src/hwdriver.c index bf0ce04d..e36990a2 100644 --- a/src/hwdriver.c +++ b/src/hwdriver.c @@ -166,7 +166,7 @@ SR_PRIV const GVariantType *sr_variant_type_get(int datatype) } } -SR_PRIV int sr_variant_type_check(int key, GVariant *value) +SR_PRIV int sr_variant_type_check(uint32_t key, GVariant *value) { const struct sr_config_info *info; const GVariantType *type, *expected; @@ -312,7 +312,7 @@ SR_PRIV void sr_hw_cleanup_all(void) * A floating reference can be passed in for data. * @private */ -SR_PRIV struct sr_config *sr_config_new(int key, GVariant *data) +SR_PRIV struct sr_config *sr_config_new(uint32_t key, GVariant *data) { struct sr_config *src; @@ -367,7 +367,7 @@ SR_PRIV void sr_config_free(struct sr_config *src) SR_API int sr_config_get(const struct sr_dev_driver *driver, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg, - int key, GVariant **data) + uint32_t key, GVariant **data) { int ret; @@ -407,7 +407,7 @@ SR_API int sr_config_get(const struct sr_dev_driver *driver, */ SR_API int sr_config_set(const struct sr_dev_inst *sdi, const struct sr_channel_group *cg, - int key, GVariant *data) + uint32_t key, GVariant *data) { int ret; @@ -474,7 +474,7 @@ SR_API int sr_config_commit(const struct sr_dev_inst *sdi) SR_API int sr_config_list(const struct sr_dev_driver *driver, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg, - int key, GVariant **data) + uint32_t key, GVariant **data) { int ret; @@ -498,7 +498,7 @@ SR_API int sr_config_list(const struct sr_dev_driver *driver, * * @since 0.2.0 */ -SR_API const struct sr_config_info *sr_config_info_get(int key) +SR_API const struct sr_config_info *sr_config_info_get(uint32_t key) { int i; diff --git a/src/libsigrok-internal.h b/src/libsigrok-internal.h index 4bd7a7da..1fc049e4 100644 --- a/src/libsigrok-internal.h +++ b/src/libsigrok-internal.h @@ -517,9 +517,9 @@ SR_PRIV void sr_usbtmc_dev_inst_free(struct sr_usbtmc_dev_inst *usbtmc); /*--- hwdriver.c ------------------------------------------------------------*/ SR_PRIV const GVariantType *sr_variant_type_get(int datatype); -SR_PRIV int sr_variant_type_check(int key, GVariant *data); +SR_PRIV int sr_variant_type_check(uint32_t key, GVariant *data); SR_PRIV void sr_hw_cleanup_all(void); -SR_PRIV struct sr_config *sr_config_new(int key, GVariant *data); +SR_PRIV struct sr_config *sr_config_new(uint32_t key, GVariant *data); SR_PRIV void sr_config_free(struct sr_config *src); SR_PRIV int sr_source_remove(int fd); SR_PRIV int sr_source_remove_pollfd(GPollFD *pollfd); diff --git a/src/session_driver.c b/src/session_driver.c index 9120ea14..6a320aa5 100644 --- a/src/session_driver.c +++ b/src/session_driver.c @@ -49,7 +49,7 @@ struct session_vdev { gboolean finished; }; -static const int hwcaps[] = { +static const uint32_t hwcaps[] = { SR_CONF_CAPTUREFILE, SR_CONF_CAPTURE_UNITSIZE, SR_CONF_SAMPLERATE, @@ -209,14 +209,14 @@ static int dev_close(struct sr_dev_inst *sdi) return SR_OK; } -static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, +static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct session_vdev *vdev; (void)cg; - switch (id) { + switch (key) { case SR_CONF_SAMPLERATE: if (sdi) { vdev = sdi->priv; @@ -231,7 +231,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, return SR_OK; } -static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, +static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct session_vdev *vdev; @@ -240,7 +240,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, vdev = sdi->priv; - switch (id) { + switch (key) { case SR_CONF_SAMPLERATE: vdev->samplerate = g_variant_get_uint64(data); sr_info("Setting samplerate to %" PRIu64 ".", vdev->samplerate); @@ -268,7 +268,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, return SR_OK; } -static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { (void)sdi; @@ -276,8 +276,8 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, switch (key) { case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + hwcaps, ARRAY_SIZE(hwcaps), sizeof(uint32_t)); break; default: return SR_ERR_NA;