- serial_source_add(sdi->session, serial, G_IO_IN, -1,
- ols_receive_data, cb_data);
+ /* If the device stops sending for longer than it takes to send a byte,
+ * that means it's finished. But wait at least 100 ms to be safe.
+ */
+ serial_source_add(sdi->session, serial, G_IO_IN, 100,
+ ols_receive_data, (struct sr_dev_inst *)sdi);