]> sigrok.org Git - libsigrok.git/commitdiff
sr/cli/gtk/qt: s/device/dev/ in many places.
authorUwe Hermann <redacted>
Fri, 17 Feb 2012 21:25:01 +0000 (22:25 +0100)
committerUwe Hermann <redacted>
Fri, 17 Feb 2012 22:47:00 +0000 (23:47 +0100)
Also, a few s/instance/inst/ occurences.

29 files changed:
device.c
hardware/alsa/alsa.c
hardware/asix-sigma/asix-sigma.c
hardware/chronovu-la8/chronovu-la8.c
hardware/demo/demo.c
hardware/link-mso19/link-mso19.c
hardware/openbench-logic-sniffer/ols.c
hardware/openbench-logic-sniffer/ols.h
hardware/saleae-logic/saleae-logic.c
hardware/saleae-logic/saleae-logic.h
hardware/zeroplus-logic-cube/analyzer.c
hardware/zeroplus-logic-cube/zeroplus.c
hwplugin.c
input/binary.c
input/chronovu_la8.c
output/analog.c
output/chronovu_la8.c
output/csv.c
output/gnuplot.c
output/ols.c
output/text/text.c
output/vcd.c
session.c
session_driver.c
session_file.c
sigrok-internal.h
sigrok-proto.h
sigrok.h
strutil.c

index d806a113b1c9467be0d2451063e84f8bf124f639..cd9668ec033a3c035784f316ee9ad801d2101ba6 100644 (file)
--- a/device.c
+++ b/device.c
@@ -22,7 +22,7 @@
 #include "sigrok.h"
 #include "sigrok-internal.h"
 
-static GSList *devices = NULL;
+static GSList *devs = NULL;
 
 /**
  * Scan the system for attached logic analyzers / devices.
@@ -60,7 +60,7 @@ static GSList *devices = NULL;
 SR_API int sr_dev_scan(void)
 {
        GSList *plugins, *l;
-       struct sr_device_plugin *plugin;
+       struct sr_dev_plugin *plugin;
 
        if (!(plugins = sr_hw_list())) {
                sr_err("dev: %s: no supported devices/hwplugins", __func__);
@@ -93,10 +93,10 @@ SR_API int sr_dev_scan(void)
  */
 SR_API GSList *sr_dev_list(void)
 {
-       if (!devices)
+       if (!devs)
                sr_dev_scan();
 
-       return devices;
+       return devs;
 }
 
 /**
@@ -119,23 +119,23 @@ SR_API GSList *sr_dev_list(void)
  *
  * @return Pointer to the newly allocated device, or NULL upon errors.
  */
-SR_API struct sr_device *sr_dev_new(const struct sr_device_plugin *plugin,
-                                   int plugin_index)
+SR_API struct sr_dev *sr_dev_new(const struct sr_dev_plugin *plugin,
+                                int plugin_index)
 {
-       struct sr_device *device;
+       struct sr_dev *dev;
 
        /* TODO: Check if plugin_index valid? */
 
-       if (!(device = g_try_malloc0(sizeof(struct sr_device)))) {
-               sr_err("dev: %s: device malloc failed", __func__);
+       if (!(dev = g_try_malloc0(sizeof(struct sr_dev)))) {
+               sr_err("dev: %s: dev malloc failed", __func__);
                return NULL;
        }
 
-       device->plugin = (struct sr_device_plugin *)plugin;
-       device->plugin_index = plugin_index;
-       devices = g_slist_append(devices, device);
+       dev->plugin = (struct sr_dev_plugin *)plugin;
+       dev->plugin_index = plugin_index;
+       devs = g_slist_append(devs, dev);
 
-       return device;
+       return dev;
 }
 
 /**
@@ -151,22 +151,22 @@ SR_API struct sr_device *sr_dev_new(const struct sr_device_plugin *plugin,
  * TODO: Error if the max. probe number for the specific LA is reached, e.g.
  *       if the caller tries to add more probes than the device actually has.
  *
- * @param device The device to which to add a probe with the specified name.
- *               Must not be NULL.
+ * @param dev The device to which to add a probe with the specified name.
+ *            Must not be NULL.
  * @param name The name of the probe to add to this device. Must not be NULL.
  *             TODO: Maximum length, allowed characters, etc.
  *
  * @return SR_OK upon success, SR_ERR_MALLOC upon memory allocation errors,
  *         or SR_ERR_ARG upon invalid arguments.
- *         If something other than SR_OK is returned, 'device' is unchanged.
+ *         If something other than SR_OK is returned, 'dev' is unchanged.
  */
-SR_API int sr_dev_probe_add(struct sr_device *device, const char *name)
+SR_API int sr_dev_probe_add(struct sr_dev *dev, const char *name)
 {
        struct sr_probe *p;
        int probenum;
 
-       if (!device) {
-               sr_err("dev: %s: device was NULL", __func__);
+       if (!dev) {
+               sr_err("dev: %s: dev was NULL", __func__);
                return SR_ERR_ARG;
        }
 
@@ -177,7 +177,7 @@ SR_API int sr_dev_probe_add(struct sr_device *device, const char *name)
 
        /* TODO: Further checks to ensure name is valid. */
 
-       probenum = g_slist_length(device->probes) + 1;
+       probenum = g_slist_length(dev->probes) + 1;
 
        if (!(p = g_try_malloc0(sizeof(struct sr_probe)))) {
                sr_err("dev: %s: p malloc failed", __func__);
@@ -188,7 +188,7 @@ SR_API int sr_dev_probe_add(struct sr_device *device, const char *name)
        p->enabled = TRUE;
        p->name = g_strdup(name);
        p->trigger = NULL;
-       device->probes = g_slist_append(device->probes, p);
+       dev->probes = g_slist_append(dev->probes, p);
 
        return SR_OK;
 }
@@ -198,7 +198,7 @@ SR_API int sr_dev_probe_add(struct sr_device *device, const char *name)
  *
  * TODO
  *
- * @param device TODO. Must not be NULL.
+ * @param dev TODO. Must not be NULL.
  * @param probenum The number of the probe whose 'struct sr_probe' we want.
  *                 Note that the probe numbers start at 1 (not 0!).
  *
@@ -208,21 +208,21 @@ SR_API int sr_dev_probe_add(struct sr_device *device, const char *name)
  * @return A pointer to the requested probe's 'struct sr_probe', or NULL
  *         if the probe could not be found.
  */
-SR_API struct sr_probe *sr_dev_probe_find(const struct sr_device *device,
-                                            int probenum)
+SR_API struct sr_probe *sr_dev_probe_find(const struct sr_dev *dev,
+                                         int probenum)
 {
        GSList *l;
        struct sr_probe *p, *found_probe;
 
-       if (!device) {
-               sr_err("dev: %s: device was NULL", __func__);
+       if (!dev) {
+               sr_err("dev: %s: dev was NULL", __func__);
                return NULL; /* TODO: SR_ERR_ARG */
        }
 
        /* TODO: Sanity check on probenum. */
 
        found_probe = NULL;
-       for (l = device->probes; l; l = l->next) {
+       for (l = dev->probes; l; l = l->next) {
                p = l->data;
                /* TODO: Check for p != NULL. */
                if (p->index == probenum) {
@@ -240,28 +240,28 @@ SR_API struct sr_probe *sr_dev_probe_find(const struct sr_device *device,
  * If the probe already has a different name assigned to it, it will be
  * removed, and the new name will be saved instead.
  *
- * TODO: Rename to sr_device_set_probe_name().
+ * TODO: Rename to sr_dev_probe_name_set().
  *
- * @param device TODO
+ * @param dev TODO
  * @param probenum The number of the probe whose name to set.
  *                 Note that the probe numbers start at 1 (not 0!).
  * @param name The new name that the specified probe should get.
  *
  * @return SR_OK upon success, SR_ERR_ARG upon invalid arguments, or SR_ERR
  *         upon other errors.
- *         If something other than SR_OK is returned, 'device' is unchanged.
+ *         If something other than SR_OK is returned, 'dev' is unchanged.
  */
-SR_API int sr_dev_probe_name(struct sr_device *device, int probenum,
-                               const char *name)
+SR_API int sr_dev_probe_name(struct sr_dev *dev, int probenum,
+                            const char *name)
 {
        struct sr_probe *p;
 
-       if (!device) {
-               sr_err("dev: %s: device was NULL", __func__);
+       if (!dev) {
+               sr_err("dev: %s: dev was NULL", __func__);
                return SR_ERR_ARG;
        }
 
-       p = sr_dev_probe_find(device, probenum);
+       p = sr_dev_probe_find(dev, probenum);
        if (!p) {
                sr_err("dev: %s: probe %d not found", __func__, probenum);
                return SR_ERR; /* TODO: More specific error? */
@@ -282,28 +282,28 @@ SR_API int sr_dev_probe_name(struct sr_device *device, int probenum,
  *
  * TODO: Better description.
  *
- * @param device TODO
+ * @param dev TODO
  *
  * @return SR_OK upon success, SR_ERR_ARG upon invalid arguments.
- *         If something other than SR_OK is returned, 'device' is unchanged.
+ *         If something other than SR_OK is returned, 'dev' is unchanged.
  */
-SR_API int sr_dev_trigger_clear(struct sr_device *device)
+SR_API int sr_dev_trigger_clear(struct sr_dev *dev)
 {
        struct sr_probe *p;
        unsigned int pnum; /* TODO: uint16_t? */
 
-       if (!device) {
-               sr_err("dev: %s: device was NULL", __func__);
+       if (!dev) {
+               sr_err("dev: %s: dev was NULL", __func__);
                return SR_ERR_ARG;
        }
 
-       if (!device->probes) {
-               sr_err("dev: %s: device->probes was NULL", __func__);
+       if (!dev->probes) {
+               sr_err("dev: %s: dev->probes was NULL", __func__);
                return SR_ERR_ARG;
        }
 
-       for (pnum = 1; pnum <= g_slist_length(device->probes); pnum++) {
-               p = sr_dev_probe_find(device, pnum);
+       for (pnum = 1; pnum <= g_slist_length(dev->probes); pnum++) {
+               p = sr_dev_probe_find(dev, pnum);
                /* TODO: Silently ignore probes which cannot be found? */
                if (p) {
                        g_free(p->trigger);
@@ -320,7 +320,7 @@ SR_API int sr_dev_trigger_clear(struct sr_device *device)
  * TODO: Better description.
  * TODO: Describe valid format of the 'trigger' string.
  *
- * @param device TODO. Must not be NULL.
+ * @param dev TODO. Must not be NULL.
  * @param probenum The number of the probe. TODO.
  *                 Note that the probe numbers start at 1 (not 0!).
  * @param trigger TODO.
@@ -328,15 +328,15 @@ SR_API int sr_dev_trigger_clear(struct sr_device *device)
  *
  * @return SR_OK upon success, SR_ERR_ARG upon invalid arguments, or SR_ERR
  *         upon other errors.
- *         If something other than SR_OK is returned, 'device' is unchanged.
+ *         If something other than SR_OK is returned, 'dev' is unchanged.
  */
-SR_API int sr_dev_trigger_set(struct sr_device *device, int probenum,
-                                const char *trigger)
+SR_API int sr_dev_trigger_set(struct sr_dev *dev, int probenum,
+                             const char *trigger)
 {
        struct sr_probe *p;
 
-       if (!device) {
-               sr_err("dev: %s: device was NULL", __func__);
+       if (!dev) {
+               sr_err("dev: %s: dev was NULL", __func__);
                return SR_ERR_ARG;
        }
 
@@ -344,7 +344,7 @@ SR_API int sr_dev_trigger_set(struct sr_device *device, int probenum,
 
        /* TODO: Sanity check on 'trigger'. */
 
-       p = sr_dev_probe_find(device, probenum);
+       p = sr_dev_probe_find(dev, probenum);
        if (!p) {
                sr_err("dev: %s: probe %d not found", __func__, probenum);
                return SR_ERR; /* TODO: More specific error? */
@@ -363,8 +363,8 @@ SR_API int sr_dev_trigger_set(struct sr_device *device, int probenum,
  *
  * TODO: Should return int?
  *
- * @param device Pointer to the device to be checked. Must not be NULL.
- *               The device's 'plugin' field must not be NULL either.
+ * @param dev Pointer to the device to be checked. Must not be NULL.
+ *            The device's 'plugin' field must not be NULL either.
  * @param hwcap The capability that should be checked (whether it's supported
  *              by the specified device).
  *
@@ -372,24 +372,24 @@ SR_API int sr_dev_trigger_set(struct sr_device *device, int probenum,
  *         FALSE is also returned upon invalid input parameters or other
  *         error conditions.
  */
-SR_API gboolean sr_dev_has_hwcap(const struct sr_device *device, int hwcap)
+SR_API gboolean sr_dev_has_hwcap(const struct sr_dev *dev, int hwcap)
 {
        int *capabilities, i;
 
-       if (!device) {
-               sr_err("dev: %s: device was NULL", __func__);
+       if (!dev) {
+               sr_err("dev: %s: dev was NULL", __func__);
                return FALSE; /* TODO: SR_ERR_ARG. */
        }
 
-       if (!device->plugin) {
-               sr_err("dev: %s: device->plugin was NULL", __func__);
+       if (!dev->plugin) {
+               sr_err("dev: %s: dev->plugin was NULL", __func__);
                return FALSE; /* TODO: SR_ERR_ARG. */
        }
 
        /* TODO: Sanity check on 'hwcap'. */
 
-       if (!(capabilities = device->plugin->get_capabilities())) {
-               sr_err("dev: %s: device has no capabilities", __func__);
+       if (!(capabilities = dev->plugin->get_capabilities())) {
+               sr_err("dev: %s: dev has no capabilities", __func__);
                return FALSE; /* TODO: SR_ERR*. */
        }
 
@@ -408,24 +408,23 @@ SR_API gboolean sr_dev_has_hwcap(const struct sr_device *device, int hwcap)
 /**
  * Returns information about the given device.
  *
- * @param device Pointer to the device to be checked. Must not be NULL.
- *               The device's 'plugin' field must not be NULL either.
+ * @param dev Pointer to the device to be checked. Must not be NULL.
+ *            The device's 'plugin' field must not be NULL either.
  * @param id The type of information.
  * @param data The return value. Must not be NULL.
  *
  * @return SR_OK upon success, SR_ERR_ARG upon invalid arguments, or SR_ERR
  *         upon other errors.
  */
-SR_API int sr_dev_info_get(const struct sr_device *device, int id,
-                                          const void **data)
+SR_API int sr_dev_info_get(const struct sr_dev *dev, int id, const void **data)
 {
-       if ((device == NULL) || (device->plugin == NULL))
+       if ((dev == NULL) || (dev->plugin == NULL))
                return SR_ERR_ARG;
 
        if (data == NULL)
                return SR_ERR_ARG;
 
-       *data = device->plugin->get_device_info(device->plugin_index, id);
+       *data = dev->plugin->get_dev_info(dev->plugin_index, id);
 
        if (*data == NULL)
                return SR_ERR;
index 5842fdb874b7a7fa4937eec1036e861a44ff280f..f730f8c80c98659ff3aa888457bf9c0250149ca9 100644 (file)
@@ -64,13 +64,13 @@ struct alsa {
        gpointer session_id;
 };
 
-static int hw_init(const char *deviceinfo)
+static int hw_init(const char *devinfo)
 {
        struct sr_dev_inst *sdi;
        struct alsa *alsa;
 
        /* Avoid compiler warnings. */
-       deviceinfo = deviceinfo;
+       devinfo = devinfo;
 
        if (!(alsa = g_try_malloc0(sizeof(struct alsa)))) {
                sr_err("alsa: %s: alsa malloc failed", __func__);
@@ -91,13 +91,13 @@ free_alsa:
        return 0;
 }
 
-static int hw_opendev(int device_index)
+static int hw_opendev(int dev_index)
 {
        struct sr_dev_inst *sdi;
        struct alsa *alsa;
        int err;
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index)))
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index)))
                return SR_ERR;
        alsa = sdi->priv;
 
@@ -126,12 +126,12 @@ static int hw_opendev(int device_index)
        return SR_OK;
 }
 
-static int hw_closedev(int device_index)
+static int hw_closedev(int dev_index)
 {
        struct sr_dev_inst *sdi;
        struct alsa *alsa;
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index))) {
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) {
                sr_err("alsa: %s: sdi was NULL", __func__);
                return SR_ERR; /* TODO: SR_ERR_ARG? */
        }
@@ -164,17 +164,17 @@ static int hw_cleanup(void)
        return SR_OK;
 }
 
-static void *hw_get_device_info(int device_index, int device_info_id)
+static void *hw_get_dev_info(int dev_index, int dev_info_id)
 {
        struct sr_dev_inst *sdi;
        struct alsa *alsa;
        void *info = NULL;
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index)))
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index)))
                return NULL;
        alsa = sdi->priv;
 
-       switch (device_info_id) {
+       switch (dev_info_id) {
        case SR_DI_INSTANCE:
                info = sdi;
                break;
@@ -195,10 +195,10 @@ static void *hw_get_device_info(int device_index, int device_info_id)
        return info;
 }
 
-static int hw_get_status(int device_index)
+static int hw_get_status(int dev_index)
 {
        /* Avoid compiler warnings. */
-       device_index = device_index;
+       dev_index = dev_index;
 
        return SR_ST_ACTIVE;
 }
@@ -208,12 +208,12 @@ static int *hw_get_capabilities(void)
        return capabilities;
 }
 
-static int hw_set_configuration(int device_index, int capability, void *value)
+static int hw_set_configuration(int dev_index, int capability, void *value)
 {
        struct sr_dev_inst *sdi;
        struct alsa *alsa;
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index)))
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index)))
                return SR_ERR;
        alsa = sdi->priv;
 
@@ -289,7 +289,7 @@ static int receive_data(int fd, int revents, void *user_data)
        return TRUE;
 }
 
-static int hw_start_acquisition(int device_index, gpointer session_device_id)
+static int hw_start_acquisition(int dev_index, gpointer session_dev_id)
 {
        struct sr_dev_inst *sdi;
        struct alsa *alsa;
@@ -299,7 +299,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
        int count;
        int err;
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index)))
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index)))
                return SR_ERR;
        alsa = sdi->priv;
 
@@ -364,7 +364,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
                return SR_ERR;
        }
 
-       alsa->session_id = session_device_id;
+       alsa->session_id = session_dev_id;
        sr_source_add(ufds[0].fd, ufds[0].events, 10, receive_data, sdi);
 
        packet.type = SR_DF_HEADER;
@@ -376,22 +376,22 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
        header.num_analog_probes = NUM_PROBES;
        header.num_logic_probes = 0;
        header.protocol_id = SR_PROTO_RAW;
-       sr_session_bus(session_device_id, &packet);
+       sr_session_bus(session_dev_id, &packet);
        g_free(ufds);
 
        return SR_OK;
 }
 
-static int hw_stop_acquisition(int device_index, gpointer session_device_id)
+static int hw_stop_acquisition(int dev_index, gpointer session_dev_id)
 {
        /* Avoid compiler warnings. */
-       device_index = device_index;
-       session_device_id = session_device_id;
+       dev_index = dev_index;
+       session_dev_id = session_dev_id;
 
        return SR_OK;
 }
 
-SR_PRIV struct sr_device_plugin alsa_plugin_info = {
+SR_PRIV struct sr_dev_plugin alsa_plugin_info = {
        .name = "alsa",
        .longname = "ALSA driver",
        .api_version = 1,
@@ -399,7 +399,7 @@ SR_PRIV struct sr_device_plugin alsa_plugin_info = {
        .cleanup = hw_cleanup,
        .opendev = hw_opendev,
        .closedev = hw_closedev,
-       .get_device_info = hw_get_device_info,
+       .get_dev_info = hw_get_dev_info,
        .get_status = hw_get_status,
        .get_capabilities = hw_get_capabilities,
        .set_configuration = hw_set_configuration,
index 9f85d5f7d9e90899c35cf1ba5e72ec4c70044862..a72a960b9c8f4bea7293b3fbbb0b059faed935a4 100644 (file)
@@ -118,7 +118,7 @@ static const char *firmware_files[] = {
        "asix-sigma-phasor.fw", /* Frequency counter */
 };
 
-static int hw_stop_acquisition(int device_index, gpointer session_data);
+static int hw_stop_acquisition(int dev_index, gpointer session_data);
 
 static int sigma_read(void *buf, size_t size, struct sigma *sigma)
 {
@@ -415,13 +415,13 @@ static int bin2bitbang(const char *filename,
        return SR_OK;
 }
 
-static int hw_init(const char *deviceinfo)
+static int hw_init(const char *devinfo)
 {
        struct sr_dev_inst *sdi;
        struct sigma *sigma;
 
        /* Avoid compiler warnings. */
-       (void)deviceinfo;
+       (void)devinfo;
 
        if (!(sigma = g_try_malloc(sizeof(struct sigma)))) {
                sr_err("sigma: %s: sigma malloc failed", __func__);
@@ -555,13 +555,13 @@ static int upload_firmware(int firmware_idx, struct sigma *sigma)
        return SR_OK;
 }
 
-static int hw_opendev(int device_index)
+static int hw_opendev(int dev_index)
 {
        struct sr_dev_inst *sdi;
        struct sigma *sigma;
        int ret;
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index)))
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index)))
                return SR_ERR;
 
        sigma = sdi->priv;
@@ -698,12 +698,12 @@ static int configure_probes(struct sr_dev_inst *sdi, GSList *probes)
        return SR_OK;
 }
 
-static int hw_closedev(int device_index)
+static int hw_closedev(int dev_index)
 {
        struct sr_dev_inst *sdi;
        struct sigma *sigma;
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index))) {
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) {
                sr_err("sigma: %s: sdi was NULL", __func__);
                return SR_ERR; /* TODO: SR_ERR_ARG? */
        }
@@ -744,20 +744,20 @@ static int hw_cleanup(void)
        return ret;
 }
 
