X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fconrad-digi-35-cpu%2Fapi.c;h=e820e253b8dda0511fdf6c8be523884038b4ad95;hb=61b0292217465ea50ebbf8f9c960330d8c1cbacd;hp=6a1f31c9a952d1777d23094f0ae4d10bce36d7d2;hpb=a1eaa9e066ff8d86db8a1fba6615204d442c53d7;p=libsigrok.git diff --git a/src/hardware/conrad-digi-35-cpu/api.c b/src/hardware/conrad-digi-35-cpu/api.c index 6a1f31c9..e820e253 100644 --- a/src/hardware/conrad-digi-35-cpu/api.c +++ b/src/hardware/conrad-digi-35-cpu/api.c @@ -26,17 +26,16 @@ #define SERIALCOMM "9600/8n1" -static const int32_t hwopts[] = { +static const uint32_t scanopts[] = { SR_CONF_CONN, SR_CONF_SERIALCOMM, }; -static const int32_t hwcaps[] = { +static const uint32_t devopts[] = { SR_CONF_POWER_SUPPLY, - SR_CONF_OUTPUT_VOLTAGE, - SR_CONF_OUTPUT_CURRENT, - /* There's no SR_CONF_OUTPUT_ENABLED; can't know/set status remotely. */ - SR_CONF_OVER_CURRENT_PROTECTION_ENABLED, + SR_CONF_OUTPUT_VOLTAGE | SR_CONF_SET, + SR_CONF_OUTPUT_CURRENT | SR_CONF_SET, + SR_CONF_OVER_CURRENT_PROTECTION_ENABLED | SR_CONF_SET, }; SR_PRIV struct sr_dev_driver conrad_digi_35_cpu_driver_info; @@ -87,7 +86,7 @@ static GSList *scan(GSList *options) if (!(serial = sr_serial_dev_inst_new(conn, serialcomm))) return NULL; - if (serial_open(serial, SERIAL_RDWR | SERIAL_NONBLOCK) != SR_OK) + if (serial_open(serial, SERIAL_RDWR) != SR_OK) return NULL; serial_flush(serial); @@ -95,7 +94,7 @@ static GSList *scan(GSList *options) sr_spew("Conrad DIGI 35 CPU assumed at %s.", conn); - if (!(sdi = sr_dev_inst_new(0, SR_ST_ACTIVE, "Conrad", "DIGI 35 CPU", NULL))) + if (!(sdi = sr_dev_inst_new(SR_ST_ACTIVE, "Conrad", "DIGI 35 CPU", NULL))) return NULL; sdi->conn = serial; @@ -121,7 +120,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; @@ -150,7 +149,6 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, } ret = send_msg1(sdi, 'C', (int) (dblval * 100 + 0.5)); break; - /* No SR_CONF_OUTPUT_ENABLED :-( . */ case SR_CONF_OVER_CURRENT_PROTECTION_ENABLED: if (g_variant_get_boolean(data)) ret = send_msg1(sdi, 'V', 900); @@ -164,7 +162,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 +173,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, + scanopts, ARRAY_SIZE(scanopts), 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, + devopts, ARRAY_SIZE(devopts), sizeof(uint32_t)); break; default: return SR_ERR_NA;