From 4f654ed1f3164fc46dc9c3d693bc4676ac80b13c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Mon, 28 Feb 2011 00:55:24 +0100 Subject: small OpenDevice fixe --- libk8055/libk8055.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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; } } -- cgit v1.1-2-g2b99