From: Lars-Peter Clausen Date: Sat, 14 May 2016 15:24:27 +0000 (+0200) Subject: ftdi-la: Use the standard connection_id field for the device address X-Git-Tag: libsigrok-0.5.0~382 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=634d72997a43f8a69d3ab1d06a341d9faeec7724;p=libsigrok.git ftdi-la: Use the standard connection_id field for the device address Use the standard connection_id field from the struct sr_dev_inst for storing the device address rather than using the custom address field in the driver state struct. This makes things more consistent with the framework. Signed-off-by: Lars-Peter Clausen --- diff --git a/src/hardware/ftdi-la/api.c b/src/hardware/ftdi-la/api.c index c3c3891f..7bf0e13d 100644 --- a/src/hardware/ftdi-la/api.c +++ b/src/hardware/ftdi-la/api.c @@ -116,9 +116,6 @@ static void scan_device(struct sr_dev_driver *di, struct ftdi_context *ftdic, /* Allocate memory for the incoming data. */ devc->data_buf = g_malloc0(DATA_BUF_SIZE); - snprintf(devc->address, sizeof(devc->address), "d:%u/%u", - libusb_get_bus_number(dev), libusb_get_device_address(dev)); - devc->desc = desc; vendor = g_malloc(32); @@ -148,6 +145,8 @@ static void scan_device(struct sr_dev_driver *di, struct ftdi_context *ftdic, sdi->serial_num = serial_num; sdi->driver = di; sdi->priv = devc; + sdi->connection_id = g_strdup_printf("d:%u/%u", + libusb_get_bus_number(dev), libusb_get_device_address(dev)); for (char *const *chan = &(desc->channel_names[0]); *chan; chan++) sr_channel_new(sdi, chan - &(desc->channel_names[0]), @@ -274,7 +273,7 @@ static int dev_open(struct sr_dev_inst *sdi) if (!devc->ftdic) return SR_ERR; - ret = ftdi_usb_open_string(devc->ftdic, devc->address); + ret = ftdi_usb_open_string(devc->ftdic, sdi->connection_id); if (ret < 0) { /* Log errors, except for -3 ("device not found"). */ if (ret != -3) diff --git a/src/hardware/ftdi-la/protocol.h b/src/hardware/ftdi-la/protocol.h index ab8ac5c3..d5ba9b09 100644 --- a/src/hardware/ftdi-la/protocol.h +++ b/src/hardware/ftdi-la/protocol.h @@ -40,7 +40,6 @@ struct ftdi_chip_desc { struct dev_context { struct ftdi_context *ftdic; const struct ftdi_chip_desc *desc; - char address[sizeof("d:000:000")]; uint64_t limit_samples; uint32_t cur_samplerate;