-static void *hw_get_device_info(int device_index, int device_info_id)
+static void *hw_get_dev_info(int dev_index, int dev_info_id)
 {
        struct sr_dev_inst *sdi;
        struct sigma *sigma;
        void *info = NULL;
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index))) {
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) {
                sr_err("sigma: %s: sdi was NULL", __func__);
                return NULL;
        }
 
        sigma = sdi->priv;
 
-       switch (device_info_id) {
+       switch (dev_info_id) {
        case SR_DI_INSTANCE:
                info = sdi;
                break;
@@ -781,11 +781,11 @@ static void *hw_get_device_info(int device_index, int device_info_id)
        return info;
 }
 
-static int hw_get_status(int device_index)
+static int hw_get_status(int dev_index)
 {
        struct sr_dev_inst *sdi;
 
-       sdi = sr_dev_inst_get(dev_insts, device_index);
+       sdi = sr_dev_inst_get(dev_insts, dev_index);
        if (sdi)
                return sdi->status;
        else
@@ -797,13 +797,13 @@ static int *hw_get_capabilities(void)
        return capabilities;
 }
 
-static int hw_set_configuration(int device_index, int capability, void *value)
+static int hw_set_configuration(int dev_index, int capability, void *value)
 {
        struct sr_dev_inst *sdi;
        struct sigma *sigma;
        int ret;
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index)))
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index)))
                return SR_ERR;
 
        sigma = sdi->priv;
@@ -1252,7 +1252,7 @@ static int build_basic_trigger(struct triggerlut *lut, struct sigma *sigma)
        return SR_OK;
 }
 
-static int hw_start_acquisition(int device_index, gpointer session_data)
+static int hw_start_acquisition(int dev_index, gpointer session_data)
 {
        struct sr_dev_inst *sdi;
        struct sigma *sigma;
@@ -1267,7 +1267,7 @@ static int hw_start_acquisition(int device_index, gpointer session_data)
        /* Avoid compiler warnings. */
        (void)session_data;
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index)))
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index)))
                return SR_ERR;
 
        sigma = sdi->priv;
@@ -1369,7 +1369,7 @@ static int hw_start_acquisition(int device_index, gpointer session_data)
        return SR_OK;
 }
 
-static int hw_stop_acquisition(int device_index, gpointer session_data)
+static int hw_stop_acquisition(int dev_index, gpointer session_data)
 {
        struct sr_dev_inst *sdi;
        struct sigma *sigma;
@@ -1378,7 +1378,7 @@ static int hw_stop_acquisition(int device_index, gpointer session_data)
        /* Avoid compiler warnings. */
        (void)session_data;
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index))) {
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) {
                sr_err("sigma: %s: sdi was NULL", __func__);
                return SR_ERR_BUG;
        }
@@ -1411,7 +1411,7 @@ static int hw_stop_acquisition(int device_index, gpointer session_data)
        return SR_OK;
 }
 
-SR_PRIV struct sr_device_plugin asix_sigma_plugin_info = {
+SR_PRIV struct sr_dev_plugin asix_sigma_plugin_info = {
        .name = "asix-sigma",
        .longname = "ASIX SIGMA",
        .api_version = 1,
@@ -1419,7 +1419,7 @@ SR_PRIV struct sr_device_plugin asix_sigma_plugin_info = {
        .cleanup = hw_cleanup,
        .opendev = hw_opendev,
        .closedev = hw_closedev,
-       .get_device_info = hw_get_device_info,
+       .get_dev_info = hw_get_dev_info,
        .get_status = hw_get_status,
        .get_capabilities = hw_get_capabilities,
        .set_configuration = hw_set_configuration,
index 22164cfe8693a5b676fad91ea5a9f3ada3cfb088..44ec79d4fc0ab71abdd6dafab389d1afe8aeae1a 100644 (file)
@@ -111,7 +111,7 @@ struct la8 {
        uint8_t divcount;
 };
 
-/* This will be initialized via hw_get_device_info()/SR_DI_SAMPLERATES. */
+/* This will be initialized via hw_get_dev_info()/SR_DI_SAMPLERATES. */
 static uint64_t supported_samplerates[255 + 1] = { 0 };
 
 /*
@@ -136,7 +136,7 @@ static int capabilities[] = {
 
 /* Function prototypes. */
 static int la8_close_usb_reset_sequencer(struct la8 *la8);
-static int hw_stop_acquisition(int device_index, gpointer session_data);
+static int hw_stop_acquisition(int dev_index, gpointer session_data);
 static int la8_reset(struct la8 *la8);
 
 static void fill_supported_samplerates_if_needed(void)
@@ -467,14 +467,14 @@ static int configure_probes(struct la8 *la8, GSList *probes)
        return SR_OK;
 }
 
-static int hw_init(const char *deviceinfo)
+static int hw_init(const char *devinfo)
 {
        int ret;
        struct sr_dev_inst *sdi;
        struct la8 *la8;
 
        /* Avoid compiler errors. */
-       (void)deviceinfo;
+       (void)devinfo;
 
        /* Allocate memory for our private driver context. */
        if (!(la8 = g_try_malloc(sizeof(struct la8)))) {
@@ -550,13 +550,13 @@ err_free_nothing:
        return 0;
 }
 
-static int hw_opendev(int device_index)
+static int hw_opendev(int dev_index)
 {
        int ret;
        struct sr_dev_inst *sdi;
        struct la8 *la8;
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index))) {
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) {
                sr_err("la8: %s: sdi was NULL", __func__);
                return SR_ERR; /* TODO: SR_ERR_ARG? */
        }
@@ -638,12 +638,12 @@ static int set_samplerate(struct sr_dev_inst *sdi, uint64_t samplerate)
        return SR_OK;
 }
 
-static int hw_closedev(int device_index)
+static int hw_closedev(int dev_index)
 {
        struct sr_dev_inst *sdi;
        struct la8 *la8;
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index))) {
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) {
                sr_err("la8: %s: sdi was NULL", __func__);
                return SR_ERR; /* TODO: SR_ERR_ARG? */
        }
@@ -693,7 +693,7 @@ static int hw_cleanup(void)
        return ret;
 }
 
-static void *hw_get_device_info(int device_index, int device_info_id)
+static void *hw_get_dev_info(int dev_index, int dev_info_id)
 {
        struct sr_dev_inst *sdi;
        struct la8 *la8;
@@ -701,7 +701,7 @@ static void *hw_get_device_info(int device_index, int device_info_id)
 
        sr_spew("la8: entering %s", __func__);
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index))) {
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) {
                sr_err("la8: %s: sdi was NULL", __func__);
                return NULL;
        }
@@ -711,7 +711,7 @@ static void *hw_get_device_info(int device_index, int device_info_id)
                return NULL;
        }
 
-       switch (device_info_id) {
+       switch (dev_info_id) {
        case SR_DI_INSTANCE:
                info = sdi;
                break;
@@ -741,11 +741,11 @@ static void *hw_get_device_info(int device_index, int device_info_id)
        return info;
 }
 
-static int hw_get_status(int device_index)
+static int hw_get_status(int dev_index)
 {
        struct sr_dev_inst *sdi;
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index))) {
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) {
                sr_err("la8: %s: sdi was NULL, device not found", __func__);
                return SR_ST_NOT_FOUND;
        }
@@ -762,14 +762,14 @@ static int *hw_get_capabilities(void)
        return capabilities;
 }
 
-static int hw_set_configuration(int device_index, int capability, void *value)
+static int hw_set_configuration(int dev_index, int capability, void *value)
 {
        struct sr_dev_inst *sdi;
        struct la8 *la8;
 
        sr_spew("la8: entering %s", __func__);
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index))) {
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) {
                sr_err("la8: %s: sdi was NULL", __func__);
                return SR_ERR; /* TODO: SR_ERR_ARG? */
        }
@@ -1012,7 +1012,7 @@ static int receive_data(int fd, int revents, void *session_data)
        return TRUE;
 }
 
-static int hw_start_acquisition(int device_index, gpointer session_data)
+static int hw_start_acquisition(int dev_index, gpointer session_data)
 {
        struct sr_dev_inst *sdi;
        struct la8 *la8;
@@ -1023,7 +1023,7 @@ static int hw_start_acquisition(int device_index, gpointer session_data)
 
        sr_spew("la8: entering %s", __func__);
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index))) {
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) {
                sr_err("la8: %s: sdi was NULL", __func__);
                return SR_ERR; /* TODO: SR_ERR_ARG? */
        }
@@ -1087,7 +1087,7 @@ static int hw_start_acquisition(int device_index, gpointer session_data)
        return SR_OK;
 }
 
-static int hw_stop_acquisition(int device_index, gpointer session_data)
+static int hw_stop_acquisition(int dev_index, gpointer session_data)
 {
        struct sr_dev_inst *sdi;
        struct la8 *la8;
@@ -1095,7 +1095,7 @@ static int hw_stop_acquisition(int device_index, gpointer session_data)
 
        sr_dbg("la8: stopping acquisition");
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index))) {
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) {
                sr_err("la8: %s: sdi was NULL", __func__);
                return SR_ERR_BUG;
        }
@@ -1113,7 +1113,7 @@ static int hw_stop_acquisition(int device_index, gpointer session_data)
        return SR_OK;
 }
 
