summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2011-02-24 23:41:27 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2011-02-24 23:41:27 +0100
commit9c1487b28697874a0ebbc7bc01204584150422c1 (patch)
tree519e387c8b054c5194df3d4f1c987b3a39d46034
parentddebede201d2514949480b17111ff21f92ab6cea (diff)
downloadk8055-9c1487b28697874a0ebbc7bc01204584150422c1.zip
k8055-9c1487b28697874a0ebbc7bc01204584150422c1.tar.gz
define READ_RETRY and WRITE_RETRY
-rw-r--r--libk8055/libk8055.c6
1 files 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;