Commit b9210b1a authored by Claes Sjofors's avatar Claes Sjofors

Velleman I/O, specific error message when linked with dummy library

parent 1d148b61
......@@ -44,9 +44,14 @@ static pwr_tStatus IoAgentInit( io_tCtx ctx,
sts = libusb_init( &local->libusb_ctx);
if ( sts != 0) {
op->Status = sts;
if ( sts == io_cLibDummy)
op->Status = IO__DUMMYBUILD;
else
op->Status = IO__INITFAIL;
errh_Error( "Init of USB agent failed '%s', error status %d", ap->Name, sts);
local->libusb_ctx = 0;
errh_Error( "Init of USB agent failed '%s'", ap->Name);
return op->Status;
}
else {
op->Status = IO__SUCCESS;
......
......@@ -86,10 +86,13 @@ static pwr_tStatus IoCardInit( io_tCtx ctx,
sts = libusb_open( device, &local->libusb_device);
if ( sts != 0) {
if ( sts == io_cLibDummy)
op->Status = IO__DUMMYBUILD;
else
op->Status = IO__INITFAIL;
((pwr_sClass_Velleman_K8055 *)rp->op)->Status = op->Status;
local->libusb_device = 0;
return IO__INITFAIL;
return op->Status;
}
if ( libusb_kernel_driver_active( local->libusb_device, 0) != 0)
......
......@@ -3,6 +3,7 @@
*/
#include <sys/types.h>
#include <stdint.h>
#include "rt_io_base.h"
struct libusb_context;
struct libusb_device;
......@@ -27,12 +28,12 @@ struct libusb_device_descriptor {
uint8_t bNumConfigurations;
};
int libusb_init(libusb_context **ctx) {return 0;}
int libusb_init(libusb_context **ctx) {return io_cLibDummy;}
void libusb_exit(libusb_context *ctx) {}
ssize_t libusb_get_device_list(libusb_context *ctx,
libusb_device ***list) {return 0;}
void libusb_free_device_list(libusb_device **list, int unref_devices) {}
int libusb_open(libusb_device *dev, libusb_device_handle **handle) {return 0;}
int libusb_open(libusb_device *dev, libusb_device_handle **handle) {return io_cLibDummy;}
void libusb_close(libusb_device_handle *dev_handle) {}
int libusb_interrupt_transfer(libusb_device_handle *dev_handle,
unsigned char endpoint, unsigned char *data, int length,
......
......@@ -53,6 +53,8 @@ typedef struct io_sCtx *io_tCtx;
#define NULL (void *) 0
#endif
#define io_cLibDummy -9999
#define IO_CHANLIST_SIZE 250
#define FIXOUT 2
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment