]> sigrok.org Git - libsigrok.git/blobdiff - hardware/uni-t-dmm/api.c
probe_groups: API changes required to implement probe groups.
[libsigrok.git] / hardware / uni-t-dmm / api.c
index 8968d876663fd2711f99e3ed8f50621912da6c0d..84a288b9c9d6207a479746794360d580223592d9 100644 (file)
@@ -37,8 +37,9 @@ static const int32_t hwcaps[] = {
        SR_CONF_CONTINUOUS,
 };
 
-SR_PRIV struct sr_dev_driver tecpel_dmm_8060_driver_info;
 SR_PRIV struct sr_dev_driver tecpel_dmm_8061_driver_info;
+SR_PRIV struct sr_dev_driver uni_t_ut60a_driver_info;
+SR_PRIV struct sr_dev_driver uni_t_ut60e_driver_info;
 SR_PRIV struct sr_dev_driver uni_t_ut61d_driver_info;
 SR_PRIV struct sr_dev_driver uni_t_ut61e_driver_info;
 SR_PRIV struct sr_dev_driver voltcraft_vc820_driver_info;
@@ -47,18 +48,25 @@ SR_PRIV struct sr_dev_driver voltcraft_vc840_driver_info;
 
 SR_PRIV struct dmm_info udmms[] = {
        {
-               "Tecpel", "DMM-8060", 2400,
+               "Tecpel", "DMM-8061", 2400,
+               FS9721_PACKET_SIZE, NULL,
+               sr_fs9721_packet_valid, sr_fs9721_parse,
+               sr_fs9721_00_temp_c,
+               &tecpel_dmm_8061_driver_info, receive_data_TECPEL_DMM_8061,
+       },
+       {
+               "UNI-T", "UT60A", 2400,
                FS9721_PACKET_SIZE, NULL,
                sr_fs9721_packet_valid, sr_fs9721_parse,
                NULL,
-               &tecpel_dmm_8060_driver_info, receive_data_TECPEL_DMM_8060,
+               &uni_t_ut60a_driver_info, receive_data_UNI_T_UT60A,
        },
        {
-               "Tecpel", "DMM-8061", 2400,
+               "UNI-T", "UT60E", 2400,
                FS9721_PACKET_SIZE, NULL,
                sr_fs9721_packet_valid, sr_fs9721_parse,
                sr_fs9721_00_temp_c,
-               &tecpel_dmm_8061_driver_info, receive_data_TECPEL_DMM_8061,
+               &uni_t_ut60e_driver_info, receive_data_UNI_T_UT60E,
        },
        {
                "UNI-T", "UT61D", 2400,
@@ -68,7 +76,16 @@ SR_PRIV struct dmm_info udmms[] = {
                &uni_t_ut61d_driver_info, receive_data_UNI_T_UT61D,
        },
        {
-               "UNI-T", "UT61E", 19230,
+               /*
+                * Important: The actual baudrate of the Cyrustek ES51922 chip
+                * used in this DMM is 19230. However, the WCH CH9325 chip
+                * (UART to USB/HID) used in (some versions of) the UNI-T
+                * UT-D04 cable doesn't support 19230 baud. It only supports
+                * 19200, and setting an unsupported baudrate will result in
+                * the default of 2400 being used (which will not work with
+                * this DMM, of course).
+                */
+               "UNI-T", "UT61E", 19200,
                ES51922_PACKET_SIZE, NULL,
                sr_es51922_packet_valid, sr_es51922_parse,
                NULL,
@@ -82,10 +99,15 @@ SR_PRIV struct dmm_info udmms[] = {
                &voltcraft_vc820_driver_info, receive_data_VOLTCRAFT_VC820,
        },
        {
+               /*
+                * Note: The VC830 doesn't set the 'volt' and 'diode' bits of
+                * the FS9922 protocol. Instead, it only sets the user-defined
+                * bit "z1" to indicate "diode mode" and "voltage".
+                */
                "Voltcraft", "VC-830", 2400,
                FS9922_PACKET_SIZE, NULL,
                sr_fs9922_packet_valid, sr_fs9922_parse,
-               NULL,
+               &sr_fs9922_z1_diode,
                &voltcraft_vc830_driver_info, receive_data_VOLTCRAFT_VC830,
        },
        {
@@ -132,7 +154,7 @@ static GSList *scan(GSList *options, int dmm)
                }
        }
        if (!conn)
-               conn = UNI_T_UT_D04_NEW;
+               return NULL;
 
        devices = NULL;
        if (!(usb_devices = sr_usb_find(drvc->sr_ctx->libusb_ctx, conn))) {
@@ -207,10 +229,13 @@ 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(int id, GVariant *data, const struct sr_dev_inst *sdi,
+               const struct sr_probe_group *probe_group)
 {
        struct dev_context *devc;
 
+       (void)probe_group;
+
        devc = sdi->priv;
 
        switch (id) {
@@ -239,9 +264,11 @@ 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(int key, GVariant **data, const struct sr_dev_inst *sdi,
+               const struct sr_probe_group *probe_group)
 {
        (void)sdi;
+       (void)probe_group;
 
        switch (key) {
        case SR_CONF_SCAN_OPTIONS:
@@ -343,8 +370,9 @@ SR_PRIV struct sr_dev_driver ID##_driver_info = { \
        .priv = NULL, \
 };
 
-DRV(tecpel_dmm_8060, TECPEL_DMM_8060, "tecpel-dmm-8060", "Tecpel DMM-8060")
 DRV(tecpel_dmm_8061, TECPEL_DMM_8061, "tecpel-dmm-8061", "Tecpel DMM-8061")
+DRV(uni_t_ut60a, UNI_T_UT60A, "uni-t-ut60a", "UNI-T UT60A")
+DRV(uni_t_ut60e, UNI_T_UT60E, "uni-t-ut60e", "UNI-T UT60E")
 DRV(uni_t_ut61d, UNI_T_UT61D, "uni-t-ut61d", "UNI-T UT61D")
 DRV(uni_t_ut61e, UNI_T_UT61E, "uni-t-ut61e", "UNI-T UT61E")
 DRV(voltcraft_vc820, VOLTCRAFT_VC820, "voltcraft-vc820", "Voltcraft VC-820")