*/
SR_API char *sr_voltage_string(struct sr_rational *voltage)
{
- char *o;
int r;
+ char *o;
if (!(o = g_try_malloc0(30 + 1))) {
sr_err("%s: o malloc failed", __func__);
else if (voltage->q == 1)
r = snprintf(o, 30, "%" PRIu64 "V", voltage->p);
else
- r = -1;
+ r = snprintf(o, 30, "%gV", (float)voltage->p / (float)voltage->q);
if (r < 0) {
/* Something went wrong... */
return NULL;
}
- if (sdi->driver->info_get(SR_DI_TRIGGER_TYPES,
+ if (sdi->driver->config_list(SR_CONF_TRIGGER_TYPE,
(const void **)&trigger_types, sdi) != SR_OK) {
sr_err("%s: Device doesn't support any triggers.", __func__);
return NULL;