-SR_PRIV struct sr_device_plugin chronovu_la8_plugin_info = {
+SR_PRIV struct sr_dev_plugin chronovu_la8_plugin_info = {
        .name = "chronovu-la8",
        .longname = "ChronoVu LA8",
        .api_version = 1,
@@ -1121,7 +1121,7 @@ SR_PRIV struct sr_device_plugin chronovu_la8_plugin_info = {
        .cleanup = hw_cleanup,
        .opendev = hw_opendev,
        .closedev = hw_closedev,
-       .get_device_info = hw_get_device_info,
+       .get_dev_info = hw_get_dev_info,
        .get_status = hw_get_status,
        .get_capabilities = hw_get_capabilities,
        .set_configuration = hw_set_configuration,
index d6e149de7fb86254f1c33c1c2c8d0ceb0f7c634c..0b0ccfa235841afbbebd3eb69944696ba52e5ffc 100644 (file)
@@ -71,14 +71,14 @@ struct databag {
        uint8_t sample_generator;
        uint8_t thread_running;
        uint64_t samples_counter;
-       int device_index;
+       int dev_index;
        gpointer session_data;
        GTimer *timer;
 };
 
 static int capabilities[] = {
        SR_HWCAP_LOGIC_ANALYZER,
-       SR_HWCAP_DEMO_DEVICE,
+       SR_HWCAP_DEMO_DEV,
        SR_HWCAP_SAMPLERATE,
        SR_HWCAP_PATTERN_MODE,
        SR_HWCAP_LIMIT_SAMPLES,
@@ -134,14 +134,14 @@ static int default_pattern = PATTERN_SIGROK;
 static GThread *my_thread;
 static int thread_running;
 
-static int hw_stop_acquisition(int device_index, gpointer session_data);
+static int hw_stop_acquisition(int dev_index, gpointer session_data);
 
-static int hw_init(const char *deviceinfo)
+static int hw_init(const char *devinfo)
 {
        struct sr_dev_inst *sdi;
 
        /* Avoid compiler warnings. */
-       (void)deviceinfo;
+       (void)devinfo;
 
        sdi = sr_dev_inst_new(0, SR_ST_ACTIVE, DEMONAME, NULL, NULL);
        if (!sdi) {
@@ -154,20 +154,20 @@ static int hw_init(const char *deviceinfo)
        return 1;
 }
 
-static int hw_opendev(int device_index)
+static int hw_opendev(int dev_index)
 {
        /* Avoid compiler warnings. */
-       (void)device_index;
+       (void)dev_index;
 
        /* Nothing needed so far. */
 
        return SR_OK;
 }
 
-static int hw_closedev(int device_index)
+static int hw_closedev(int dev_index)
 {
        /* Avoid compiler warnings. */
-       (void)device_index;
+       (void)dev_index;
 
        /* Nothing needed so far. */
 
@@ -180,17 +180,17 @@ static int hw_cleanup(void)
        return SR_OK;
 }
 
-static void *hw_get_device_info(int device_index, int device_info_id)
+static void *hw_get_dev_info(int dev_index, int dev_info_id)
 {
        struct sr_dev_inst *sdi;
        void *info = NULL;
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index))) {
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) {
                sr_err("demo: %s: sdi was NULL", __func__);
                return NULL;
        }
 
-       switch (device_info_id) {
+       switch (dev_info_id) {
        case SR_DI_INSTANCE:
                info = sdi;
                break;
@@ -214,10 +214,10 @@ static void *hw_get_device_info(int device_index, int device_info_id)
        return info;
 }
 
-static int hw_get_status(int device_index)
+static int hw_get_status(int dev_index)
 {
        /* Avoid compiler warnings. */
-       (void)device_index;
+       (void)dev_index;
 
        return SR_ST_ACTIVE;
 }
@@ -227,13 +227,13 @@ static int *hw_get_capabilities(void)
        return capabilities;
 }
 
-static int hw_set_configuration(int device_index, int capability, void *value)
+static int hw_set_configuration(int dev_index, int capability, void *value)
 {
        int ret;
        char *stropt;
 
        /* Avoid compiler warnings. */
-       (void)device_index;
+       (void)dev_index;
 
        if (capability == SR_HWCAP_PROBECONFIG) {
                /* Nothing to do, but must be supported */
@@ -405,7 +405,7 @@ static int receive_data(int fd, int revents, void *session_data)
        return TRUE;
 }
 
-static int hw_start_acquisition(int device_index, gpointer session_data)
+static int hw_start_acquisition(int dev_index, gpointer session_data)
 {
        struct sr_datafeed_packet *packet;
        struct sr_datafeed_header *header;
@@ -419,7 +419,7 @@ static int hw_start_acquisition(int device_index, gpointer session_data)
 
        mydata->sample_generator = default_pattern;
        mydata->session_data = session_data;
-       mydata->device_index = device_index;
+       mydata->dev_index = dev_index;
        mydata->samples_counter = 0;
 
        if (pipe(mydata->pipe_fds)) {
@@ -477,10 +477,10 @@ static int hw_start_acquisition(int device_index, gpointer session_data)
        return SR_OK;
 }
 
-static int hw_stop_acquisition(int device_index, gpointer session_data)
+static int hw_stop_acquisition(int dev_index, gpointer session_data)
 {
        /* Avoid compiler warnings. */
-       (void)device_index;
+       (void)dev_index;
        (void)session_data;
 
        /* Stop generate thread. */
@@ -489,7 +489,7 @@ static int hw_stop_acquisition(int device_index, gpointer session_data)
        return SR_OK;
 }
 
-SR_PRIV struct sr_device_plugin demo_plugin_info = {
+SR_PRIV struct sr_dev_plugin demo_plugin_info = {
        .name = "demo",
        .longname = "Demo driver and pattern generator",
        .api_version = 1,
@@ -497,7 +497,7 @@ SR_PRIV struct sr_device_plugin demo_plugin_info = {
        .cleanup = hw_cleanup,
        .opendev = hw_opendev,
        .closedev = hw_closedev,
-       .get_device_info = hw_get_device_info,
+       .get_dev_info = hw_get_dev_info,
        .get_status = hw_get_status,
        .get_capabilities = hw_get_capabilities,
        .set_configuration = hw_set_configuration,
index 5b4b4cffe7993ab8a708bad56dbad67a5f80d526..df08b1151a789c6a383097d863a021373bb75971 100644 (file)
@@ -396,16 +396,16 @@ static int mso_parse_serial(const char *iSerial, const char *iProduct,
        return SR_OK;
 }
 
-static int hw_init(const char *deviceinfo)
+static int hw_init(const char *devinfo)
 {
        struct sr_dev_inst *sdi;
        int devcnt = 0;
        struct udev *udev;
        struct udev_enumerate *enumerate;
-       struct udev_list_entry *devices, *dev_list_entry;
+       struct udev_list_entry *devs, *dev_list_entry;
        struct mso *mso;
 
-       deviceinfo = deviceinfo;
+       devinfo = devinfo;
 
        /* It's easier to map usb<->serial using udev */
        /*
@@ -420,8 +420,8 @@ static int hw_init(const char *deviceinfo)
        enumerate = udev_enumerate_new(udev);
        udev_enumerate_add_match_subsystem(enumerate, "usb-serial");
        udev_enumerate_scan_devices(enumerate);
-       devices = udev_enumerate_get_list_entry(enumerate);
-       udev_list_entry_foreach(dev_list_entry, devices) {
+       devs = udev_enumerate_get_list_entry(enumerate);
+       udev_list_entry_foreach(dev_list_entry, devs) {
                const char *syspath, *sysname, *idVendor, *idProduct,
                        *iSerial, *iProduct;
                char path[32], manufacturer[32], product[32], hwrev[32];
@@ -540,13 +540,13 @@ static int hw_cleanup(void)
        return ret;
 }
 
-static int hw_opendev(int device_index)
+static int hw_opendev(int dev_index)
 {
        struct sr_dev_inst *sdi;
        struct mso *mso;
        int ret = SR_ERR;
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index)))
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index)))
                return ret;
 
        mso = sdi->priv;
@@ -582,11 +582,11 @@ static int hw_opendev(int device_index)
        return SR_OK;
 }
 
-static int hw_closedev(int device_index)
+static int hw_closedev(int dev_index)
 {
        struct sr_dev_inst *sdi;
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index))) {
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) {
                sr_err("mso19: %s: sdi was NULL", __func__);
                return SR_ERR; /* TODO: SR_ERR_ARG? */
        }
@@ -602,17 +602,17 @@ static int hw_closedev(int device_index)
        return SR_OK;
 }
 
-static void *hw_get_device_info(int device_index, int device_info_id)
+static void *hw_get_dev_info(int dev_index, int dev_info_id)
 {
        struct sr_dev_inst *sdi;
        struct mso *mso;
        void *info = NULL;
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index)))
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index)))
                return NULL;
        mso = sdi->priv;
 
-       switch (device_info_id) {
+       switch (dev_info_id) {
        case SR_DI_INSTANCE:
                info = sdi;
                break;
@@ -635,11 +635,11 @@ static void *hw_get_device_info(int device_index, int device_info_id)
        return info;
 }
 
-static int hw_get_status(int device_index)
+static int hw_get_status(int dev_index)
 {
        struct sr_dev_inst *sdi;
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index)))
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index)))
                return SR_ST_NOT_FOUND;
 
        return sdi->status;
@@ -650,11 +650,11 @@ static int *hw_get_capabilities(void)
        return capabilities;
 }
 
-static int hw_set_configuration(int device_index, int capability, void *value)
+static int hw_set_configuration(int dev_index, int capability, void *value)
 {
        struct sr_dev_inst *sdi;
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index)))
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index)))
                return SR_ERR;
 
        switch (capability) {
@@ -743,7 +743,7 @@ static int receive_data(int fd, int revents, void *user_data)
        return TRUE;
 }
 
-static int hw_start_acquisition(int device_index, gpointer session_device_id)
+static int hw_start_acquisition(int dev_index, gpointer session_dev_id)
 {
        struct sr_dev_inst *sdi;
        struct mso *mso;
@@ -751,7 +751,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
        struct sr_datafeed_header header;
        int ret = SR_ERR;
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index)))
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index)))
                return ret;
        mso = sdi->priv;
 
@@ -801,7 +801,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
        if (ret != SR_OK)
                return ret;
 
-       mso->session_id = session_device_id;
+       mso->session_id = session_dev_id;
        sr_source_add(sdi->serial->fd, G_IO_IN, -1, receive_data, sdi);
 
        packet.type = SR_DF_HEADER;
@@ -811,25 +811,25 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
        header.samplerate = mso->cur_rate;
        // header.num_analog_probes = 1;
        header.num_logic_probes = 8;
-       sr_session_bus(session_device_id, &packet);
+       sr_session_bus(session_dev_id, &packet);
 
        return ret;
 }
 
 /* FIXME */
-static int hw_stop_acquisition(int device_index, gpointer session_device_id)
+static int hw_stop_acquisition(int dev_index, gpointer session_dev_id)
 {
        struct sr_datafeed_packet packet;
 
-       device_index = device_index;
+       dev_index = dev_index;
 
        packet.type = SR_DF_END;
-       sr_session_bus(session_device_id, &packet);
+       sr_session_bus(session_dev_id, &packet);
 
        return SR_OK;
 }
 
-SR_PRIV struct sr_device_plugin link_mso19_plugin_info = {
+SR_PRIV struct sr_dev_plugin link_mso19_plugin_info = {
        .name = "link-mso19",
        .longname = "Link Instruments MSO-19",
        .api_version = 1,
@@ -837,7 +837,7 @@ SR_PRIV struct sr_device_plugin link_mso19_plugin_info = {
        .cleanup = hw_cleanup,
        .opendev = hw_opendev,
        .closedev = hw_closedev,
-       .get_device_info = hw_get_device_info,
+       .get_dev_info = hw_get_dev_info,
        .get_status = hw_get_status,
        .get_capabilities = hw_get_capabilities,
        .set_configuration = hw_set_configuration,
index 504cd51586ed99dbbe2c15843a4b4a6dc80fd882..971e032dc35ad654ee0ad0872bcdcfa80ed43fd0 100644 (file)
@@ -130,7 +130,7 @@ static int send_longcommand(int fd, uint8_t command, uint32_t data)
        return SR_OK;
 }
 
-static int configure_probes(struct ols_device *ols, GSList *probes)
+static int configure_probes(struct ols_dev *ols, GSList *probes)
 {
        struct sr_probe *probe;
        GSList *l;
@@ -204,12 +204,12 @@ static uint32_t reverse32(uint32_t in)
        return out;
 }
 
-static struct ols_device *ols_device_new(void)
+static struct ols_dev *ols_dev_new(void)
 {
-       struct ols_device *ols;
+       struct ols_dev *ols;
 
        /* TODO: Is 'ols' ever g_free()'d? */
-       if (!(ols = g_try_malloc0(sizeof(struct ols_device)))) {
+       if (!(ols = g_try_malloc0(sizeof(struct ols_dev)))) {
                sr_err("ols: %s: ols malloc failed", __func__);
                return NULL;
        }
@@ -225,17 +225,17 @@ static struct ols_device *ols_device_new(void)
 static struct sr_dev_inst *get_metadata(int fd)
 {
        struct sr_dev_inst *sdi;
-       struct ols_device *ols;
+       struct ols_dev *ols;
        uint32_t tmp_int;
        uint8_t key, type, token;
-       GString *tmp_str, *devicename, *version;
+       GString *tmp_str, *devname, *version;
        gchar tmp_c;
 
        sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, NULL, NULL, NULL);
-       ols = ols_device_new();
+       ols = ols_dev_new();
        sdi->priv = ols;
 
-       devicename = g_string_new("");
+       devname = g_string_new("");
        version = g_string_new("");
 
        key = 0xff;
@@ -255,7 +255,7 @@ static struct sr_dev_inst *get_metadata(int fd)
                        switch (token) {
                        case 0x01:
                                /* Device name */
-                               devicename = g_string_append(devicename, tmp_str->str);
+                               devname = g_string_append(devname, tmp_str->str);
                                break;
                        case 0x02:
                                /* FPGA firmware version */
@@ -339,27 +339,27 @@ static struct sr_dev_inst *get_metadata(int fd)
                }
        }
 
-       sdi->model = devicename->str;
+       sdi->model = devname->str;
        sdi->version = version->str;
-       g_string_free(devicename, FALSE);
+       g_string_free(devname, FALSE);
        g_string_free(version, FALSE);
 
        return sdi;
 }
 
-static int hw_init(const char *deviceinfo)
+static int hw_init(const char *devinfo)
 {
        struct sr_dev_inst *sdi;
-       struct ols_device *ols;
+       struct ols_dev *ols;
        GSList *ports, *l;
        GPollFD *fds, probefd;
        int devcnt, final_devcnt, num_ports, fd, ret, i;
-       char buf[8], **device_names, **serial_params;
+       char buf[8], **dev_names, **serial_params;
 
        final_devcnt = 0;
 
-       if (deviceinfo)
-               ports = g_slist_append(NULL, g_strdup(deviceinfo));
+       if (devinfo)
+               ports = g_slist_append(NULL, g_strdup(devinfo));
        else
                /* No specific device given, so scan all serial ports. */
                ports = list_serial_ports();
@@ -371,14 +371,14 @@ static int hw_init(const char *deviceinfo)
                goto hw_init_free_ports; /* TODO: SR_ERR_MALLOC. */
        }
 
-       if (!(device_names = g_try_malloc(num_ports * sizeof(char *)))) {
-               sr_err("ols: %s: device_names malloc failed", __func__);
+       if (!(dev_names = g_try_malloc(num_ports * sizeof(char *)))) {
+               sr_err("ols: %s: dev_names malloc failed", __func__);
                goto hw_init_free_fds; /* TODO: SR_ERR_MALLOC. */
        }
 
        if (!(serial_params = g_try_malloc(num_ports * sizeof(char *)))) {
                sr_err("ols: %s: serial_params malloc failed", __func__);
-               goto hw_init_free_device_names; /* TODO: SR_ERR_MALLOC. */
+               goto hw_init_free_dev_names; /* TODO: SR_ERR_MALLOC. */
        }
 
        devcnt = 0;
@@ -415,7 +415,7 @@ static int hw_init(const char *deviceinfo)
                        send_shortcommand(fd, CMD_ID);
                        fds[devcnt].fd = fd;
                        fds[devcnt].events = G_IO_IN;
-                       device_names[devcnt] = g_strdup(l->data);
+                       dev_names[devcnt] = g_strdup(l->data);
                        devcnt++;
                }
                g_free(l->data);
@@ -448,11 +448,11 @@ static int hw_init(const char *deviceinfo)
                        /* not an OLS -- some other board that uses the sump protocol */
                        sdi = sr_dev_inst_new(final_devcnt, SR_ST_INACTIVE,
                                        "Sump", "Logic Analyzer", "v1.0");
-                       ols = ols_device_new();
+                       ols = ols_dev_new();
                        ols->num_probes = 32;
                        sdi->priv = ols;
                }
-               ols->serial = sr_serial_dev_inst_new(device_names[i], -1);
+               ols->serial = sr_serial_dev_inst_new(dev_names[i], -1);
                dev_insts = g_slist_append(dev_insts, sdi);
                final_devcnt++;
                serial_close(fds[i].fd);
@@ -466,12 +466,12 @@ static int hw_init(const char *deviceinfo)
                        serial_close(fds[i].fd);
                }
                g_free(serial_params[i]);
-               g_free(device_names[i]);
+               g_free(dev_names[i]);
        }
 
        g_free(serial_params);
-hw_init_free_device_names:
-       g_free(device_names);
+hw_init_free_dev_names:
+       g_free(dev_names);
 hw_init_free_fds:
        g_free(fds);
 hw_init_free_ports:
@@ -480,12 +480,12 @@ hw_init_free_ports:
        return final_devcnt;
 }
 
-static int hw_opendev(int device_index)
+static int hw_opendev(int dev_index)
 {
        struct sr_dev_inst *sdi;
-       struct ols_device *ols;
+       struct ols_dev *ols;
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index)))
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index)))
                return SR_ERR;
 
        ols = sdi->priv;
@@ -499,12 +499,12 @@ static int hw_opendev(int device_index)
        return SR_OK;
 }
 
-static int hw_closedev(int device_index)
+static int hw_closedev(int dev_index)
 {
        struct sr_dev_inst *sdi;
-       struct ols_device *ols;
+       struct ols_dev *ols;
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index))) {
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) {
                sr_err("ols: %s: sdi was NULL", __func__);
                return SR_ERR; /* TODO: SR_ERR_ARG? */
        }
@@ -525,7 +525,7 @@ static int hw_cleanup(void)
 {
        GSList *l;
        struct sr_dev_inst *sdi;
-       struct ols_device *ols;
+       struct ols_dev *ols;
        int ret = SR_OK;
 
        /* Properly close and free all devices. */
@@ -555,18 +555,18 @@ static int hw_cleanup(void)
        return ret;
 }
 
-static void *hw_get_device_info(int device_index, int device_info_id)
+static void *hw_get_dev_info(int dev_index, int dev_info_id)
 {
        struct sr_dev_inst *sdi;
-       struct ols_device *ols;
+       struct ols_dev *ols;
        void *info;
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index)))
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index)))
                return NULL;
        ols = sdi->priv;
 
        info = NULL;
-       switch (device_info_id) {
+       switch (dev_info_id) {
        case SR_DI_INSTANCE:
                info = sdi;
                break;
@@ -590,11 +590,11 @@ static void *hw_get_device_info(int device_index, int device_info_id)
        return info;
 }
 
-static int hw_get_status(int device_index)
+static int hw_get_status(int dev_index)
 {
        struct sr_dev_inst *sdi;
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index)))
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index)))
                return SR_ST_NOT_FOUND;
 
        return sdi->status;
