extern SR_PRIV struct sr_dev_driver session_driver;
static int session_driver_initialized = 0;
-
/** @private */
SR_PRIV int sr_sessionfile_check(const char *filename)
{
struct zip_file *zf;
struct zip_stat zs;
struct sr_dev_inst *sdi;
+ struct sr_channel *ch;
int ret, i, j;
uint64_t tmp_u64, total_channels, p;
char **sections, **keys, *metafile, *val;
if (!session_driver_initialized) {
/* first device, init the driver */
session_driver_initialized = 1;
- sdi->driver->init(NULL);
+ sdi->driver->init(sdi->driver, NULL);
}
sr_dev_open(sdi);
sr_session_dev_add(*session, sdi);
ret = SR_ERR_DATA;
break;
}
- tmp_u64 = strtoul(keys[j]+5, NULL, 10);
+ tmp_u64 = strtoul(keys[j]+5, NULL, 10) - 1;
+ ch = g_slist_nth_data(sdi->channels, tmp_u64);
/* sr_session_save() */
- sr_dev_channel_name_set(sdi, tmp_u64 - 1, val);
- sr_dev_channel_enable(sdi, tmp_u64 - 1, TRUE);
+ sr_dev_channel_name_set(ch, val);
+ sr_dev_channel_enable(ch, TRUE);
}
}
g_strfreev(keys);