- if (transfer->actual_length == 8) {
- /* CH9325 encodes length in low nibble of first byte, with
- * bytes 1-7 being the (padded) payload. */
- hid_payload_len = transfer->buffer[0] & 0x0f;
- memcpy(devc->packet + devc->packet_len, transfer->buffer + 1,
- hid_payload_len);
- devc->packet_len += hid_payload_len;
- /*
- * Discard receive data when the buffer is exhausted. This shall
- * allow to (re-)synchronize to the data stream when we find it
- * in an arbitrary state. Check the receive buffer for packets.
- */
- if (devc->packet_len == sizeof(devc->packet)) {
- process_packet(sdi, &devc->packet[0], devc->packet_len);
- devc->packet_len = 0;
- }
- process_buffer(sdi);
+ serial = sdi->conn;
+
+ /*
+ * Discard receive data when the buffer is exhausted. This shall
+ * allow to (re-)synchronize to the data stream when we find it
+ * in an arbitrary state. Drain more data from the serial port,
+ * and check the receive buffer for packets.
+ */
+ if (devc->packet_len == sizeof(devc->packet)) {
+ process_packet(sdi, &devc->packet[0], devc->packet_len);
+ devc->packet_len = 0;