]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/atten-pps3xxx/protocol.c
usb: Skip add/remove of FD on destroyed source
[libsigrok.git] / src / hardware / atten-pps3xxx / protocol.c
index 66ecb7a28ff2cde835de7db59c122e3685283963..582a10d2bcf56f698b3f25db6efa167caa87828e 100644 (file)
@@ -17,8 +17,8 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include <string.h>
-#include <errno.h>
 #include "protocol.h"
 
 static void dump_packet(char *msg, uint8_t *packet)
@@ -83,11 +83,13 @@ static void handle_packet(const struct sr_dev_inst *sdi)
 
 SR_PRIV void send_packet(const struct sr_dev_inst *sdi, uint8_t *packet)
 {
+       struct dev_context *devc;
        struct sr_serial_dev_inst *serial;
 
+       devc = sdi->priv;
        serial = sdi->conn;
-       if (serial_write_blocking(serial, packet, PACKET_SIZE) == -1)
-               sr_dbg("Failed to send packet: %s", strerror(errno));
+       if (serial_write_blocking(serial, packet, PACKET_SIZE, devc->delay_ms) < PACKET_SIZE)
+               sr_dbg("Failed to send packet.");
        dump_packet("sent", packet);
 }
 
@@ -162,4 +164,3 @@ SR_PRIV int atten_pps3xxx_receive_data(int fd, int revents, void *cb_data)
 
        return TRUE;
 }
-