From 9c1487b28697874a0ebbc7bc01204584150422c1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= <jeremy@asynk.ch>
Date: Thu, 24 Feb 2011 23:41:27 +0100
Subject: define READ_RETRY and WRITE_RETRY

---
 libk8055/libk8055.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libk8055/libk8055.c b/libk8055/libk8055.c
index 296f9cb..ad714ab 100644
--- a/libk8055/libk8055.c
+++ b/libk8055/libk8055.c
@@ -88,6 +88,8 @@
 
 #define STR_BUFF 256
 #define PACKET_LEN 8
+#define READ_RETRY 3
+#define WRITE_RETRY 3
 
 #define K8055_IPID 0x5500
 #define VELLEMAN_VENDOR_ID 0x10cf
@@ -153,7 +155,7 @@ static int ReadK8055Data(void)
 
     if (curr_dev->DevNo == 0) return K8055_ERROR;
 
-    for(i=0; i < 3; i++)
+    for(i=0; i < READ_RETRY; i++)
         {
         read_status = usb_interrupt_read(curr_dev->device_handle, USB_INP_EP, (char *)curr_dev->data_in, PACKET_LEN, USB_TIMEOUT);
         if ((read_status == PACKET_LEN) && (curr_dev->data_in[1] == curr_dev->DevNo )) return 0;
@@ -171,7 +173,7 @@ static int WriteK8055Data(unsigned char cmd)
     if (curr_dev->DevNo == 0) return K8055_ERROR;
 
     curr_dev->data_out[0] = cmd;
-    for(i=0; i < 3; i++)
+    for(i=0; i < WRITE_RETRY; i++)
         {
         write_status = usb_interrupt_write(curr_dev->device_handle, USB_OUT_EP, (char *)curr_dev->data_out, PACKET_LEN, USB_TIMEOUT);
         if (write_status == PACKET_LEN) return 0;
-- 
cgit v1.1-2-g2b99