]> sigrok.org Git - libsigrok.git/commitdiff
Fix the channel indexes of the es51919 driver.
authorJanne Huttunen <redacted>
Fri, 19 Dec 2014 19:45:56 +0000 (21:45 +0200)
committerUwe Hermann <redacted>
Tue, 6 Jan 2015 19:10:17 +0000 (20:10 +0100)
Set the channel indexes to unique values instead of setting
them all zero.

src/lcr/es51919.c

index 55ea66271a4a502ac82e896e395b6d30ab2a6274..59dc194c5f4d795db1e6379994746f1a92d852b5 100644 (file)
@@ -775,11 +775,11 @@ static int receive_data(int fd, int revents, void *cb_data)
        return TRUE;
 }
 
-static int add_channel(struct sr_dev_inst *sdi, const char *name)
+static int add_channel(struct sr_dev_inst *sdi, int idx, const char *name)
 {
        struct sr_channel *ch;
 
-       ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, name);
+       ch = sr_channel_new(idx, SR_CHANNEL_ANALOG, TRUE, name);
        sdi->channels = g_slist_append(sdi->channels, ch);
 
        return SR_OK;
@@ -795,7 +795,7 @@ static int setup_channels(struct sr_dev_inst *sdi)
        ret = SR_ERR_BUG;
 
        for (i = 0; i < ARRAY_SIZE(channel_names); i++) {
-               ret = add_channel(sdi, channel_names[i]);
+               ret = add_channel(sdi, i, channel_names[i]);
                if (ret != SR_OK)
                        break;
        }