]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/pipistrello-ols/protocol.c
Fix a bunch of typos.
[libsigrok.git] / src / hardware / pipistrello-ols / protocol.c
index 272c8a8c3baa6f34206a9552cb12b3146de00f58..c9e4e5d8bdbb076dfdc0706f87e10eeb1201d72e 100644 (file)
@@ -20,7 +20,6 @@
 #include "protocol.h"
 
 extern SR_PRIV struct sr_dev_driver p_ols_driver_info;
-static struct sr_dev_driver *di = &p_ols_driver_info;
 
 SR_PRIV int write_shortcommand(struct dev_context *devc, uint8_t command)
 {
@@ -219,7 +218,6 @@ SR_PRIV int pols_convert_trigger(const struct sr_dev_inst *sdi)
 SR_PRIV struct sr_dev_inst *p_ols_get_metadata(uint8_t *buf, int bytes_read, struct dev_context *devc)
 {
        struct sr_dev_inst *sdi;
-       struct sr_channel *ch;
        uint32_t tmp_int, ui;
        uint8_t key, type, token;
        GString *tmp_str, *devname, *version;
@@ -228,7 +226,7 @@ SR_PRIV struct sr_dev_inst *p_ols_get_metadata(uint8_t *buf, int bytes_read, str
 
        sdi = g_malloc0(sizeof(struct sr_dev_inst));
        sdi->status = SR_ST_INACTIVE;
-       sdi->driver = di;
+       sdi->driver = &p_ols_driver_info;
        sdi->priv = devc;
 
        devname = g_string_new("");
@@ -288,11 +286,9 @@ SR_PRIV struct sr_dev_inst *p_ols_get_metadata(uint8_t *buf, int bytes_read, str
                        switch (token) {
                        case 0x00:
                                /* Number of usable channels */
-                               for (ui = 0; ui < tmp_int; ui++) {
-                                       ch = sr_channel_new(ui, SR_CHANNEL_LOGIC, TRUE,
+                               for (ui = 0; ui < tmp_int; ui++)
+                                       sr_channel_new(sdi, ui, SR_CHANNEL_LOGIC, TRUE,
                                                        p_ols_channel_names[ui]);
-                                       sdi->channels = g_slist_append(sdi->channels, ch);
-                               }
                                break;
                        case 0x01:
                                /* Amount of sample memory available (bytes) */
@@ -303,7 +299,7 @@ SR_PRIV struct sr_dev_inst *p_ols_get_metadata(uint8_t *buf, int bytes_read, str
                                /* what is this for? */
                                break;
                        case 0x03:
-                               /* Maximum sample rate (hz) */
+                               /* Maximum sample rate (Hz) */
                                devc->max_samplerate = tmp_int;
                                break;
                        case 0x04:
@@ -324,11 +320,9 @@ SR_PRIV struct sr_dev_inst *p_ols_get_metadata(uint8_t *buf, int bytes_read, str
                        switch (token) {
                        case 0x00:
                                /* Number of usable channels */
-                               for (ui = 0; ui < tmp_c; ui++) {
-                                       ch = sr_channel_new(ui, SR_CHANNEL_LOGIC, TRUE,
+                               for (ui = 0; ui < tmp_c; ui++)
+                                       sr_channel_new(sdi, ui, SR_CHANNEL_LOGIC, TRUE,
                                                        p_ols_channel_names[ui]);
-                                       sdi->channels = g_slist_append(sdi->channels, ch);
-                               }
                                break;
                        case 0x01:
                                /* protocol version */
@@ -390,7 +384,6 @@ SR_PRIV int p_ols_set_samplerate(const struct sr_dev_inst *sdi,
        return SR_OK;
 }
 
-
 SR_PRIV int p_ols_receive_data(int fd, int revents, void *cb_data)
 {
        struct dev_context *devc;