@@ -608,7 +608,7 @@ static int *hw_get_capabilities(void)
 static int set_configuration_samplerate(struct sr_dev_inst *sdi,
                                        uint64_t samplerate)
 {
-       struct ols_device *ols;
+       struct ols_dev *ols;
 
        ols = sdi->priv;
        if (ols->max_samplerate) {
@@ -638,14 +638,14 @@ static int set_configuration_samplerate(struct sr_dev_inst *sdi,
        return SR_OK;
 }
 
-static int hw_set_configuration(int device_index, int capability, void *value)
+static int hw_set_configuration(int dev_index, int capability, void *value)
 {
        struct sr_dev_inst *sdi;
-       struct ols_device *ols;
+       struct ols_dev *ols;
        int ret;
        uint64_t *tmp_u64;
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index)))
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index)))
                return SR_ERR;
        ols = sdi->priv;
 
@@ -698,12 +698,12 @@ static int receive_data(int fd, int revents, void *session_data)
        struct sr_datafeed_packet packet;
        struct sr_datafeed_logic logic;
        struct sr_dev_inst *sdi;
-       struct ols_device *ols;
+       struct ols_dev *ols;
        GSList *l;
        int num_channels, offset, i, j;
        unsigned char byte;
 
-       /* find this device's ols_device struct by its fd */
+       /* find this device's ols_dev struct by its fd */
        ols = NULL;
        for (l = dev_insts; l; l = l->next) {
                sdi = l->data;
@@ -872,12 +872,12 @@ static int receive_data(int fd, int revents, void *session_data)
        return TRUE;
 }
 
-static int hw_start_acquisition(int device_index, gpointer session_data)
+static int hw_start_acquisition(int dev_index, gpointer session_data)
 {
        struct sr_datafeed_packet *packet;
        struct sr_datafeed_header *header;
        struct sr_dev_inst *sdi;
-       struct ols_device *ols;
+       struct ols_dev *ols;
        uint32_t trigger_config[4];
        uint32_t data;
        uint16_t readcount, delaycount;
@@ -885,7 +885,7 @@ static int hw_start_acquisition(int device_index, gpointer session_data)
        int num_channels;
        int i;
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index)))
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index)))
                return SR_ERR;
 
        ols = sdi->priv;
@@ -1025,20 +1025,20 @@ static int hw_start_acquisition(int device_index, gpointer session_data)
        return SR_OK;
 }
 
-static int hw_stop_acquisition(int device_index, gpointer session_device_id)
+static int hw_stop_acquisition(int dev_index, gpointer session_dev_id)
 {
        struct sr_datafeed_packet packet;
 
        /* Avoid compiler warnings. */
-       (void)device_index;
+       (void)dev_index;
 
        packet.type = SR_DF_END;
-       sr_session_bus(session_device_id, &packet);
+       sr_session_bus(session_dev_id, &packet);
 
        return SR_OK;
 }
 
-SR_PRIV struct sr_device_plugin ols_plugin_info = {
+SR_PRIV struct sr_dev_plugin ols_plugin_info = {
        .name = "ols",
        .longname = "Openbench Logic Sniffer",
        .api_version = 1,
@@ -1046,7 +1046,7 @@ SR_PRIV struct sr_device_plugin ols_plugin_info = {
        .cleanup = hw_cleanup,
        .opendev = hw_opendev,
        .closedev = hw_closedev,
-       .get_device_info = hw_get_device_info,
+       .get_dev_info = hw_get_dev_info,
        .get_status = hw_get_status,
        .get_capabilities = hw_get_capabilities,
        .set_configuration = hw_set_configuration,
index 923e3e75cc2193099cbe1ba12b9eba49d0139d2a..832413fd03cb88728e116e089af9b27968a4666f 100644 (file)
@@ -59,7 +59,7 @@
 #define FLAG_CLOCK_INVERTED        0x80
 #define FLAG_RLE                   0x0100
 
-struct ols_device {
+struct ols_dev {
        uint32_t max_samplerate;
        uint32_t max_samples;
        uint32_t protocol_version;
index a499191e598d5f7ff880a714ab7d7f34896ee6f1..6549473c3e2d70e8714f8b439be6581ccbdc49a5 100644 (file)
@@ -93,8 +93,8 @@ static libusb_context *usb_context = NULL;
 
 static int new_saleae_logic_firmware = 0;
 
-static int hw_set_configuration(int device_index, int capability, void *value);
-static int hw_stop_acquisition(int device_index, gpointer session_device_id);
+static int hw_set_configuration(int dev_index, int capability, void *value);
+static int hw_stop_acquisition(int dev_index, gpointer session_dev_id);
 
 /**
  * Check the USB configuration to determine if this is a Saleae Logic.
@@ -165,15 +165,15 @@ static int check_conf_profile(libusb_device *dev)
        return ret;
 }
 
-static int sl_open_device(int device_index)
+static int sl_open_dev(int dev_index)
 {
        libusb_device **devlist;
        struct libusb_device_descriptor des;
        struct sr_dev_inst *sdi;
-       struct fx2_device *fx2;
+       struct fx2_dev *fx2;
        int err, skip, i;
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index)))
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index)))
                return SR_ERR;
        fx2 = sdi->priv;
 
@@ -194,7 +194,7 @@ static int sl_open_device(int device_index)
                        continue;
 
                if (sdi->status == SR_ST_INITIALIZING) {
-                       if (skip != device_index) {
+                       if (skip != dev_index) {
                                /* Skip devices of this type that aren't the one we want. */
                                skip += 1;
                                continue;
@@ -237,9 +237,9 @@ static int sl_open_device(int device_index)
        return SR_OK;
 }
 
-static void close_device(struct sr_dev_inst *sdi)
+static void close_dev(struct sr_dev_inst *sdi)
 {
-       struct fx2_device *fx2;
+       struct fx2_dev *fx2;
 
        fx2 = sdi->priv;
 
@@ -254,7 +254,7 @@ static void close_device(struct sr_dev_inst *sdi)
        sdi->status = SR_ST_INACTIVE;
 }
 
-static int configure_probes(struct fx2_device *fx2, GSList *probes)
+static int configure_probes(struct fx2_dev *fx2, GSList *probes)
 {
        struct sr_probe *probe;
        GSList *l;
@@ -300,11 +300,11 @@ static int configure_probes(struct fx2_device *fx2, GSList *probes)
        return SR_OK;
 }
 
-static struct fx2_device *fx2_device_new(void)
+static struct fx2_dev *fx2_dev_new(void)
 {
-       struct fx2_device *fx2;
+       struct fx2_dev *fx2;
 
-       if (!(fx2 = g_try_malloc0(sizeof(struct fx2_device)))) {
+       if (!(fx2 = g_try_malloc0(sizeof(struct fx2_dev)))) {
                sr_err("logic: %s: fx2 malloc failed", __func__);
                return NULL;
        }
@@ -319,17 +319,17 @@ static struct fx2_device *fx2_device_new(void)
  * API callbacks
  */
 
-static int hw_init(const char *deviceinfo)
+static int hw_init(const char *devinfo)
 {
        struct sr_dev_inst *sdi;
        struct libusb_device_descriptor des;
        struct fx2_profile *fx2_prof;
-       struct fx2_device *fx2;
+       struct fx2_dev *fx2;
        libusb_device **devlist;
        int err, devcnt, i, j;
 
        /* Avoid compiler warnings. */
-       (void)deviceinfo;
+       (void)devinfo;
 
        if (libusb_init(&usb_context) != 0) {
                sr_err("logic: Failed to initialize USB.");
@@ -363,7 +363,7 @@ static int hw_init(const char *deviceinfo)
                        fx2_prof->vendor, fx2_prof->model, fx2_prof->model_version);
                if (!sdi)
                        return 0;
-               fx2 = fx2_device_new();
+               fx2 = fx2_dev_new();
                fx2->profile = fx2_prof;
                sdi->priv = fx2;
                dev_insts = g_slist_append(dev_insts, sdi);
@@ -393,14 +393,14 @@ static int hw_init(const char *deviceinfo)
        return devcnt;
 }
 
-static int hw_opendev(int device_index)
+static int hw_opendev(int dev_index)
 {
        GTimeVal cur_time;
        struct sr_dev_inst *sdi;
-       struct fx2_device *fx2;
+       struct fx2_dev *fx2;
        int timediff, err;
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index)))
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index)))
                return SR_ERR;
        fx2 = sdi->priv;
 
@@ -415,7 +415,7 @@ static int hw_opendev(int device_index)
                g_usleep(300 * 1000);
                timediff = 0;
                while (timediff < MAX_RENUM_DELAY) {
-                       if ((err = sl_open_device(device_index)) == SR_OK)
+                       if ((err = sl_open_dev(dev_index)) == SR_OK)
                                break;
                        g_usleep(100 * 1000);
                        g_get_current_time(&cur_time);
@@ -423,7 +423,7 @@ static int hw_opendev(int device_index)
                }
                sr_info("logic: device came back after %d ms", timediff);
        } else {
-               err = sl_open_device(device_index);
+               err = sl_open_dev(dev_index);
        }
 
        if (err != SR_OK) {
@@ -440,7 +440,7 @@ static int hw_opendev(int device_index)
 
        if (fx2->cur_samplerate == 0) {
                /* Samplerate hasn't been set; default to the slowest one. */
-               if (hw_set_configuration(device_index, SR_HWCAP_SAMPLERATE,
+               if (hw_set_configuration(dev_index, SR_HWCAP_SAMPLERATE,
                    &supported_samplerates[0]) == SR_ERR)
                        return SR_ERR;
        }
@@ -448,17 +448,17 @@ static int hw_opendev(int device_index)
        return SR_OK;
 }
 
-static int hw_closedev(int device_index)
+static int hw_closedev(int dev_index)
 {
        struct sr_dev_inst *sdi;
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index))) {
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) {
                sr_err("logic: %s: sdi was NULL", __func__);
                return SR_ERR; /* TODO: SR_ERR_ARG? */
        }
 
        /* TODO */
-       close_device(sdi);
+       close_dev(sdi);
 
        return SR_OK;
 }
@@ -467,7 +467,7 @@ static int hw_cleanup(void)
 {
        GSList *l;
        struct sr_dev_inst *sdi;
-       struct fx2_device *fx2;
+       struct fx2_dev *fx2;
        int ret = SR_OK;
 
        /* Properly close and free all devices. */
@@ -485,7 +485,7 @@ static int hw_cleanup(void)
                        ret = SR_ERR_BUG;
                        continue;
                }
-               close_device(sdi);
+               close_dev(sdi);
                sr_usb_dev_inst_free(fx2->usb);
                sr_dev_inst_free(sdi);
        }
@@ -500,17 +500,17 @@ static int hw_cleanup(void)
        return ret;
 }
 
-static void *hw_get_device_info(int device_index, int device_info_id)
+static void *hw_get_dev_info(int dev_index, int dev_info_id)
 {
        struct sr_dev_inst *sdi;
-       struct fx2_device *fx2;
+       struct fx2_dev *fx2;
        void *info = NULL;
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index)))
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index)))
                return NULL;
        fx2 = sdi->priv;
 
-       switch (device_info_id) {
+       switch (dev_info_id) {
        case SR_DI_INSTANCE:
                info = sdi;
                break;
@@ -534,11 +534,11 @@ static void *hw_get_device_info(int device_index, int device_info_id)
        return info;
 }
 
-static int hw_get_status(int device_index)
+static int hw_get_status(int dev_index)
 {
        struct sr_dev_inst *sdi;
 
-       sdi = sr_dev_inst_get(dev_insts, device_index);
+       sdi = sr_dev_inst_get(dev_insts, dev_index);
        if (sdi)
                return sdi->status;
        else
@@ -594,7 +594,7 @@ static uint8_t new_firmware_divider_value(uint64_t samplerate)
 static int set_configuration_samplerate(struct sr_dev_inst *sdi,
                                        uint64_t samplerate)
 {
-       struct fx2_device *fx2;
+       struct fx2_dev *fx2;
        uint8_t divider;
        int ret, result, i;
        unsigned char buf[2];
@@ -628,14 +628,14 @@ static int set_configuration_samplerate(struct sr_dev_inst *sdi,
        return SR_OK;
 }
 
-static int hw_set_configuration(int device_index, int capability, void *value)
+static int hw_set_configuration(int dev_index, int capability, void *value)
 {
        struct sr_dev_inst *sdi;
-       struct fx2_device *fx2;
+       struct fx2_dev *fx2;
        int ret;
        uint64_t *tmp_u64;
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index)))
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index)))
                return SR_ERR;
        fx2 = sdi->priv;
 
@@ -672,12 +672,12 @@ static int receive_data(int fd, int revents, void *user_data)
 
 static void receive_transfer(struct libusb_transfer *transfer)
 {
-       /* TODO: these statics have to move to fx2_device struct */
+       /* TODO: these statics have to move to fx2_dev struct */
        static int num_samples = 0;
        static int empty_transfer_count = 0;
        struct sr_datafeed_packet packet;
        struct sr_datafeed_logic logic;
-       struct fx2_device *fx2;
+       struct fx2_dev *fx2;
        int cur_buflen, trigger_offset, i;
        unsigned char *cur_buf, *new_buf;
 
@@ -808,18 +808,18 @@ static void receive_transfer(struct libusb_transfer *transfer)
        }
 }
 
-static int hw_start_acquisition(int device_index, gpointer session_data)
+static int hw_start_acquisition(int dev_index, gpointer session_data)
 {
        struct sr_dev_inst *sdi;
        struct sr_datafeed_packet *packet;
        struct sr_datafeed_header *header;
-       struct fx2_device *fx2;
+       struct fx2_dev *fx2;
        struct libusb_transfer *transfer;
        const struct libusb_pollfd **lupfd;
        int size, i;
        unsigned char *buf;
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index)))
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index)))
                return SR_ERR;
        fx2 = sdi->priv;
        fx2->session_data = session_data;
@@ -873,13 +873,13 @@ static int hw_start_acquisition(int device_index, gpointer session_data)
        return SR_OK;
 }
 
-/* This stops acquisition on ALL devices, ignoring device_index. */
-static int hw_stop_acquisition(int device_index, gpointer session_data)
+/* This stops acquisition on ALL devices, ignoring dev_index. */
+static int hw_stop_acquisition(int dev_index, gpointer session_data)
 {
        struct sr_datafeed_packet packet;
 
        /* Avoid compiler warnings. */
-       (void)device_index;
+       (void)dev_index;
 
        packet.type = SR_DF_END;
        sr_session_bus(session_data, &packet);
@@ -891,7 +891,7 @@ static int hw_stop_acquisition(int device_index, gpointer session_data)
        return SR_OK;
 }
 
