X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fkorad-kaxxxxp%2Fapi.c;h=26b1ee8ef8aefc6b55cd3823132bea45756eab5b;hb=88a0265ebcb265ba839c02cc5bcd39e359c9f60f;hp=38bbefcbceea0b10357231a1b4fd497977cce9f1;hpb=2c5bdf1bbdf8d68b8ff9b352c790f50f23d90a23;p=libsigrok.git diff --git a/src/hardware/korad-kaxxxxp/api.c b/src/hardware/korad-kaxxxxp/api.c index 38bbefcb..26b1ee8e 100644 --- a/src/hardware/korad-kaxxxxp/api.c +++ b/src/hardware/korad-kaxxxxp/api.c @@ -50,11 +50,16 @@ static const uint32_t devopts[] = { static const struct korad_kaxxxxp_model models[] = { /* Device enum, vendor, model, ID reply, channels, voltage, current */ - {VELLEMAN_LABPS_3005D, "Velleman", "LABPS3005D", + {VELLEMAN_PS3005D, "Velleman", "PS3005D", + "VELLEMANPS3005DV2.0", 1, {0, 31, 0.01}, {0, 5, 0.001}}, + {VELLEMAN_LABPS3005D, "Velleman", "LABPS3005D", "VELLEMANLABPS3005DV2.0", 1, {0, 31, 0.01}, {0, 5, 0.001}}, - {KORAD_KA3005D, "Korad", "KA3005P", + {KORAD_KA3005P, "Korad", "KA3005P", "KORADKA3005PV2.0", 1, {0, 31, 0.01}, {0, 5, 0.001}}, - {0, NULL, NULL, NULL, 0, {0, 0, 0}, {0, 0, 0}} + /* Sometimes the KA3005P has an extra 0x01 after the ID. */ + {KORAD_KA3005P_0X01, "Korad", "KA3005P", + "KORADKA3005PV2.0\x01", 1, {0, 31, 0.01}, {0, 5, 0.001}}, + ALL_ZERO }; SR_PRIV struct sr_dev_driver korad_kaxxxxp_driver_info; @@ -133,7 +138,8 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) sr_err("Unknown model ID '%s' detected, aborting.", reply); return NULL; } - sr_dbg("Found: %s %s", models[model_id].vendor, models[model_id].name); + sr_dbg("Found: %s %s (idx %d, ID '%s').", models[model_id].vendor, + models[model_id].name, model_id, models[model_id].id); /* Init device instance, etc. */ sdi = g_malloc0(sizeof(struct sr_dev_inst)); @@ -177,17 +183,6 @@ static GSList *dev_list(const struct sr_dev_driver *di) return ((struct drv_context *)(di->context))->instances; } -static int dev_clear(const struct sr_dev_driver *di) -{ - return std_dev_clear(di, NULL); -} - -static int cleanup(const struct sr_dev_driver *di) -{ - dev_clear(di); - return SR_OK; -} - static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { @@ -375,7 +370,7 @@ static int config_list(uint32_t key, GVariant **data, return SR_OK; } -static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) +static int dev_acquisition_start(const struct sr_dev_inst *sdi) { struct dev_context *devc; struct sr_serial_dev_inst *serial; @@ -384,10 +379,8 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) return SR_ERR_DEV_CLOSED; devc = sdi->priv; - devc->cb_data = cb_data; - /* Send header packet to the session bus. */ - std_session_send_df_header(cb_data, LOG_PREFIX); + std_session_send_df_header(sdi, LOG_PREFIX); devc->starttime = g_get_monotonic_time(); devc->num_samples = 0; @@ -401,12 +394,12 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) return SR_OK; } -static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data) +static int dev_acquisition_stop(struct sr_dev_inst *sdi) { if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; - return std_serial_dev_acquisition_stop(sdi, cb_data, + return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close, sdi->conn, LOG_PREFIX); } @@ -415,10 +408,9 @@ SR_PRIV struct sr_dev_driver korad_kaxxxxp_driver_info = { .longname = "Korad KAxxxxP", .api_version = 1, .init = init, - .cleanup = cleanup, + .cleanup = std_cleanup, .scan = scan, .dev_list = dev_list, - .dev_clear = dev_clear, .config_get = config_get, .config_set = config_set, .config_list = config_list,