]> sigrok.org Git - libsigrok.git/blobdiff - hwplugin.c
sr: adjust copyright year
[libsigrok.git] / hwplugin.c
index 06cd96905397c4c42d9ca2f97947a4fa8d74463c..4ad7502b7705068ec241f4ce5c37696944f2e862 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the sigrok project.
  *
- * Copyright (C) 2010 Bert Vermeulen <bert@biot.com>
+ * Copyright (C) 2010-2012 Bert Vermeulen <bert@biot.com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -100,12 +100,31 @@ SR_PRIV int load_hwplugins(void)
        return SR_OK;
 }
 
+/**
+ * Returns the list of loaded hardware plugins.
+ *
+ * The list of plugins is initialized from sr_init(), and can only be reset
+ * by calling sr_exit().
+ *
+ * @return A GSList of pointers to loaded plugins.
+ */
 SR_API GSList *sr_list_hwplugins(void)
 {
+
        return plugins;
 }
 
-SR_API int sr_init_hwplugins(struct sr_device_plugin *plugin)
+/**
+ * Initialize a hardware plugin.
+ *
+ * The specified plugin is initialized, and all devices discovered by the
+ * plugin are instantiated.
+ *
+ * @param plugin The plugin to initialize.
+ *
+ * @return The number of devices found and instantiated by the plugin.
+ */
+SR_API int sr_init_hwplugin(struct sr_device_plugin *plugin)
 {
        int num_devices, num_probes, i, j;
        int num_initialized_devices = 0;
@@ -126,9 +145,9 @@ SR_API int sr_init_hwplugins(struct sr_device_plugin *plugin)
                        continue;
                }
 
-               device = sr_device_new(plugin, i);
+               device = sr_dev_new(plugin, i);
                for (j = 0; j < num_probes; j++)
-                       sr_device_probe_add(device, probe_names[j]);
+                       sr_dev_probe_add(device, probe_names[j]);
                num_initialized_devices++;
        }
 
@@ -244,7 +263,16 @@ SR_PRIV void sr_serial_device_instance_free(
        g_free(serial->port);
 }
 
-SR_API int sr_find_hwcap(int *capabilities, int hwcap)
+/**
+ * Find out if a list of hardware plugin capabilities has a specific cap.
+ *
+ * @param capabilities A NULL-terminated integer array of capabilities, as
+ * returned by a plugin's get_capabilities() function.
+ * @param hwcap The capability to find in the list.
+ *
+ * @return Returns TRUE if found, FALSE otherwise.
+ */
+SR_API gboolean sr_has_hwcap(int *capabilities, int hwcap)
 {
        int i;
 
@@ -256,6 +284,14 @@ SR_API int sr_find_hwcap(int *capabilities, int hwcap)
        return FALSE;
 }
 
+/**
+ * Find a hardware plugin capability option parameter structure.
+ *
+ * @param hwcap The capability to find
+ *
+ * @return Returns a struct with information about the parameter, or NULL
+ * if not found.
+ */
 SR_API struct sr_hwcap_option *sr_find_hwcap_option(int hwcap)
 {
        int i;