X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Flascar-el-usb%2Fapi.c;h=3ae8ba5315523236692563caabb72a31aea639a9;hb=df92e5cf6b1caad0d1d43eb890d84af1ef79cd18;hp=68a06eb1513f33300b5e8895d8f89bdeefd8f8e9;hpb=6aa1eb4ea33e1aeeef772cd234f140464eea3fe2;p=libsigrok.git diff --git a/hardware/lascar-el-usb/api.c b/hardware/lascar-el-usb/api.c index 68a06eb1..3ae8ba53 100644 --- a/hardware/lascar-el-usb/api.c +++ b/hardware/lascar-el-usb/api.c @@ -42,9 +42,9 @@ static const int hwcaps[] = { static const char *probe_names[] = { "P1", + NULL, }; - /* Properly close and free all devices. */ static int clear_instances(void) { @@ -317,12 +317,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;