- while (!devices && retry < 3) {
- retry++;
-
- /* Let's get a bit of data and see if we can find a packet. */
- len = sizeof(buf);
- serial_readline(fd, &b, &len, 500);
- if ((len == 0) || (len < LCD14_PACKET_SIZE)) {
- /* Not enough data received, is the DMM connected? */
- continue;
- }
-
- /* Let's treat our buffer like a stream, and find any
- * valid packets */
- for (i = 0; i < len - LCD14_PACKET_SIZE + 1;) {
- packet = (void *)(&buf[i]);
- if (!lcd14_is_packet_valid(packet, NULL)) {
- i++;
- continue;
- }
- good_packets++;
- i += LCD14_PACKET_SIZE;
- }