]> sigrok.org Git - libsigrok.git/blobdiff - hardware/lascar-el-usb/api.c
unify sr_datafeed_meta_* into one struct containing sr_config
[libsigrok.git] / hardware / lascar-el-usb / api.c
index 68a06eb1513f33300b5e8895d8f89bdeefd8f8e9..e987570579838a318ad3b3b507e7a7147c6bdd1a 100644 (file)
@@ -40,11 +40,6 @@ static const int hwcaps[] = {
        0
 };
 
-static const char *probe_names[] = {
-       "P1",
-};
-
-
 /* Properly close and free all devices. */
 static int clear_instances(void)
 {
@@ -221,7 +216,6 @@ static int hw_cleanup(void)
 static int hw_info_get(int info_id, const void **data,
                const struct sr_dev_inst *sdi)
 {
-
        (void)sdi;
 
        switch (info_id) {
@@ -231,14 +225,7 @@ static int hw_info_get(int info_id, const void **data,
        case SR_DI_HWCAPS:
                *data = hwcaps;
                break;
-       case SR_DI_NUM_PROBES:
-               *data = GINT_TO_POINTER(1);
-               break;
-       case SR_DI_PROBE_NAMES:
-               *data = probe_names;
-               break;
        default:
-               sr_err("Unknown info_id: %d.", info_id);
                return SR_ERR_ARG;
        }
 
@@ -317,12 +304,20 @@ static int lascar_proc_config(const struct sr_dev_inst *sdi)
        ret = SR_OK;
        switch (devc->profile->logformat) {
        case LOG_TEMP_RH:
-               /* TODO */
+               devc->sample_size = 2;
+               devc->temp_unit = devc->config[0x2e] | (devc->config[0x2f] << 8);
+               if (devc->temp_unit != 0 && devc->temp_unit != 1) {
+                       sr_dbg("invalid temperature unit %d", devc->temp_unit);
+                       /* Default to Celcius, we're all adults here. */
+                       devc->temp_unit = 0;
+               } else
+                       sr_dbg("temperature unit is %s", devc->temp_unit
+                                       ? "Fahrenheit" : "Celcius");
                break;
        case LOG_CO:
                devc->sample_size = 2;
-               devc->co_high = binary32_le_to_float(devc->config + 36);
-               devc->co_low = binary32_le_to_float(devc->config + 40);
+               devc->co_high = binary32_le_to_float(devc->config + 0x24);
+               devc->co_low = binary32_le_to_float(devc->config + 0x28);
                sr_dbg("EL-USB-CO calibration high %f low %f", devc->co_high,
                                devc->co_low);
                break;