From: Bert Vermeulen Date: Fri, 13 Jul 2012 00:08:27 +0000 (+0200) Subject: sr: deprecate driver API call hwcap_get_all() X-Git-Tag: dsupstream~831 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=be34a1c74688351fdeb7482fda28f49aa762a831;p=libsigrok.git sr: deprecate driver API call hwcap_get_all() This is now handled with a call to info_get(SR_DI_HWCAPS). This brings it in line with the new driver opts: info_get(SR_DI_HWOPTS). --- diff --git a/device.c b/device.c index d32b4e95..fb8d60b2 100644 --- a/device.c +++ b/device.c @@ -397,7 +397,8 @@ SR_API gboolean sr_dev_has_hwcap(const struct sr_dev *dev, int hwcap) /* TODO: Sanity check on 'hwcap'. */ - if (!(hwcaps = dev->driver->hwcap_get_all())) { + if (dev->driver->info_get(SR_DI_HWCAPS, + (const void **)&hwcaps, NULL) != SR_OK) { sr_err("dev: %s: dev has no capabilities", __func__); return FALSE; } diff --git a/hwdriver.c b/hwdriver.c index b96e0b75..7effb6aa 100644 --- a/hwdriver.c +++ b/hwdriver.c @@ -338,10 +338,8 @@ SR_API gboolean sr_driver_hwcap_exists(struct sr_dev_driver *driver, int hwcap) return FALSE; } - if (!(hwcaps = driver->hwcap_get_all())) { - sr_err("hwdriver: %s: hwcap_get_all() returned NULL", __func__); + if (driver->info_get(SR_DI_HWCAPS, (const void **)&hwcaps, NULL) != SR_OK) return FALSE; - } for (i = 0; hwcaps[i]; i++) { if (hwcaps[i] == hwcap) diff --git a/libsigrok.h b/libsigrok.h index a3cb4ce4..641ca912 100644 --- a/libsigrok.h +++ b/libsigrok.h @@ -436,7 +436,12 @@ enum { /* Device info IDs */ enum { /* struct sr_dev_inst for this specific device */ + /* TODO: obsolete */ SR_DI_INST, + /* A list of options supported by the driver. */ + SR_DI_HWOPTS, + /* A list of capabilities supported by the device. */ + SR_DI_HWCAPS, /* The number of probes connected to this device */ SR_DI_NUM_PROBES, /* The probe names on this device */ @@ -492,7 +497,6 @@ struct sr_dev_driver { int (*info_get) (int dev_info_id, const void **data, const struct sr_dev_inst *sdi); int (*dev_status_get) (int dev_index); - const int *(*hwcap_get_all) (void); int (*dev_config_set) (int dev_index, int hwcap, const void *value); int (*dev_acquisition_start) (int dev_index, void *session_dev_id); int (*dev_acquisition_stop) (int dev_index, void *session_dev_id);