summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2011-02-28 00:55:24 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2011-02-28 00:55:24 +0100
commit4f654ed1f3164fc46dc9c3d693bc4676ac80b13c (patch)
tree9a456252d8145165f026b86b12c1a7330b4a6a13
parent0d9639c386fa9205b505ea12fb230938ad85a5be (diff)
downloadk8055-4f654ed1f3164fc46dc9c3d693bc4676ac80b13c.zip
k8055-4f654ed1f3164fc46dc9c3d693bc4676ac80b13c.tar.gz
small OpenDevice fixe
-rw-r--r--libk8055/libk8055.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libk8055/libk8055.c b/libk8055/libk8055.c
index 3827e80..03925c9 100644
--- a/libk8055/libk8055.c
+++ b/libk8055/libk8055.c
@@ -220,6 +220,7 @@ int OpenDevice( long board_address ) {
if(takeover_device(kdev->device_handle, 0)<0) {
if(debug) fprintf(stderr, "Can not take over the device from the OS driver\n");
usb_close(kdev->device_handle);
+ kdev->device_handle = NULL;
return K8055_ERROR;
} else {
memset(kdev->data_out,0,PACKET_LEN);
@@ -227,12 +228,14 @@ int OpenDevice( long board_address ) {
kdev->data_out[0] = CMD_RESET;
k8055_write(kdev);
if (k8055_read(kdev)==0) {
- if(debug) fprintf(stderr, "OKOK\n");
+ if(debug) fprintf(stderr, "Device %d ready\n",board_address);
curr_dev = kdev;
return board_address;
} else {
+ if(debug) fprintf(stderr, "Device %d not ready\n",board_address);
kdev->dev_no = 0;
usb_close(kdev->device_handle);
+ kdev->device_handle = NULL;
return K8055_ERROR;
}
}