if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) {
sr_err("ols: %s: devc malloc failed", __func__);
return NULL;
if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) {
sr_err("ols: %s: devc malloc failed", __func__);
return NULL;
/* The discovery procedure is like this: first send the Reset
* command (0x00) 5 times, since the device could be anywhere
* in a 5-byte command. Then send the ID command (0x02).
* If the device responds with 4 bytes ("OLS1" or "SLA1"), we
* have a match.
/* The discovery procedure is like this: first send the Reset
* command (0x00) 5 times, since the device could be anywhere
* in a 5-byte command. Then send the ID command (0x02).
* If the device responds with 4 bytes ("OLS1" or "SLA1"), we
* have a match.
*/
sr_info("ols: probing %s .", conn);
fd = serial_open(conn, O_RDWR | O_NONBLOCK);
*/
sr_info("ols: probing %s .", conn);
fd = serial_open(conn, O_RDWR | O_NONBLOCK);
ret = SR_OK;
for (i = 0; i < 5; i++) {
if ((ret = send_shortcommand(fd, CMD_RESET)) != SR_OK) {
ret = SR_OK;
for (i = 0; i < 5; i++) {
if ((ret = send_shortcommand(fd, CMD_RESET)) != SR_OK) {
- g_poll(&probefd/*fds*/, 1/*devcnt*/, 1);
+ probefd.fd = fd;
+ probefd.events = G_IO_IN;
+ g_poll(&probefd, 1, 1);
if (strncmp(buf, "1SLO", 4) && strncmp(buf, "1ALS", 4))
return NULL;
if (strncmp(buf, "1SLO", 4) && strncmp(buf, "1ALS", 4))
return NULL;
- /* not an OLS -- some other board that uses the sump protocol */
- sdi = sr_dev_inst_new(final_devcnt, SR_ST_INACTIVE,
+ /* Not an OLS -- some other board that uses the sump protocol. */
+ sdi = sr_dev_inst_new(0, SR_ST_INACTIVE,
drvc->instances = g_slist_append(drvc->instances, sdi);
devices = g_slist_append(devices, sdi);
drvc->instances = g_slist_append(drvc->instances, sdi);
devices = g_slist_append(devices, sdi);