diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2013-10-19 23:35:08 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2013-10-19 23:35:08 +0200 |
commit | 57bebabfc861fd8103f4a1e896ca28e88ddbadfe (patch) | |
tree | 2764a52f186940af8ead5bbd72d0a95dbe89206e /libk8055 | |
parent | 84613267f60f0b8e2f7ed3f815d88b9a0041f15a (diff) | |
download | k8055-57bebabfc861fd8103f4a1e896ca28e88ddbadfe.zip k8055-57bebabfc861fd8103f4a1e896ca28e88ddbadfe.tar.gz |
libk8055: fix calls to libusb_set_debug() with unititialized libusb
Diffstat (limited to 'libk8055')
-rw-r--r-- | libk8055/libk8055.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libk8055/libk8055.c b/libk8055/libk8055.c index 40bf6bd..db4ddf3 100644 --- a/libk8055/libk8055.c +++ b/libk8055/libk8055.c @@ -228,7 +228,8 @@ static int k8055_takeover_device( struct k8055_dev* dev, int interface ) { } int k8055_set_debug( struct k8055_dev* dev, int level ) { - libusb_set_debug( dev->usb_ctx, level); + if (dev->usb_ctx) + libusb_set_debug( dev->usb_ctx, level); return dev->debug_level = level; } @@ -246,6 +247,7 @@ int k8055_open_device( struct k8055_dev* dev, int board_address ) { libusb_device** list; libusb_device* found = NULL; libusb_init( &dev->usb_ctx ); + libusb_set_debug( dev->usb_ctx, dev->debug_level); ssize_t cnt = libusb_get_device_list( dev->usb_ctx, &list ); if( cnt<0 ) { if( dev->debug_level>0 ) fprintf( stderr, "Unable to list usb devices\n" ); |