From b1da188cedec2b0b0fe6551265a33b2e0c0a087d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Tue, 26 Nov 2013 11:30:08 +0100 Subject: improve debug level support lib do not segfault when there is no open device and sett the desired level when a device is opened k8055cmd set level to 3 on -debug --- libk8055/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libk8055/main.c b/libk8055/main.c index 92a37f8..41ba33c 100644 --- a/libk8055/main.c +++ b/libk8055/main.c @@ -157,12 +157,12 @@ int main ( int argc,char* params[] ) { fprintf(stderr,"Could not allocate data for k8055_dev struct.\n"); return ( EXIT_FAILURE ); } + if ( debug ) + k8055_set_debug(dev,3); if ( k8055_open_device( dev, ipid )<0 ) { fprintf(stderr,"Could not open the k8055 (port:%d)\nPlease ensure that the device is correctly connected.\n",ipid ); return ( EXIT_FAILURE ); } else { - if ( debug ) - k8055_set_debug(dev,2); if ( resetcnt1 ) k8055_reset_counter( dev,1 ); if ( resetcnt2 ) -- cgit v1.1-2-g2b99