]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/ikalogic-scanaplus/api.c
license: remove FSF postal address from boiler plate license text
[libsigrok.git] / src / hardware / ikalogic-scanaplus / api.c
index 045476243e8ce7c1f5fa2baf901e84085f7cbc8c..4a9491b896ce2719f3d5f16f33c782958ac48d0a 100644 (file)
@@ -14,8 +14,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <config.h>
@@ -66,18 +65,12 @@ static int dev_clear(const struct sr_dev_driver *di)
 static GSList *scan(struct sr_dev_driver *di, GSList *options)
 {
        struct sr_dev_inst *sdi;
-       struct drv_context *drvc;
        struct dev_context *devc;
-       GSList *devices;
        unsigned int i;
        int ret;
 
        (void)options;
 
-       drvc = di->context;
-
-       devices = NULL;
-
        /* Allocate memory for our private device context. */
        devc = g_malloc0(sizeof(struct dev_context));
 
@@ -115,19 +108,15 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        sdi->status = SR_ST_INACTIVE;
        sdi->vendor = g_strdup(USB_VENDOR_NAME);
        sdi->model = g_strdup(USB_MODEL_NAME);
-       sdi->driver = di;
        sdi->priv = devc;
 
        for (i = 0; i < ARRAY_SIZE(channel_names); i++)
                sr_channel_new(sdi, i, SR_CHANNEL_LOGIC, TRUE, channel_names[i]);
 
-       devices = g_slist_append(devices, sdi);
-       drvc->instances = g_slist_append(drvc->instances, sdi);
-
        /* Close device. We'll reopen it again when we need it. */
        scanaplus_close(devc);
 
-       return devices;
+       return std_scan_complete(di, g_slist_append(NULL, sdi));
 
        scanaplus_close(devc);
 err_free_ftdic:
@@ -359,7 +348,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        if ((ret = scanaplus_start_acquisition(devc)) < 0)
                return ret;
 
-       std_session_send_df_header(sdi, LOG_PREFIX);
+       std_session_send_df_header(sdi);
 
        /* Hook up a dummy handler to receive data from the device. */
        sr_session_source_add(sdi->session, -1, 0, 0, scanaplus_receive_data, (void *)sdi);
@@ -371,12 +360,12 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
 {
        sr_dbg("Stopping acquisition.");
        sr_session_source_remove(sdi->session, -1);
-       std_session_send_df_end(sdi, LOG_PREFIX);
+       std_session_send_df_end(sdi);
 
        return SR_OK;
 }
 
-SR_PRIV struct sr_dev_driver ikalogic_scanaplus_driver_info = {
+static struct sr_dev_driver ikalogic_scanaplus_driver_info = {
        .name = "ikalogic-scanaplus",
        .longname = "IKALOGIC ScanaPLUS",
        .api_version = 1,
@@ -394,3 +383,4 @@ SR_PRIV struct sr_dev_driver ikalogic_scanaplus_driver_info = {
        .dev_acquisition_stop = dev_acquisition_stop,
        .context = NULL,
 };
+SR_REGISTER_DEV_DRIVER(ikalogic_scanaplus_driver_info);