-SR_PRIV struct sr_device_plugin saleae_logic_plugin_info = {
+SR_PRIV struct sr_dev_plugin saleae_logic_plugin_info = {
        .name = "saleae-logic",
        .longname = "Saleae Logic",
        .api_version = 1,
@@ -899,7 +899,7 @@ SR_PRIV struct sr_device_plugin saleae_logic_plugin_info = {
        .cleanup = hw_cleanup,
        .opendev = hw_opendev,
        .closedev = hw_closedev,
-       .get_device_info = hw_get_device_info,
+       .get_dev_info = hw_get_dev_info,
        .get_status = hw_get_status,
        .get_capabilities = hw_get_capabilities,
        .set_configuration = hw_set_configuration,
index 2855485eb98e426e244ce955aea84aafc73327e6..5b8f489c2857b9ca8c7b22c31ce1406985ed716a 100644 (file)
@@ -48,13 +48,13 @@ struct fx2_profile {
        int num_probes;
 };
 
-struct fx2_device {
+struct fx2_dev {
        struct fx2_profile *profile;
        /*
-        * Since we can't keep track of a Saleae Logic device after upgrading the
-        * firmware (it re-enumerates into a different device address after the
-        * upgrade) this is like a global lock. No device will open until a proper
-        * delay after the last device was upgraded.
+        * Since we can't keep track of a Saleae Logic device after upgrading
+        * the firmware (it re-enumerates into a different device address
+        * after the upgrade) this is like a global lock. No device will open
+        * until a proper delay after the last device was upgraded.
         */
        GTimeVal fw_updated;
        /* device/capture settings */
index 78db7baf68936757f19d2be0d8434e2253dcb045..e9476237dcd6c62969f27b676366e9e2b57b67c1 100644 (file)
@@ -37,11 +37,11 @@ enum {
        HARD_DATA_CHECK_SUM             = 0x00,
        PASS_WORD,
 
-       DEVICE_ID0                      = 0x10,
-       DEVICE_ID1,
+       DEV_ID0                         = 0x10,
+       DEV_ID1,
 
        START_STATUS                    = 0x20,
-       DEVICE_STATUS                   = 0x21,
+       DEV_STATUS                      = 0x21,
        FREQUENCY_REG0                  = 0x30,
        FREQUENCY_REG1,
        FREQUENCY_REG2,
@@ -319,7 +319,7 @@ SR_PRIV void analyzer_wait(libusb_device_handle *devh, int set, int unset)
 {
        int status;
        while (1) {
-               status = gl_reg_read(devh, DEVICE_STATUS);
+               status = gl_reg_read(devh, DEV_STATUS);
                if ((status & set) && ((status & unset) == 0))
                        return;
        }
@@ -507,8 +507,7 @@ SR_PRIV void analyzer_set_triggerbar_address(unsigned int address)
 
 SR_PRIV unsigned int analyzer_read_id(libusb_device_handle *devh)
 {
-       return gl_reg_read(devh, DEVICE_ID1) << 8 | gl_reg_read(devh,
-                                                               DEVICE_ID0);
+       return gl_reg_read(devh, DEV_ID1) << 8 | gl_reg_read(devh, DEV_ID0);
 }
 
 SR_PRIV unsigned int analyzer_get_stop_address(libusb_device_handle *devh)
index 722aed6f50bcd8f8fd7a42c5ae356118e48803ce..44065339956d267721b4048e3014c63f13e77474 100644 (file)
@@ -166,7 +166,7 @@ struct zp {
        struct sr_usb_dev_inst *usb;
 };
 
-static int hw_set_configuration(int device_index, int capability, void *value);
+static int hw_set_configuration(int dev_index, int capability, void *value);
 
 static unsigned int get_memory_size(int type)
 {
@@ -239,14 +239,14 @@ static int opendev4(struct sr_dev_inst **sdi, libusb_device *dev,
        return 0;
 }
 
-static struct sr_dev_inst *zp_open_device(int device_index)
+static struct sr_dev_inst *zp_open_dev(int dev_index)
 {
        struct sr_dev_inst *sdi;
        libusb_device **devlist;
        struct libusb_device_descriptor des;
        int err, i;
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index)))
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index)))
                return NULL;
 
        libusb_get_device_list(usb_context, &devlist);
@@ -269,7 +269,7 @@ static struct sr_dev_inst *zp_open_device(int device_index)
        return sdi;
 }
 
-static void close_device(struct sr_dev_inst *sdi)
+static void close_dev(struct sr_dev_inst *sdi)
 {
        struct zp *zp;
 
@@ -336,7 +336,7 @@ static int configure_probes(struct sr_dev_inst *sdi, GSList *probes)
  * API callbacks
  */
 
-static int hw_init(const char *deviceinfo)
+static int hw_init(const char *devinfo)
 {
        struct sr_dev_inst *sdi;
        struct libusb_device_descriptor des;
@@ -345,7 +345,7 @@ static int hw_init(const char *deviceinfo)
        struct zp *zp;
 
        /* Avoid compiler warnings. */
-       (void)deviceinfo;
+       (void)devinfo;
 
        /* Allocate memory for our private driver context. */
        if (!(zp = g_try_malloc(sizeof(struct zp)))) {
@@ -409,18 +409,18 @@ static int hw_init(const char *deviceinfo)
        return devcnt;
 }
 
-static int hw_opendev(int device_index)
+static int hw_opendev(int dev_index)
 {
        struct sr_dev_inst *sdi;
        struct zp *zp;
        int err;
 
-       if (!(sdi = zp_open_device(device_index))) {
+       if (!(sdi = zp_open_dev(dev_index))) {
                sr_err("zp: unable to open device");
                return SR_ERR;
        }
 
-       /* TODO: Note: sdi is retrieved in zp_open_device(). */
+       /* TODO: Note: sdi is retrieved in zp_open_dev(). */
 
        if (!(zp = sdi->priv)) {
                sr_err("zp: %s: sdi->priv was NULL", __func__);
@@ -462,7 +462,7 @@ static int hw_opendev(int device_index)
 
        if (zp->cur_samplerate == 0) {
                /* Samplerate hasn't been set. Default to the slowest one. */
-               if (hw_set_configuration(device_index, SR_HWCAP_SAMPLERATE,
+               if (hw_set_configuration(dev_index, SR_HWCAP_SAMPLERATE,
                     &samplerates.list[0]) == SR_ERR)
                        return SR_ERR;
        }
@@ -470,17 +470,17 @@ static int hw_opendev(int device_index)
        return SR_OK;
 }
 
-static int hw_closedev(int device_index)
+static int hw_closedev(int dev_index)
 {
        struct sr_dev_inst *sdi;
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index))) {
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) {
                sr_err("zp: %s: sdi was NULL", __func__);
                return SR_ERR; /* TODO: SR_ERR_ARG? */
        }
 
        /* TODO */
-       close_device(sdi);
+       close_dev(sdi);
 
        return SR_OK;
 }
@@ -493,7 +493,7 @@ static int hw_cleanup(void)
        for (l = dev_insts; l; l = l->next) {
                sdi = l->data;
                /* Properly close all devices... */
-               close_device(sdi);
+               close_dev(sdi);
                /* ...and free all their memory. */
                sr_dev_inst_free(sdi);
        }
@@ -507,13 +507,13 @@ static int hw_cleanup(void)
        return SR_OK;
 }
 
-static void *hw_get_device_info(int device_index, int device_info_id)
+static void *hw_get_dev_info(int dev_index, int dev_info_id)
 {
        struct sr_dev_inst *sdi;
        struct zp *zp;
        void *info;
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index))) {
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) {
                sr_err("zp: %s: sdi was NULL", __func__);
                return NULL;
        }
@@ -523,7 +523,7 @@ static void *hw_get_device_info(int device_index, int device_info_id)
                return NULL;
        }
 
-       switch (device_info_id) {
+       switch (dev_info_id) {
        case SR_DI_INSTANCE:
                info = sdi;
                break;
@@ -552,11 +552,11 @@ static void *hw_get_device_info(int device_index, int device_info_id)
        return info;
 }
 
-static int hw_get_status(int device_index)
+static int hw_get_status(int dev_index)
 {
        struct sr_dev_inst *sdi;
 
-       sdi = sr_dev_inst_get(dev_insts, device_index);
+       sdi = sr_dev_inst_get(dev_insts, dev_index);
        if (sdi)
                return sdi->status;
        else
@@ -597,13 +597,13 @@ static int set_configuration_samplerate(struct sr_dev_inst *sdi,
        return SR_OK;
 }
 
-static int hw_set_configuration(int device_index, int capability, void *value)
+static int hw_set_configuration(int dev_index, int capability, void *value)
 {
        struct sr_dev_inst *sdi;
        uint64_t *tmp_u64;
        struct zp *zp;
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index))) {
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) {
                sr_err("zp: %s: sdi was NULL", __func__);
                return SR_ERR;
        }
@@ -628,7 +628,7 @@ static int hw_set_configuration(int device_index, int capability, void *value)
        }
 }
 
-static int hw_start_acquisition(int device_index, gpointer session_data)
+static int hw_start_acquisition(int dev_index, gpointer session_data)
 {
        struct sr_dev_inst *sdi;
        struct sr_datafeed_packet packet;
@@ -640,7 +640,7 @@ static int hw_start_acquisition(int device_index, gpointer session_data)
        unsigned char *buf;
        struct zp *zp;
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index))) {
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) {
                sr_err("zp: %s: sdi was NULL", __func__);
                return SR_ERR;
        }
@@ -703,17 +703,17 @@ static int hw_start_acquisition(int device_index, gpointer session_data)
        return SR_OK;
 }
 
-/* This stops acquisition on ALL devices, ignoring device_index. */
-static int hw_stop_acquisition(int device_index, gpointer session_device_id)
+/* This stops acquisition on ALL devices, ignoring dev_index. */
+static int hw_stop_acquisition(int dev_index, gpointer session_dev_id)
 {
        struct sr_datafeed_packet packet;
        struct sr_dev_inst *sdi;
        struct zp *zp;
 
        packet.type = SR_DF_END;
-       sr_session_bus(session_device_id, &packet);
+       sr_session_bus(session_dev_id, &packet);
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index))) {
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) {
                sr_err("zp: %s: sdi was NULL", __func__);
                return SR_ERR_BUG;
        }
@@ -729,7 +729,7 @@ static int hw_stop_acquisition(int device_index, gpointer session_device_id)
        return SR_OK;
 }
 
