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 <lars@metafoo.de>
This commit is contained in:
parent
07a917521a
commit
634d72997a
|
@ -116,9 +116,6 @@ static void scan_device(struct sr_dev_driver *di, struct ftdi_context *ftdic,
|
||||||
/* Allocate memory for the incoming data. */
|
/* Allocate memory for the incoming data. */
|
||||||
devc->data_buf = g_malloc0(DATA_BUF_SIZE);
|
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;
|
devc->desc = desc;
|
||||||
|
|
||||||
vendor = g_malloc(32);
|
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->serial_num = serial_num;
|
||||||
sdi->driver = di;
|
sdi->driver = di;
|
||||||
sdi->priv = devc;
|
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++)
|
for (char *const *chan = &(desc->channel_names[0]); *chan; chan++)
|
||||||
sr_channel_new(sdi, chan - &(desc->channel_names[0]),
|
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)
|
if (!devc->ftdic)
|
||||||
return SR_ERR;
|
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) {
|
if (ret < 0) {
|
||||||
/* Log errors, except for -3 ("device not found"). */
|
/* Log errors, except for -3 ("device not found"). */
|
||||||
if (ret != -3)
|
if (ret != -3)
|
||||||
|
|
|
@ -40,7 +40,6 @@ struct ftdi_chip_desc {
|
||||||
struct dev_context {
|
struct dev_context {
|
||||||
struct ftdi_context *ftdic;
|
struct ftdi_context *ftdic;
|
||||||
const struct ftdi_chip_desc *desc;
|
const struct ftdi_chip_desc *desc;
|
||||||
char address[sizeof("d:000:000")];
|
|
||||||
|
|
||||||
uint64_t limit_samples;
|
uint64_t limit_samples;
|
||||||
uint32_t cur_samplerate;
|
uint32_t cur_samplerate;
|
||||||
|
|
Loading…
Reference in New Issue