]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/ftdi-la/api.c
Consistently use the "Sysclk" spelling everywhere.
[libsigrok.git] / src / hardware / ftdi-la / api.c
index d435c64a8bab49d5cbea94fc3e001c84123a753a..cee2f0328fdb0ee60f3abc37f35a0b3617261f7a 100644 (file)
@@ -50,14 +50,8 @@ static const struct ftdi_chip_desc ft2232h_desc = {
        .product = 0x6010,
        .samplerate_div = 20,
        .channel_names = {
-               "ADBUS0",
-               "ADBUS1",
-               "ADBUS2",
-               "ADBUS3",
-               "ADBUS4",
-               "ADBUS5",
-               "ADBUS6",
-               "ADBUS7",
+               "ADBUS0", "ADBUS1", "ADBUS2", "ADBUS3",
+               "ADBUS4", "ADBUS5", "ADBUS6", "ADBUS7",
                /* TODO: BDBUS[0..7] channels. */
                NULL
        }
@@ -68,14 +62,17 @@ static const struct ftdi_chip_desc ft232r_desc = {
        .product = 0x6001,
        .samplerate_div = 30,
        .channel_names = {
-               "TXD",
-               "RXD",
-               "RTS#",
-               "CTS#",
-               "DTR#",
-               "DSR#",
-               "DCD#",
-               "RI#",
+               "TXD", "RXD", "RTS#", "CTS#", "DTR#", "DSR#", "DCD#", "RI#",
+               NULL
+       }
+};
+
+static const struct ftdi_chip_desc ft232h_desc = {
+       .vendor = 0x0403,
+       .product = 0x6014,
+       .samplerate_div = 30,
+       .channel_names = {
+               "ADBUS0", "ADBUS1", "ADBUS2", "ADBUS3", "ADBUS4", "ADBUS5", "ADBUS6", "ADBUS7",
                NULL
        }
 };
@@ -83,6 +80,7 @@ static const struct ftdi_chip_desc ft232r_desc = {
 static const struct ftdi_chip_desc *chip_descs[] = {
        &ft2232h_desc,
        &ft232r_desc,
+       &ft232h_desc,
 };
 
 static void scan_device(struct ftdi_context *ftdic,
@@ -323,7 +321,6 @@ static int config_get(uint32_t key, GVariant **data,
 {
        struct dev_context *devc;
        struct sr_usb_dev_inst *usb;
-       char str[128];
 
        (void)cg;
 
@@ -337,8 +334,7 @@ static int config_get(uint32_t key, GVariant **data,
                if (!sdi || !sdi->conn)
                        return SR_ERR_ARG;
                usb = sdi->conn;
-               snprintf(str, 128, "%d.%d", usb->bus, usb->address);
-               *data = g_variant_new_string(str);
+               *data = g_variant_new_printf("%d.%d", usb->bus, usb->address);
                break;
        default:
                return SR_ERR_NA;
@@ -361,10 +357,9 @@ static int config_set(uint32_t key, GVariant *data,
        case SR_CONF_LIMIT_MSEC:
                value = g_variant_get_uint64(data);
                /* TODO: Implement. */
+               (void)value;
                return SR_ERR_NA;
        case SR_CONF_LIMIT_SAMPLES:
-               if (g_variant_get_uint64(data) == 0)
-                       return SR_ERR_ARG;
                devc->limit_samples = g_variant_get_uint64(data);
                break;
        case SR_CONF_SAMPLERATE:
@@ -388,7 +383,7 @@ static int config_list(uint32_t key, GVariant **data,
        case SR_CONF_DEVICE_OPTIONS:
                return STD_CONFIG_LIST(key, data, sdi, cg, scanopts, drvopts, devopts);
        case SR_CONF_SAMPLERATE:
-               *data = std_gvar_samplerates_steps(samplerates, ARRAY_SIZE(samplerates));
+               *data = std_gvar_samplerates_steps(ARRAY_AND_SIZE(samplerates));
                break;
        default:
                return SR_ERR_NA;