-SR_PRIV struct sr_device_plugin zeroplus_logic_cube_plugin_info = {
+SR_PRIV struct sr_dev_plugin zeroplus_logic_cube_plugin_info = {
        .name = "zeroplus-logic-cube",
        .longname = "Zeroplus Logic Cube LAP-C series",
        .api_version = 1,
@@ -737,7 +737,7 @@ SR_PRIV struct sr_device_plugin zeroplus_logic_cube_plugin_info = {
        .cleanup = hw_cleanup,
        .opendev = hw_opendev,
        .closedev = hw_closedev,
-       .get_device_info = hw_get_device_info,
+       .get_dev_info = hw_get_dev_info,
        .get_status = hw_get_status,
        .get_capabilities = hw_get_capabilities,
        .set_configuration = hw_set_configuration,
index c560002ffb858593a055dc552f88c0c5285911ee..1248bd773c238c4787a2c8270c0926e40a663e22 100644 (file)
@@ -43,28 +43,28 @@ SR_API struct sr_hwcap_option sr_hwcap_options[] = {
 };
 
 #ifdef HAVE_LA_DEMO
-extern struct sr_device_plugin demo_plugin_info;
+extern struct sr_dev_plugin demo_plugin_info;
 #endif
 #ifdef HAVE_LA_SALEAE_LOGIC
-extern struct sr_device_plugin saleae_logic_plugin_info;
+extern struct sr_dev_plugin saleae_logic_plugin_info;
 #endif
 #ifdef HAVE_LA_OLS
-extern struct sr_device_plugin ols_plugin_info;
+extern struct sr_dev_plugin ols_plugin_info;
 #endif
 #ifdef HAVE_LA_ZEROPLUS_LOGIC_CUBE
-extern struct sr_device_plugin zeroplus_logic_cube_plugin_info;
+extern struct sr_dev_plugin zeroplus_logic_cube_plugin_info;
 #endif
 #ifdef HAVE_LA_ASIX_SIGMA
-extern struct sr_device_plugin asix_sigma_plugin_info;
+extern struct sr_dev_plugin asix_sigma_plugin_info;
 #endif
 #ifdef HAVE_LA_CHRONOVU_LA8
-extern SR_PRIV struct device_plugin chronovu_la8_plugin_info;
+extern SR_PRIV struct dev_plugin chronovu_la8_plugin_info;
 #endif
 #ifdef HAVE_LA_LINK_MSO19
-extern struct sr_device_plugin link_mso19_plugin_info;
+extern struct sr_dev_plugin link_mso19_plugin_info;
 #endif
 #ifdef HAVE_LA_ALSA
-extern struct sr_device_plugin alsa_plugin_info;
+extern struct sr_dev_plugin alsa_plugin_info;
 #endif
 
 /* TODO: No linked list needed, this can be a simple array. */
@@ -123,19 +123,19 @@ SR_API GSList *sr_hw_list(void)
  *
  * @return The number of devices found and instantiated by the plugin.
  */
-SR_API int sr_hw_init(struct sr_device_plugin *plugin)
+SR_API int sr_hw_init(struct sr_dev_plugin *plugin)
 {
-       int num_devices, num_probes, i, j;
-       int num_initialized_devices = 0;
-       struct sr_device *device;
+       int num_devs, num_probes, i, j;
+       int num_initialized_devs = 0;
+       struct sr_dev *dev;
        char **probe_names;
 
        sr_dbg("initializing %s plugin", plugin->name);
-       num_devices = plugin->init(NULL);
-       for (i = 0; i < num_devices; i++) {
+       num_devs = plugin->init(NULL);
+       for (i = 0; i < num_devs; i++) {
                num_probes = GPOINTER_TO_INT(
-                               plugin->get_device_info(i, SR_DI_NUM_PROBES));
-               probe_names = (char **)plugin->get_device_info(i,
+                               plugin->get_dev_info(i, SR_DI_NUM_PROBES));
+               probe_names = (char **)plugin->get_dev_info(i,
                                                        SR_DI_PROBE_NAMES);
 
                if (!probe_names) {
@@ -144,18 +144,18 @@ SR_API int sr_hw_init(struct sr_device_plugin *plugin)
                        continue;
                }
 
-               device = sr_dev_new(plugin, i);
+               dev = sr_dev_new(plugin, i);
                for (j = 0; j < num_probes; j++)
-                       sr_dev_probe_add(device, probe_names[j]);
-               num_initialized_devices++;
+                       sr_dev_probe_add(dev, probe_names[j]);
+               num_initialized_devs++;
        }
 
-       return num_initialized_devices;
+       return num_initialized_devs;
 }
 
 SR_PRIV void sr_hw_cleanup_all(void)
 {
-       struct sr_device_plugin *plugin;
+       struct sr_dev_plugin *plugin;
        GSList *l;
 
        for (l = plugins; l; l = l->next) {
@@ -186,17 +186,17 @@ SR_PRIV struct sr_dev_inst *sr_dev_inst_new(int index, int status,
        return sdi;
 }
 
-SR_PRIV struct sr_dev_inst *sr_dev_inst_get(GSList *dev_insts, int device_index)
+SR_PRIV struct sr_dev_inst *sr_dev_inst_get(GSList *dev_insts, int dev_index)
 {
        struct sr_dev_inst *sdi;
        GSList *l;
 
        for (l = dev_insts; l; l = l->next) {
                sdi = (struct sr_dev_inst *)(l->data);
-               if (sdi->index == device_index)
+               if (sdi->index == dev_index)
                        return sdi;
        }
-       sr_warn("could not find device index %d instance", device_index);
+       sr_warn("could not find device index %d instance", dev_index);
 
        return NULL;
 }
@@ -268,7 +268,7 @@ SR_PRIV void sr_serial_dev_inst_free(struct sr_serial_dev_inst *serial)
  *
  * @return TRUE if found, FALSE otherwise.
  */
-SR_API gboolean sr_hw_has_hwcap(struct sr_device_plugin *plugin, int hwcap)
+SR_API gboolean sr_hw_has_hwcap(struct sr_dev_plugin *plugin, int hwcap)
 {
        int *capabilities, i;
 
index 50f7f501820382031307ca4412eea28cfa49a1ad..9a87d3e2cf929dd0e340543fd04cfe232e2dabc5 100644 (file)
@@ -52,12 +52,12 @@ static int init(struct sr_input *in)
        }
 
        /* Create a virtual device. */
-       in->vdevice = sr_dev_new(NULL, 0);
+       in->vdev = sr_dev_new(NULL, 0);
 
        for (i = 0; i < num_probes; i++) {
                snprintf(name, SR_MAX_PROBENAME_LEN, "%d", i);
                /* TODO: Check return value. */
-               sr_dev_probe_add(in->vdevice, name);
+               sr_dev_probe_add(in->vdev, name);
        }
 
        return SR_OK;
@@ -74,7 +74,7 @@ static int loadfile(struct sr_input *in, const char *filename)
        if ((fd = open(filename, O_RDONLY)) == -1)
                return SR_ERR;
 
-       num_probes = g_slist_length(in->vdevice->probes);
+       num_probes = g_slist_length(in->vdev->probes);
 
        /* send header */
        header.feed_version = 1;
@@ -83,7 +83,7 @@ static int loadfile(struct sr_input *in, const char *filename)
        gettimeofday(&header.starttime, NULL);
        packet.type = SR_DF_HEADER;
        packet.payload = &header;
-       sr_session_bus(in->vdevice, &packet);
+       sr_session_bus(in->vdev, &packet);
 
        /* chop up the input file into chunks and feed it into the session bus */
        packet.type = SR_DF_LOGIC;
@@ -92,13 +92,13 @@ static int loadfile(struct sr_input *in, const char *filename)
        logic.data = buffer;
        while ((size = read(fd, buffer, CHUNKSIZE)) > 0) {
                logic.length = size;
-               sr_session_bus(in->vdevice, &packet);
+               sr_session_bus(in->vdev, &packet);
        }
        close(fd);
 
        /* end of stream */
        packet.type = SR_DF_END;
-       sr_session_bus(in->vdevice, &packet);
+       sr_session_bus(in->vdev, &packet);
 
        return SR_OK;
 }
index 9c75a9179208375e9bf89d47a4a1257fb3056399..1ecb6fb78db4a0a424686777cdeba6cca1640e3e 100644 (file)
@@ -92,12 +92,12 @@ static int init(struct sr_input *in)
        }
 
        /* Create a virtual device. */
-       in->vdevice = sr_dev_new(NULL, 0);
+       in->vdev = sr_dev_new(NULL, 0);
 
        for (i = 0; i < num_probes; i++) {
                snprintf(name, SR_MAX_PROBENAME_LEN, "%d", i);
                /* TODO: Check return value. */
-               sr_dev_probe_add(in->vdevice, name);
+               sr_dev_probe_add(in->vdev, name);
        }
 
        return SR_OK;
@@ -118,7 +118,7 @@ static int loadfile(struct sr_input *in, const char *filename)
                return SR_ERR;
        }
 
-       num_probes = g_slist_length(in->vdevice->probes);
+       num_probes = g_slist_length(in->vdev->probes);
 
        /* Seek to the end of the file, and read the divcount byte. */
        divcount = 0x00; /* TODO: Don't hardcode! */
@@ -139,7 +139,7 @@ static int loadfile(struct sr_input *in, const char *filename)
        gettimeofday(&header.starttime, NULL);
        header.num_logic_probes = num_probes;
        header.samplerate = samplerate;
-       sr_session_bus(in->vdevice, &packet);
+       sr_session_bus(in->vdev, &packet);
 
        /* TODO: Handle trigger point. */
 
@@ -155,7 +155,7 @@ static int loadfile(struct sr_input *in, const char *filename)
                /* TODO: Handle errors, handle incomplete reads. */
                size = read(fd, buf, PACKET_SIZE);
                logic.length = PACKET_SIZE;
-               sr_session_bus(in->vdevice, &packet);
+               sr_session_bus(in->vdev, &packet);
        }
        close(fd); /* FIXME */
 
@@ -163,7 +163,7 @@ static int loadfile(struct sr_input *in, const char *filename)
        sr_dbg("la8 in: %s: sending SR_DF_END", __func__);
        packet.type = SR_DF_END;
        packet.payload = NULL;
-       sr_session_bus(in->vdevice, &packet);
+       sr_session_bus(in->vdev, &packet);
 
        return SR_OK;
 }
index 1922e1e6fc33e9af96e879300d045e52dcb01c72..4672af09f39781c582a0b0b8d76f5f5023a2e4e7 100644 (file)
@@ -105,7 +105,7 @@ static int init(struct sr_output *o, int default_spl, enum outputmode mode)
        o->internal = ctx;
        ctx->num_enabled_probes = 0;
 
-       for (l = o->device->probes; l; l = l->next) {
+       for (l = o->dev->probes; l; l = l->next) {
                probe = l->data;
                if (!probe->enabled)
                        continue;
@@ -134,10 +134,10 @@ static int init(struct sr_output *o, int default_spl, enum outputmode mode)
        }
 
        snprintf(ctx->header, 511, "%s\n", PACKAGE_STRING);
-       num_probes = g_slist_length(o->device->probes);
-       if (o->device->plugin && sr_dev_has_hwcap(o->device, SR_HWCAP_SAMPLERATE)) {
-               samplerate = *((uint64_t *) o->device->plugin->get_device_info(
-                               o->device->plugin_index, SR_DI_CUR_SAMPLERATE));
+       num_probes = g_slist_length(o->dev->probes);
+       if (o->dev->plugin && sr_dev_has_hwcap(o->dev, SR_HWCAP_SAMPLERATE)) {
+               samplerate = *((uint64_t *) o->dev->plugin->get_dev_info(
+                               o->dev->plugin_index, SR_DI_CUR_SAMPLERATE));
                if (!(samplerate_s = sr_samplerate_string(samplerate))) {
                        g_free(ctx->header);
                        g_free(ctx);
index bb7fe4e75516e74b88a398c9e463369c3c21ae29..49f157f742a9fbf9db6f26527ea9ebf8e92f21f9 100644 (file)
@@ -94,13 +94,13 @@ static int init(struct sr_output *o)
                return SR_ERR_ARG;
        }
 
-       if (!o->device) {
-               sr_warn("la8 out: %s: o->device was NULL", __func__);
+       if (!o->dev) {
+               sr_warn("la8 out: %s: o->dev was NULL", __func__);
                return SR_ERR_ARG;
        }
 
-       if (!o->device->plugin) {
-               sr_warn("la8 out: %s: o->device->plugin was NULL", __func__);
+       if (!o->dev->plugin) {
+               sr_warn("la8 out: %s: o->dev->plugin was NULL", __func__);
                return SR_ERR_ARG;
        }
 
@@ -113,7 +113,7 @@ static int init(struct sr_output *o)
 
        /* Get the number of probes, their names, and the unitsize. */
        /* TODO: Error handling. */
-       for (l = o->device->probes; l; l = l->next) {
+       for (l = o->dev->probes; l; l = l->next) {
                probe = l->data;
                if (!probe->enabled)
                        continue;
@@ -122,11 +122,11 @@ static int init(struct sr_output *o)
        ctx->probelist[ctx->num_enabled_probes] = 0;
        ctx->unitsize = (ctx->num_enabled_probes + 7) / 8;
 
-       num_probes = g_slist_length(o->device->probes);
+       num_probes = g_slist_length(o->dev->probes);
 
-       if (sr_dev_has_hwcap(o->device, SR_HWCAP_SAMPLERATE)) {
-               samplerate = *((uint64_t *) o->device->plugin->get_device_info(
-                               o->device->plugin_index, SR_DI_CUR_SAMPLERATE));
+       if (sr_dev_has_hwcap(o->dev, SR_HWCAP_SAMPLERATE)) {
+               samplerate = *((uint64_t *) o->dev->plugin->get_dev_info(
+                               o->dev->plugin_index, SR_DI_CUR_SAMPLERATE));
                /* TODO: Error checks. */
        } else {
                samplerate = 0; /* TODO: Error or set some value? */
index c1b0ee9247db00e0aac88f199e5a97570147a09b..18d5c420bb406235f979c356600e1213f78fc1af 100644 (file)
@@ -61,13 +61,13 @@ static int init(struct sr_output *o)
                return SR_ERR_ARG;
        }
 
-       if (!o->device) {
-               sr_err("csv out: %s: o->device was NULL", __func__);
+       if (!o->dev) {
+               sr_err("csv out: %s: o->dev was NULL", __func__);
                return SR_ERR_ARG;
        }
 
-       if (!o->device->plugin) {
-               sr_err("csv out: %s: o->device->plugin was NULL", __func__);
+       if (!o->dev->plugin) {
+               sr_err("csv out: %s: o->dev->plugin was NULL", __func__);
                return SR_ERR_ARG;
        }
 
@@ -80,7 +80,7 @@ static int init(struct sr_output *o)
 
        /* Get the number of probes, their names, and the unitsize. */
        /* TODO: Error handling. */
-       for (l = o->device->probes; l; l = l->next) {
+       for (l = o->dev->probes; l; l = l->next) {
                probe = l->data;
                if (!probe->enabled)
                        continue;
@@ -89,11 +89,11 @@ static int init(struct sr_output *o)
        ctx->probelist[ctx->num_enabled_probes] = 0;
        ctx->unitsize = (ctx->num_enabled_probes + 7) / 8;
 
-       num_probes = g_slist_length(o->device->probes);
+       num_probes = g_slist_length(o->dev->probes);
 
-       if (sr_dev_has_hwcap(o->device, SR_HWCAP_SAMPLERATE)) {
-               samplerate = *((uint64_t *) o->device->plugin->get_device_info(
-                               o->device->plugin_index, SR_DI_CUR_SAMPLERATE));
+       if (sr_dev_has_hwcap(o->dev, SR_HWCAP_SAMPLERATE)) {
+               samplerate = *((uint64_t *) o->dev->plugin->get_dev_info(
+                               o->dev->plugin_index, SR_DI_CUR_SAMPLERATE));
                /* TODO: Error checks. */
        } else {
                samplerate = 0; /* TODO: Error or set some value? */
index 1107d226f3d778e61f6e4408c7b1539bd8f57716..da4e25d28db0a61299d99e93e385b46338615eae 100644 (file)
@@ -66,13 +66,13 @@ static int init(struct sr_output *o)
                return SR_ERR_ARG;
        }
 
-       if (!o->device) {
-               sr_err("gnuplot out: %s: o->device was NULL", __func__);
+       if (!o->dev) {
+               sr_err("gnuplot out: %s: o->dev was NULL", __func__);
                return SR_ERR_ARG;
        }
 
-       if (!o->device->plugin) {
-               sr_err("gnuplot out: %s: o->device->plugin was NULL", __func__);
+       if (!o->dev->plugin) {
+               sr_err("gnuplot out: %s: o->dev->plugin was NULL", __func__);
                return SR_ERR_ARG;
        }
 
@@ -89,7 +89,7 @@ static int init(struct sr_output *o)
 
        o->internal = ctx;
        ctx->num_enabled_probes = 0;
-       for (l = o->device->probes; l; l = l->next) {
+       for (l = o->dev->probes; l; l = l->next) {
                probe = l->data; /* TODO: Error checks. */
                if (!probe->enabled)
                        continue;
@@ -98,11 +98,11 @@ static int init(struct sr_output *o)
        ctx->probelist[ctx->num_enabled_probes] = 0;
        ctx->unitsize = (ctx->num_enabled_probes + 7) / 8;
 
-       num_probes = g_slist_length(o->device->probes);
+       num_probes = g_slist_length(o->dev->probes);
        comment[0] = '\0';
-       if (sr_dev_has_hwcap(o->device, SR_HWCAP_SAMPLERATE)) {
-               samplerate = *((uint64_t *) o->device->plugin->get_device_info(
-                               o->device->plugin_index, SR_DI_CUR_SAMPLERATE));
+       if (sr_dev_has_hwcap(o->dev, SR_HWCAP_SAMPLERATE)) {
+               samplerate = *((uint64_t *) o->dev->plugin->get_dev_info(
+                               o->dev->plugin_index, SR_DI_CUR_SAMPLERATE));
                if (!(frequency_s = sr_samplerate_string(samplerate))) {
                        sr_err("gnuplot out: %s: sr_samplerate_string failed",
                               __func__);
@@ -311,7 +311,7 @@ static int analog_init(struct sr_output *o)
 
        o->internal = ctx;
        ctx->num_enabled_probes = 0;
-       for (l = o->device->probes; l; l = l->next) {
+       for (l = o->dev->probes; l; l = l->next) {
                probe = l->data;
                if (!probe->enabled)
                        continue;
@@ -322,11 +322,11 @@ static int analog_init(struct sr_output *o)
        ctx->unitsize = sizeof(struct sr_analog_sample) +
                        (ctx->num_enabled_probes * sizeof(struct sr_analog_probe));
 
-       num_probes = g_slist_length(o->device->probes);
+       num_probes = g_slist_length(o->dev->probes);
        comment[0] = '\0';
-       if (o->device->plugin && sr_dev_has_hwcap(o->device, SR_HWCAP_SAMPLERATE)) {
-               samplerate = *((uint64_t *) o->device->plugin->get_device_info(
-                               o->device->plugin_index, SR_DI_CUR_SAMPLERATE));
+       if (o->dev->plugin && sr_dev_has_hwcap(o->dev, SR_HWCAP_SAMPLERATE)) {
+               samplerate = *((uint64_t *) o->dev->plugin->get_dev_info(
+                               o->dev->plugin_index, SR_DI_CUR_SAMPLERATE));
                if (!(frequency_s = sr_samplerate_string(samplerate))) {
                        g_free(ctx->header);
                        g_free(ctx);
index a6ce6ea72846f072c071217d5829c9d9f67e6f86..62ab5382bbdf9008220ce49841dc69d5fa258a42 100644 (file)
@@ -53,16 +53,16 @@ static int init(struct sr_output *o)
 
        ctx->num_samples = 0;
        num_enabled_probes = 0;
-       for (l = o->device->probes; l; l = l->next) {
+       for (l = o->dev->probes; l; l = l->next) {
                probe = l->data;
                if (probe->enabled)
                        num_enabled_probes++;
        }
        ctx->unitsize = (num_enabled_probes + 7) / 8;
 
-       if (o->device->plugin && sr_dev_has_hwcap(o->device, SR_HWCAP_SAMPLERATE))
-               samplerate = *((uint64_t *) o->device->plugin->get_device_info(
-                               o->device->plugin_index, SR_DI_CUR_SAMPLERATE));
+       if (o->dev->plugin && sr_dev_has_hwcap(o->dev, SR_HWCAP_SAMPLERATE))
+               samplerate = *((uint64_t *) o->dev->plugin->get_dev_info(
+                               o->dev->plugin_index, SR_DI_CUR_SAMPLERATE));
        else
                samplerate = 0;
 
index aacc9b4c09c50dc0d10589b8ca2e8b15a9109f34..a2ae5265d9069e0c92f39d581b17b043117c728b 100644 (file)
@@ -81,7 +81,7 @@ SR_PRIV int init(struct sr_output *o, int default_spl, enum outputmode mode)
        o->internal = ctx;
        ctx->num_enabled_probes = 0;
 
-       for (l = o->device->probes; l; l = l->next) {
+       for (l = o->dev->probes; l; l = l->next) {
                probe = l->data;
                if (!probe->enabled)
                        continue;
@@ -109,10 +109,10 @@ SR_PRIV int init(struct sr_output *o, int default_spl, enum outputmode mode)
        }
 
        snprintf(ctx->header, 511, "%s\n", PACKAGE_STRING);
-       num_probes = g_slist_length(o->device->probes);
-       if (o->device->plugin || sr_dev_has_hwcap(o->device, SR_HWCAP_SAMPLERATE)) {
-               samplerate = *((uint64_t *) o->device->plugin->get_device_info(
-                               o->device->plugin_index, SR_DI_CUR_SAMPLERATE));
+       num_probes = g_slist_length(o->dev->probes);
+       if (o->dev->plugin || sr_dev_has_hwcap(o->dev, SR_HWCAP_SAMPLERATE)) {
+               samplerate = *((uint64_t *) o->dev->plugin->get_dev_info(
+                               o->dev->plugin_index, SR_DI_CUR_SAMPLERATE));
                if (!(samplerate_s = sr_samplerate_string(samplerate))) {
                        g_free(ctx->header);
                        g_free(ctx);
index 698c65aef8343d5bf30b4353346226d60f7ec818..64e2438e6813dbe7b10f5d83545921725bd1b7fd 100644 (file)
@@ -57,7 +57,7 @@ static int init(struct sr_output *o)
        o->internal = ctx;
        ctx->num_enabled_probes = 0;
 
-       for (l = o->device->probes; l; l = l->next) {
+       for (l = o->dev->probes; l; l = l->next) {
                probe = l->data;
                if (!probe->enabled)
                        continue;
@@ -71,7 +71,7 @@ static int init(struct sr_output *o)
        ctx->probelist[ctx->num_enabled_probes] = 0;
        ctx->unitsize = (ctx->num_enabled_probes + 7) / 8;
        ctx->header = g_string_sized_new(512);
-       num_probes = g_slist_length(o->device->probes);
+       num_probes = g_slist_length(o->dev->probes);
 
        /* timestamp */
        t = time(NULL);
@@ -84,9 +84,9 @@ static int init(struct sr_output *o)
        g_string_append_printf(ctx->header, "$version %s %s $end\n",
                        PACKAGE, PACKAGE_VERSION);
 
-       if (o->device->plugin && sr_dev_has_hwcap(o->device, SR_HWCAP_SAMPLERATE)) {
-               ctx->samplerate = *((uint64_t *) o->device->plugin->get_device_info(
-                               o->device->plugin_index, SR_DI_CUR_SAMPLERATE));
+       if (o->dev->plugin && sr_dev_has_hwcap(o->dev, SR_HWCAP_SAMPLERATE)) {
+               ctx->samplerate = *((uint64_t *) o->dev->plugin->get_dev_info(
+                               o->dev->plugin_index, SR_DI_CUR_SAMPLERATE));
                if (!((samplerate_s = sr_samplerate_string(ctx->samplerate)))) {
                        g_string_free(ctx->header, TRUE);
                        g_free(ctx);
index 75a2cb353ba5a06b9dd6b1e4f87fae7ab612dd14..1ddd2cc24444c4a3e7eea36f0ff9cec598661b33 100644 (file)
--- a/session.c
+++ b/session.c
@@ -76,8 +76,8 @@ SR_API int sr_session_destroy(void)
                return SR_ERR_BUG;
        }
 
-       g_slist_free(session->devices);
-       session->devices = NULL;
+       g_slist_free(session->devs);
+       session->devs = NULL;
 
        /* TODO: Error checks needed? */
 
@@ -97,15 +97,15 @@ SR_API int sr_session_destroy(void)
  *
  * @return SR_OK upon success, SR_ERR_BUG if no session exists.
  */
-SR_API int sr_session_device_clear(void)
+SR_API int sr_session_dev_clear(void)
 {
        if (!session) {
                sr_err("session: %s: session was NULL", __func__);
                return SR_ERR_BUG;
        }
 
-       g_slist_free(session->devices);
-       session->devices = NULL;
+       g_slist_free(session->devs);
+       session->devs = NULL;
 
        return SR_OK;
 }
@@ -113,28 +113,27 @@ SR_API int sr_session_device_clear(void)
 /**
  * Add a device to the current session.
  *
- * @param device The device to add to the current session. Must not be NULL.
- *               Also, device->plugin and device->plugin->opendev must not
- *               be NULL.
+ * @param dev The device to add to the current session. Must not be NULL.
+ *            Also, dev->plugin and dev->plugin->opendev must not be NULL.
  *
  * @return SR_OK upon success, SR_ERR_ARG upon invalid arguments.
  */
-SR_API int sr_session_device_add(struct sr_device *device)
+SR_API int sr_session_dev_add(struct sr_dev *dev)
 {
        int ret;
 
-       if (!device) {
-               sr_err("session: %s: device was NULL", __func__);
+       if (!dev) {
+               sr_err("session: %s: dev was NULL", __func__);
                return SR_ERR_ARG;
        }
 
-       if (!device->plugin) {
-               sr_err("session: %s: device->plugin was NULL", __func__);
+       if (!dev->plugin) {
+               sr_err("session: %s: dev->plugin was NULL", __func__);
                return SR_ERR_ARG;
        }
 
-       if (!device->plugin->opendev) {
-               sr_err("session: %s: device->plugin->opendev was NULL",
+       if (!dev->plugin->opendev) {
+               sr_err("session: %s: dev->plugin->opendev was NULL",
                       __func__);
                return SR_ERR_ARG;
        }
@@ -144,12 +143,12 @@ SR_API int sr_session_device_add(struct sr_device *device)
                return SR_ERR; /* TODO: SR_ERR_BUG? */
        }
 
-       if ((ret = device->plugin->opendev(device->plugin_index)) != SR_OK) {
+       if ((ret = dev->plugin->opendev(dev->plugin_index)) != SR_OK) {
                sr_err("session: %s: opendev failed (%d)", __func__, ret);
                return ret;
        }
 
-       session->devices = g_slist_append(session->devices, device);
+       session->devs = g_slist_append(session->devs, dev);
 
        return SR_OK;
 }
@@ -253,7 +252,7 @@ static int sr_session_run_poll(void)
  */
 SR_API int sr_session_start(void)
 {
-       struct sr_device *device;
+       struct sr_dev *dev;
        GSList *l;
        int ret;
 
@@ -263,9 +262,9 @@ SR_API int sr_session_start(void)
                return SR_ERR; /* TODO: SR_ERR_BUG? */
        }
 
-       if (!session->devices) {
+       if (!session->devs) {
                /* TODO: Actually the case? */
-               sr_err("session: %s: session->devices was NULL; a session "
+               sr_err("session: %s: session->devs was NULL; a session "
                       "cannot be started without devices.", __func__);
                return SR_ERR; /* TODO: SR_ERR_BUG? */
        }
@@ -274,11 +273,11 @@ SR_API int sr_session_start(void)
 
        sr_info("session: starting");
 
-       for (l = session->devices; l; l = l->next) {
-               device = l->data;
-               /* TODO: Check for device != NULL. */
-               if ((ret = device->plugin->start_acquisition(
-                               device->plugin_index, device)) != SR_OK) {
+       for (l = session->devs; l; l = l->next) {
+               dev = l->data;
+               /* TODO: Check for dev != NULL. */
+               if ((ret = dev->plugin->start_acquisition(
+                               dev->plugin_index, dev)) != SR_OK) {
                        sr_err("session: %s: could not start an acquisition "
                               "(%d)", __func__, ret);
                        break;
@@ -305,9 +304,9 @@ SR_API int sr_session_run(void)
                return SR_ERR_BUG;
        }
 
-       if (!session->devices) {
+       if (!session->devs) {
                /* TODO: Actually the case? */
-               sr_err("session: %s: session->devices was NULL; a session "
+               sr_err("session: %s: session->devs was NULL; a session "
                       "cannot be run without devices.", __func__);
                return SR_ERR_BUG;
        }
@@ -359,7 +358,7 @@ SR_API int sr_session_halt(void)
  */
 SR_API int sr_session_stop(void)
 {
-       struct sr_device *device;
+       struct sr_dev *dev;
        GSList *l;
 
        if (!session) {
@@ -370,14 +369,14 @@ SR_API int sr_session_stop(void)
        sr_info("session: stopping");
        session->running = FALSE;
 
-       for (l = session->devices; l; l = l->next) {
-               device = l->data;
-               /* Check for device != NULL. */
-               if (device->plugin) {
-                       if (device->plugin->stop_acquisition)
-                               device->plugin->stop_acquisition(device->plugin_index, device);
-                       if (device->plugin->cleanup)
-                               device->plugin->cleanup();
+       for (l = session->devs; l; l = l->next) {
+               dev = l->data;
+               /* Check for dev != NULL. */
+               if (dev->plugin) {
+                       if (dev->plugin->stop_acquisition)
+                               dev->plugin->stop_acquisition(dev->plugin_index, dev);
+                       if (dev->plugin->cleanup)
+                               dev->plugin->cleanup();
                }
        }
 
@@ -419,24 +418,24 @@ static void datafeed_dump(struct sr_datafeed_packet *packet)
  *
  * Hardware drivers use this to send a data packet to the frontend.
  *
- * @param device TODO.
+ * @param dev TODO.
  * @param packet TODO.
  *
  * @return SR_OK upon success, SR_ERR_ARG upon invalid arguments.
  */
-SR_PRIV int sr_session_bus(struct sr_device *device,
+SR_PRIV int sr_session_bus(struct sr_dev *dev,
                           struct sr_datafeed_packet *packet)
 {
        GSList *l;
        sr_datafeed_callback cb;
 
-       if (!device) {
-               sr_err("session: %s: device was NULL", __func__);
+       if (!dev) {
+               sr_err("session: %s: dev was NULL", __func__);
                return SR_ERR_ARG;
        }
 
-       if (!device->plugin) {
-               sr_err("session: %s: device->plugin was NULL", __func__);
+       if (!dev->plugin) {
+               sr_err("session: %s: dev->plugin was NULL", __func__);
                return SR_ERR_ARG;
        }
 
@@ -450,7 +449,7 @@ SR_PRIV int sr_session_bus(struct sr_device *device,
                        datafeed_dump(packet);
                cb = l->data;
                /* TODO: Check for cb != NULL. */
-               cb(device, packet);
+               cb(dev, packet);
        }
 
        return SR_OK;
index 7f2bf92a1ff13fc6371d2f74f229ff2865e5c389..647de88221a364d79f4ae6167d67e41d4acd18df 100644 (file)
@@ -29,7 +29,7 @@
 /* size of payloads sent across the session bus */
 #define CHUNKSIZE (512 * 1024)
 
-struct session_vdevice {
+struct session_vdev {
        char *capturefile;
        struct zip *archive;
        struct zip_file *capfile;
@@ -50,26 +50,26 @@ static int capabilities[] = {
 /**
  * TODO.
  *
- * @param device_index TODO.
+ * @param dev_index TODO.
  */
-static struct session_vdevice *get_vdevice_by_index(int device_index)
+static struct session_vdev *get_vdev_by_index(int dev_index)
 {
        struct sr_dev_inst *sdi;
-       struct session_vdevice *vdevice;
+       struct session_vdev *vdev;
 
-       /* TODO: Sanity checks on device_index. */
+       /* TODO: Sanity checks on dev_index. */
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index))) {
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) {
                sr_err("session driver: %s: device instance with device "
-                      "index %d was not found", __func__, device_index);
+                      "index %d was not found", __func__, dev_index);
                return NULL;
        }
 
        /* TODO: Is sdi->priv == NULL valid? */
 
-       vdevice = sdi->priv;
+       vdev = sdi->priv;
 
-       return vdevice;
+       return vdev;
 }
 
 /**
@@ -84,7 +84,7 @@ static struct session_vdevice *get_vdevice_by_index(int device_index)
 static int feed_chunk(int fd, int revents, void *session_data)
 {
        struct sr_dev_inst *sdi;
-       struct session_vdevice *vdevice;
+       struct session_vdev *vdev;
        struct sr_datafeed_packet packet;
        struct sr_datafeed_logic logic;
        GSList *l;
@@ -100,8 +100,8 @@ static int feed_chunk(int fd, int revents, void *session_data)
        got_data = FALSE;
        for (l = dev_insts; l; l = l->next) {
                sdi = l->data;
-               vdevice = sdi->priv;
-               if (!vdevice)
+               vdev = sdi->priv;
+               if (!vdev)
                        /* already done with this instance */
                        continue;
 
@@ -111,21 +111,21 @@ static int feed_chunk(int fd, int revents, void *session_data)
                        return FALSE; /* TODO: SR_ERR_MALLOC */
                }
 
-               ret = zip_fread(vdevice->capfile, buf, CHUNKSIZE);
+               ret = zip_fread(vdev->capfile, buf, CHUNKSIZE);
                if (ret > 0) {
                        got_data = TRUE;
                        packet.type = SR_DF_LOGIC;
                        packet.payload = &logic;
                        logic.length = ret;
-                       logic.unitsize = vdevice->unitsize;
+                       logic.unitsize = vdev->unitsize;
                        logic.data = buf;
-                       vdevice->bytes_read += ret;
+                       vdev->bytes_read += ret;
                        sr_session_bus(session_data, &packet);
                } else {
                        /* done with this capture file */
-                       zip_fclose(vdevice->capfile);
-                       g_free(vdevice->capturefile);
-                       g_free(vdevice);
+                       zip_fclose(vdev->capfile);
+                       g_free(vdev->capturefile);
+                       g_free(vdev);
                        sdi->priv = NULL;
                }
        }
@@ -144,13 +144,13 @@ static int hw_cleanup(void);
 /**
  * TODO.
  *
- * @param deviceinfo TODO.
+ * @param devinfo TODO.
  *
  * @return TODO.
  */
-static int hw_init(const char *deviceinfo)
+static int hw_init(const char *devinfo)
 {
-       sessionfile = g_strdup(deviceinfo);
+       sessionfile = g_strdup(devinfo);
 
        return 0;
 }
@@ -175,16 +175,16 @@ static int hw_cleanup(void)
        return SR_OK;
 }
 
-static int hw_opendev(int device_index)
+static int hw_opendev(int dev_index)
 {
        struct sr_dev_inst *sdi;
 
-       sdi = sr_dev_inst_new(device_index, SR_ST_INITIALIZING,
+       sdi = sr_dev_inst_new(dev_index, SR_ST_INITIALIZING,
                              NULL, NULL, NULL);
        if (!sdi)
                return SR_ERR;
 
-       if (!(sdi->priv = g_try_malloc0(sizeof(struct session_vdevice)))) {
+       if (!(sdi->priv = g_try_malloc0(sizeof(struct session_vdev)))) {
                sr_err("session driver: %s: sdi->priv malloc failed", __func__);
                return SR_ERR_MALLOC;
        }
@@ -194,26 +194,26 @@ static int hw_opendev(int device_index)
        return SR_OK;
 }
 
-static void *hw_get_device_info(int device_index, int device_info_id)
+static void *hw_get_dev_info(int dev_index, int dev_info_id)
 {
-       struct session_vdevice *vdevice;
+       struct session_vdev *vdev;
        void *info;
 
-       if (device_info_id != SR_DI_CUR_SAMPLERATE)
+       if (dev_info_id != SR_DI_CUR_SAMPLERATE)
                return NULL;
 
-       if (!(vdevice = get_vdevice_by_index(device_index)))
+       if (!(vdev = get_vdev_by_index(dev_index)))
                return NULL;
 
-       info = &vdevice->samplerate;
+       info = &vdev->samplerate;
 
        return info;
 }
 
-static int hw_get_status(int device_index)
+static int hw_get_status(int dev_index)
 {
        /* Avoid compiler warnings. */
-       (void)device_index;
+       (void)dev_index;
 
        if (sr_dev_list() != NULL)
                return SR_OK;
@@ -232,33 +232,33 @@ static int *hw_get_capabilities(void)
        return capabilities;
 }
 
-static int hw_set_configuration(int device_index, int capability, void *value)
+static int hw_set_configuration(int dev_index, int capability, void *value)
 {
-       struct session_vdevice *vdevice;
+       struct session_vdev *vdev;
        uint64_t *tmp_u64;
 
-       if (!(vdevice = get_vdevice_by_index(device_index)))
+       if (!(vdev = get_vdev_by_index(dev_index)))
                return SR_ERR;
 
        switch (capability) {
        case SR_HWCAP_SAMPLERATE:
                tmp_u64 = value;
-               vdevice->samplerate = *tmp_u64;
+               vdev->samplerate = *tmp_u64;
                sr_info("session driver: setting samplerate to %" PRIu64,
-                       vdevice->samplerate);
+                       vdev->samplerate);
                break;
        case SR_HWCAP_CAPTUREFILE:
-               vdevice->capturefile = g_strdup(value);
+               vdev->capturefile = g_strdup(value);
                sr_info("session driver: setting capturefile to %s",
-                       vdevice->capturefile);
+                       vdev->capturefile);
                break;
        case SR_HWCAP_CAPTURE_UNITSIZE:
                tmp_u64 = value;
-               vdevice->unitsize = *tmp_u64;
+               vdev->unitsize = *tmp_u64;
                break;
        case SR_HWCAP_CAPTURE_NUM_PROBES:
                tmp_u64 = value;
-               vdevice->num_probes = *tmp_u64;
+               vdev->num_probes = *tmp_u64;
                break;
        default:
                sr_err("session driver: %s: unknown capability %d requested",
@@ -269,44 +269,43 @@ static int hw_set_configuration(int device_index, int capability, void *value)
        return SR_OK;
 }
 
-static int hw_start_acquisition(int device_index, gpointer session_device_id)
+static int hw_start_acquisition(int dev_index, gpointer session_dev_id)
 {
        struct zip_stat zs;
-       struct session_vdevice *vdevice;
+       struct session_vdev *vdev;
        struct sr_datafeed_header *header;
        struct sr_datafeed_packet *packet;
        int err;
 
        /* Avoid compiler warnings. */
-       (void)session_device_id;
+       (void)session_dev_id;
 
-       if (!(vdevice = get_vdevice_by_index(device_index)))
+       if (!(vdev = get_vdev_by_index(dev_index)))
                return SR_ERR;
 
        sr_info("session_driver: opening archive %s file %s", sessionfile,
-               vdevice->capturefile);
+               vdev->capturefile);
 
-       if (!(vdevice->archive = zip_open(sessionfile, 0, &err))) {
+       if (!(vdev->archive = zip_open(sessionfile, 0, &err))) {
                sr_err("session driver: Failed to open session file '%s': "
                       "zip error %d\n", sessionfile, err);
                return SR_ERR;
        }
 
-       if (zip_stat(vdevice->archive, vdevice->capturefile, 0, &zs) == -1) {
+       if (zip_stat(vdev->archive, vdev->capturefile, 0, &zs) == -1) {
                sr_err("session driver: Failed to check capture file '%s' in "
-                      "session file '%s'.", vdevice->capturefile, sessionfile);
+                      "session file '%s'.", vdev->capturefile, sessionfile);
                return SR_ERR;
        }
 
-       if (!(vdevice->capfile = zip_fopen(vdevice->archive,
-                                          vdevice->capturefile, 0))) {
+       if (!(vdev->capfile = zip_fopen(vdev->archive, vdev->capturefile, 0))) {
                sr_err("session driver: Failed to open capture file '%s' in "
-                      "session file '%s'.", vdevice->capturefile, sessionfile);
+                      "session file '%s'.", vdev->capturefile, sessionfile);
                return SR_ERR;
        }
 
        /* freewheeling source */
-       sr_session_source_add(-1, 0, 0, feed_chunk, session_device_id);
+       sr_session_source_add(-1, 0, 0, feed_chunk, session_dev_id);
 
        if (!(packet = g_try_malloc(sizeof(struct sr_datafeed_packet)))) {
                sr_err("session driver: %s: packet malloc failed", __func__);
@@ -323,16 +322,16 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
        packet->payload = (unsigned char *)header;
        header->feed_version = 1;
        gettimeofday(&header->starttime, NULL);
-       header->samplerate = vdevice->samplerate;
-       header->num_logic_probes = vdevice->num_probes;
-       sr_session_bus(session_device_id, packet);
+       header->samplerate = vdev->samplerate;
+       header->num_logic_probes = vdev->num_probes;
+       sr_session_bus(session_dev_id, packet);
        g_free(header);
        g_free(packet);
 
        return SR_OK;
 }
 
-SR_PRIV struct sr_device_plugin session_driver = {
+SR_PRIV struct sr_dev_plugin session_driver = {
        "session",
        "Session-emulating driver",
        1,
@@ -340,7 +339,7 @@ SR_PRIV struct sr_device_plugin session_driver = {
        hw_cleanup,
        hw_opendev,
        NULL,
-       hw_get_device_info,
+       hw_get_dev_info,
        hw_get_status,
        hw_get_capabilities,
        hw_set_configuration,
index 007e089c52ecebec27a32dfa34d8036054e60b62..2883d0dc11bb47bf5362bef2a404a4c28e2e3ea7 100644 (file)
@@ -28,7 +28,7 @@
 #include "sigrok-internal.h"
 
 extern struct sr_session *session;
-extern SR_PRIV struct sr_device_plugin session_driver;
+extern SR_PRIV struct sr_dev_plugin session_driver;
 
 /**
  * Load the session from the specified filename.
@@ -47,7 +47,7 @@ SR_API int sr_session_load(const char *filename)
        struct zip_file *zf;
        struct zip_stat zs;
        struct sr_session *session;
-       struct sr_device *device;
+       struct sr_dev *dev;
        struct sr_probe *probe;
        int ret, err, probenum, devcnt, i, j;
        uint64_t tmp_u64, total_probes, enabled_probes, p;
@@ -109,46 +109,46 @@ SR_API int sr_session_load(const char *filename)
                        continue;
                if (!strncmp(sections[i], "device ", 7)) {
                        /* device section */
-                       device = NULL;
+                       dev = NULL;
                        enabled_probes = 0;
                        keys = g_key_file_get_keys(kf, sections[i], NULL, NULL);
                        for (j = 0; keys[j]; j++) {
                                val = g_key_file_get_string(kf, sections[i], keys[j], NULL);
                                if (!strcmp(keys[j], "capturefile")) {
-                                       device = sr_dev_new(&session_driver, devcnt);
+                                       dev = sr_dev_new(&session_driver, devcnt);
                                        if (devcnt == 0)
                                                /* first device, init the plugin */
-                                               device->plugin->init((char *)filename);
-                                       sr_session_device_add(device);
-                                       device->plugin->set_configuration(devcnt, SR_HWCAP_CAPTUREFILE, val);
+                                               dev->plugin->init((char *)filename);
+                                       sr_session_dev_add(dev);
+                                       dev->plugin->set_configuration(devcnt, SR_HWCAP_CAPTUREFILE, val);
                                        g_ptr_array_add(capturefiles, val);
                                } else if (!strcmp(keys[j], "samplerate")) {
                                        sr_parse_sizestring(val, &tmp_u64);
-                                       device->plugin->set_configuration(devcnt, SR_HWCAP_SAMPLERATE, &tmp_u64);
+                                       dev->plugin->set_configuration(devcnt, SR_HWCAP_SAMPLERATE, &tmp_u64);
                                } else if (!strcmp(keys[j], "unitsize")) {
                                        tmp_u64 = strtoull(val, NULL, 10);
-                                       device->plugin->set_configuration(devcnt, SR_HWCAP_CAPTURE_UNITSIZE, &tmp_u64);
+                                       dev->plugin->set_configuration(devcnt, SR_HWCAP_CAPTURE_UNITSIZE, &tmp_u64);
                                } else if (!strcmp(keys[j], "total probes")) {
                                        total_probes = strtoull(val, NULL, 10);
-                                       device->plugin->set_configuration(devcnt, SR_HWCAP_CAPTURE_NUM_PROBES, &total_probes);
+                                       dev->plugin->set_configuration(devcnt, SR_HWCAP_CAPTURE_NUM_PROBES, &total_probes);
                                        for (p = 0; p < total_probes; p++) {
                                                snprintf(probename, SR_MAX_PROBENAME_LEN, "%" PRIu64, p);
-                                               sr_dev_probe_add(device, probename);
+                                               sr_dev_probe_add(dev, probename);
                                        }
                                } else if (!strncmp(keys[j], "probe", 5)) {
-                                       if (!device)
+                                       if (!dev)
                                                continue;
                                        enabled_probes++;
                                        tmp_u64 = strtoul(keys[j]+5, NULL, 10);
-                                       sr_dev_probe_name(device, tmp_u64, val);
+                                       sr_dev_probe_name(dev, tmp_u64, val);
                                } else if (!strncmp(keys[j], "trigger", 7)) {
                                        probenum = strtoul(keys[j]+7, NULL, 10);
-                                       sr_dev_trigger_set(device, probenum, val);
+                                       sr_dev_trigger_set(dev, probenum, val);
                                }
                        }
                        g_strfreev(keys);
                        for (p = enabled_probes; p < total_probes; p++) {
-                               probe = g_slist_nth_data(device->probes, p);
+                               probe = g_slist_nth_data(dev->probes, p);
                                probe->enabled = FALSE;
                        }
                }
@@ -172,7 +172,7 @@ int sr_session_save(const char *filename)
 {
        GSList *l, *p, *d;
        FILE *meta;
-       struct sr_device *device;
+       struct sr_dev *dev;
        struct sr_probe *probe;
        struct sr_datastore *ds;
        struct zip *zipfile;
@@ -213,28 +213,28 @@ int sr_session_save(const char *filename)
 
        /* all datastores in all devices */
        devcnt = 1;
-       for (l = session->devices; l; l = l->next) {
-               device = l->data;
+       for (l = session->devs; l; l = l->next) {
+               dev = l->data;
                /* metadata */
                fprintf(meta, "[device %d]\n", devcnt);
-               if (device->plugin)
-                       fprintf(meta, "driver = %s\n", device->plugin->name);
+               if (dev->plugin)
+                       fprintf(meta, "driver = %s\n", dev->plugin->name);
 
-               ds = device->datastore;
+               ds = dev->datastore;
                if (ds) {
                        /* metadata */
                        fprintf(meta, "capturefile = logic-%d\n", devcnt);
                        fprintf(meta, "unitsize = %d\n", ds->ds_unitsize);
-                       fprintf(meta, "total probes = %d\n", g_slist_length(device->probes));
-                       if (sr_dev_has_hwcap(device, SR_HWCAP_SAMPLERATE)) {
-                               samplerate = *((uint64_t *) device->plugin->get_device_info(
-                                               device->plugin_index, SR_DI_CUR_SAMPLERATE));
+                       fprintf(meta, "total probes = %d\n", g_slist_length(dev->probes));
+                       if (sr_dev_has_hwcap(dev, SR_HWCAP_SAMPLERATE)) {
+                               samplerate = *((uint64_t *) dev->plugin->get_dev_info(
+                                               dev->plugin_index, SR_DI_CUR_SAMPLERATE));
                                s = sr_samplerate_string(samplerate);
                                fprintf(meta, "samplerate = %s\n", s);
                                g_free(s);
                        }
                        probecnt = 1;
-                       for (p = device->probes; p; p = p->next) {
+                       for (p = dev->probes; p; p = p->next) {
                                probe = p->data;
                                if (probe->enabled) {
                                        if (probe->name)
index d5b7d072a87e735997859196060d0533558abc4e..1a297f9988a2ceccd546943881fbecb58fee513a 100644 (file)
@@ -81,14 +81,13 @@ SR_PRIV void sr_hw_cleanup_all(void);
 
 /*--- session.c -------------------------------------------------------------*/
 
-SR_PRIV int sr_session_bus(struct sr_device *device,
+SR_PRIV int sr_session_bus(struct sr_dev *dev,
                           struct sr_datafeed_packet *packet);
 
 /* Generic device instances */
 SR_PRIV struct sr_dev_inst *sr_dev_inst_new(int index, int status,
                const char *vendor, const char *model, const char *version);
-SR_PRIV struct sr_dev_inst *sr_dev_inst_get(GSList *dev_insts,
-                                           int device_index);
+SR_PRIV struct sr_dev_inst *sr_dev_inst_get(GSList *dev_insts, int dev_index);
 SR_PRIV void sr_dev_inst_free(struct sr_dev_inst *sdi);
 
 SR_PRIV void sr_source_remove(int fd);
@@ -121,7 +120,7 @@ SR_PRIV int ezusb_upload_firmware(libusb_device *dev, int configuration,
 /*--- hardware/common/misc.c ------------------------------------------------*/
 
 #ifdef HAVE_LIBUSB_1_0
-SR_PRIV int opendev2(int device_index, struct sr_dev_inst **sdi,
+SR_PRIV int opendev2(int dev_index, struct sr_dev_inst **sdi,
                     libusb_device *dev, struct libusb_device_descriptor *des,
                     int *skip, uint16_t vid, uint16_t pid, int interface);
 SR_PRIV int opendev3(struct sr_dev_inst **sdi, libusb_device *dev,
index f133b3cc63eda09b50e1250afca6e1b367bea74b..4c96d30d24e840b3a7382ffb990957f7e5e37506 100644 (file)
@@ -49,19 +49,18 @@ SR_API int sr_datastore_put(struct sr_datastore *ds, void *data,
 
 SR_API int sr_dev_scan(void);
 SR_API GSList *sr_dev_list(void);
-SR_API struct sr_device *sr_dev_new(const struct sr_device_plugin *plugin,
-                                      int plugin_index);
-SR_API int sr_dev_probe_add(struct sr_device *device, const char *name);
-SR_API struct sr_probe *sr_dev_probe_find(const struct sr_device *device,
-                                            int probenum);
-SR_API int sr_dev_probe_name(struct sr_device *device, int probenum,
-                               const char *name);
-SR_API int sr_dev_trigger_clear(struct sr_device *device);
-SR_API int sr_dev_trigger_set(struct sr_device *device, int probenum,
-                                const char *trigger);
-SR_API gboolean sr_dev_has_hwcap(const struct sr_device *device, int hwcap);
-SR_API int sr_dev_info_get(const struct sr_device *device, int id,
-                             const void **data);
+SR_API struct sr_dev *sr_dev_new(const struct sr_dev_plugin *plugin,
+                                int plugin_index);
+SR_API int sr_dev_probe_add(struct sr_dev *dev, const char *name);
+SR_API struct sr_probe *sr_dev_probe_find(const struct sr_dev *dev,
+                                         int probenum);
+SR_API int sr_dev_probe_name(struct sr_dev *dev, int probenum,
+                            const char *name);
+SR_API int sr_dev_trigger_clear(struct sr_dev *dev);
+SR_API int sr_dev_trigger_set(struct sr_dev *dev, int probenum,
+                             const char *trigger);
+SR_API gboolean sr_dev_has_hwcap(const struct sr_dev *dev, int hwcap);
+SR_API int sr_dev_info_get(const struct sr_dev *dev, int id, const void **data);
 
 /*--- filter.c --------------------------------------------------------------*/
 
@@ -73,21 +72,21 @@ SR_API int sr_filter_probes(int in_unitsize, int out_unitsize,
 /*--- hwplugin.c ------------------------------------------------------------*/
 
 SR_API GSList *sr_hw_list(void);
-SR_API int sr_hw_init(struct sr_device_plugin *plugin);
-SR_API gboolean sr_hw_has_hwcap(struct sr_device_plugin *plugin, int hwcap);
+SR_API int sr_hw_init(struct sr_dev_plugin *plugin);
+SR_API gboolean sr_hw_has_hwcap(struct sr_dev_plugin *plugin, int hwcap);
 SR_API struct sr_hwcap_option *sr_hw_hwcap_get(int hwcap);
 
 /*--- session.c -------------------------------------------------------------*/
 
-typedef void (*sr_datafeed_callback) (struct sr_device *device,
+typedef void (*sr_datafeed_callback) (struct sr_dev *dev,
                                      struct sr_datafeed_packet *packet);
 
 /* Session setup */
 SR_API int sr_session_load(const char *filename);
 SR_API struct sr_session *sr_session_new(void);
 SR_API int sr_session_destroy(void);
-SR_API int sr_session_device_clear(void);
-SR_API int sr_session_device_add(struct sr_device *device);
+SR_API int sr_session_dev_clear(void);
+SR_API int sr_session_dev_add(struct sr_dev *dev);
 
 /* Datafeed setup */
 SR_API int sr_session_datafeed_callback_clear(void);
@@ -111,11 +110,11 @@ SR_API struct sr_input_format **sr_input_list(void);
 
 SR_API struct sr_output_format **sr_output_list(void);
 
-/*--- strutil.c -------------------------------------------------------*/
+/*--- strutil.c -------------------------------------------------------------*/
 
 SR_API char *sr_samplerate_string(uint64_t samplerate);
 SR_API char *sr_period_string(uint64_t frequency);
-SR_API char **sr_parse_triggerstring(struct sr_device *device,
+SR_API char **sr_parse_triggerstring(struct sr_dev *dev,
                                     const char *triggerstring);
 SR_API int sr_parse_sizestring(const char *sizestring, uint64_t *size);
 SR_API uint64_t sr_parse_timestring(const char *timestring);
index e8e770f6d87b089238c7bbc71d01bf70e10abd05..a7a92bf212e42fc52c500a5cde30a1558630df75 100644 (file)
--- a/sigrok.h
+++ b/sigrok.h
@@ -131,7 +131,7 @@ struct sr_datafeed_logic {
 struct sr_input {
        struct sr_input_format *format;
        char *param;
-       struct sr_device *vdevice;
+       struct sr_dev *vdev;
 };
 
 struct sr_input_format {
@@ -144,7 +144,7 @@ struct sr_input_format {
 
 struct sr_output {
        struct sr_output_format *format;
-       struct sr_device *device;
+       struct sr_dev *dev;
        char *param;
        void *internal;
 };
@@ -171,11 +171,11 @@ struct sr_datastore {
  * This represents a generic device connected to the system.
  * For device-specific information, ask the plugin. The plugin_index refers
  * to the device index within that plugin; it may be handling more than one
- * device. All relevant plugin calls take a device_index parameter for this.
+ * device. All relevant plugin calls take a dev_index parameter for this.
  */
-struct sr_device {
+struct sr_dev {
        /* Which plugin handles this device */
-       struct sr_device_plugin *plugin;
+       struct sr_dev_plugin *plugin;
        /* A plugin may handle multiple devices of the same type */
        int plugin_index;
        /* List of struct sr_probe* */
@@ -210,7 +210,7 @@ enum {
        /*--- Device types --------------------------------------------------*/
 
        /** The device is demo device. */
-       SR_HWCAP_DEMO_DEVICE,
+       SR_HWCAP_DEMO_DEV,
 
        /*--- Device options ------------------------------------------------*/
 
@@ -338,28 +338,28 @@ struct sr_samplerates {
        uint64_t *list;
 };
 
-struct sr_device_plugin {
+struct sr_dev_plugin {
        /* Plugin-specific */
        char *name;
        char *longname;
        int api_version;
-       int (*init) (const char *deviceinfo);
+       int (*init) (const char *devinfo);
        int (*cleanup) (void);
 
        /* Device-specific */
-       int (*opendev) (int device_index);
-       int (*closedev) (int device_index);
-       void *(*get_device_info) (int device_index, int device_info_id);
-       int (*get_status) (int device_index);
+       int (*opendev) (int dev_index);
+       int (*closedev) (int dev_index);
+       void *(*get_dev_info) (int dev_index, int dev_info_id);
+       int (*get_status) (int dev_index);
        int *(*get_capabilities) (void);
-       int (*set_configuration) (int device_index, int capability, void *value);
-       int (*start_acquisition) (int device_index, gpointer session_device_id);
-       int (*stop_acquisition) (int device_index, gpointer session_device_id);
+       int (*set_configuration) (int dev_index, int capability, void *value);
+       int (*start_acquisition) (int dev_index, gpointer session_dev_id);
+       int (*stop_acquisition) (int dev_index, gpointer session_dev_id);
 };
 
 struct sr_session {
-       /* List of struct sr_device* */
-       GSList *devices;
+       /* List of struct sr_dev* */
+       GSList *devs;
        /* list of sr_receive_data_callback */
        GSList *datafeed_callbacks;
        GTimeVal starttime;
index 9cd194ede5257722e4f971afb4554923251b4386..cb84e57f9c106cfbdf1b314a85b364c685de138e 100644 (file)
--- a/strutil.c
+++ b/strutil.c
@@ -108,12 +108,12 @@ SR_API char *sr_period_string(uint64_t frequency)
 /**
  * TODO
  *
- * @param device TODO
+ * @param dev TODO
  * @param triggerstring TODO
  *
  * @return TODO
  */
-SR_API char **sr_parse_triggerstring(struct sr_device *device,
+SR_API char **sr_parse_triggerstring(struct sr_dev *dev,
                                     const char *triggerstring)
 {
        GSList *l;
@@ -122,7 +122,7 @@ SR_API char **sr_parse_triggerstring(struct sr_device *device,
        char **tokens, **triggerlist, *trigger, *tc, *trigger_types;
        gboolean error;
 
-       max_probes = g_slist_length(device->probes);
+       max_probes = g_slist_length(dev->probes);
        error = FALSE;
 
        if (!(triggerlist = g_try_malloc0(max_probes * sizeof(char *)))) {
@@ -131,7 +131,7 @@ SR_API char **sr_parse_triggerstring(struct sr_device *device,
        }
 
        tokens = g_strsplit(triggerstring, ",", max_probes);
-       trigger_types = device->plugin->get_device_info(0, SR_DI_TRIGGER_TYPES);
+       trigger_types = dev->plugin->get_dev_info(0, SR_DI_TRIGGER_TYPES);
        if (trigger_types == NULL)
                return NULL;
 
@@ -139,7 +139,7 @@ SR_API char **sr_parse_triggerstring(struct sr_device *device,
                if (tokens[i][0] < '0' || tokens[i][0] > '9') {
                        /* Named probe */
                        probenum = 0;
-                       for (l = device->probes; l; l = l->next) {
+                       for (l = dev->probes; l; l = l->next) {
                                probe = (struct sr_probe *)l->data;
                                if (probe->enabled
                                    && !strncmp(probe->name, tokens[i],