diff -urN libk8055-0.1/CHANGES libk8055-0.2/CHANGES --- libk8055-0.1/CHANGES 1970-01-01 02:00:00.000000000 +0200 +++ libk8055-0.2/CHANGES 2006-07-29 13:03:02.000000000 +0300 @@ -0,0 +1,5 @@ +0.2: + * added #if !defined _BSD so it now compiles and runs ok on BSD + * added usb_interrupt_write() twice so now WriteAllDigital() works + not only once. (I don't know why it needs twice) + Nikolay Hristov diff -urN libk8055-0.1/Makefile libk8055-0.2/Makefile --- libk8055-0.1/Makefile 2005-09-14 09:56:31.000000000 +0300 +++ libk8055-0.2/Makefile 2006-07-29 13:03:43.000000000 +0300 @@ -5,15 +5,19 @@ includedir = /usr/local/include mandir = /usr/local/man/man1 OBJS = main.o libk8055.o -CFLAGS = -DDAEMON -Wall +# if your are using Linux comment out next line +CFLAGS = -DDAEMON -Wall -D_BSD +# if you are using Linux incomment following line +#CFLAGS = -DDAEMON -Wall + libs = -lusb -L/usr/lib -lm libk8055.so.0.1: libk8055.o - $(cc) -Wall -o libk8055.so.0.1 -shared libk8055.o + $(cc) -Wall -o libk8055.so.0.2 -shared libk8055.o libk8055.o: libk8055.c - $(cc) -Wall -O -c -g -fPIC libk8055.c - -ln -sf libk8055.so.0.1 libk8055.so + $(cc) -Wall -O -c -g -fPIC $(CFLAGS) libk8055.c + -ln -sf libk8055.so.0.2 libk8055.so libk8055.c: k8055.h @@ -27,7 +31,7 @@ strip $(exec) clean: - rm -f *.o libk8055.so libk8055.so.0.1 $(exec) + rm -f *.o libk8055.so libk8055.so.0.2 $(exec) install: k8055_prog libk8055.so.0.1 cp -f $(exec) $(bindir)/ diff -urN libk8055-0.1/libk8055.c libk8055-0.2/libk8055.c --- libk8055-0.1/libk8055.c 2005-09-14 09:51:03.000000000 +0300 +++ libk8055-0.2/libk8055.c 2006-07-29 13:02:26.000000000 +0300 @@ -17,8 +17,11 @@ static int takeover_device( usb_dev_handle* udev, int interface ){ char driver_name[STR_BUFF]; memset( driver_name, 0, STR_BUFF ); +#if !defined _BSD int ret = -1; +#endif assert( udev != NULL ); +#if !defined _BSD ret = usb_get_driver_np( udev, interface, driver_name, sizeof(driver_name) ); if ( ret ==0 ){ if (DEBUG) fprintf(stderr,"Got driver name: %s\n",driver_name); @@ -31,7 +34,7 @@ } else if (DEBUG) fprintf( stderr, "get driver name: %s\n", usb_strerror()); - +#endif /*claim interface */ if( usb_claim_interface(udev, interface) <0 ) { @@ -129,6 +132,7 @@ else data_out[2]=(unsigned char)data; open_status=usb_interrupt_write(device_handle,0x01,data_out,8,20); + open_status=usb_interrupt_write(device_handle,0x01,data_out,8,20); if (open_status!=8) return -1; else @@ -141,6 +145,7 @@ data_out[2]=(unsigned char)data1; data_out[3]=(unsigned char)data2; open_status=usb_interrupt_write(device_handle,0x01,data_out,8,20); + open_status=usb_interrupt_write(device_handle,0x01,data_out,8,20); if (open_status!=8) return -1; else @@ -175,6 +180,7 @@ data_out[0]=0x05; /* analog out or digital out command */ data_out[1]=(unsigned char)data; open_status=usb_interrupt_write(device_handle,0x01,data_out,8,20); + open_status=usb_interrupt_write(device_handle,0x01,data_out,8,20); if (open_status!=8) return -1; else @@ -264,6 +270,7 @@ data_out[0]=0x02+(unsigned char)counternr; /* counter selection */ data_out[3+counternr]=0x00; open_status=usb_interrupt_write(device_handle,0x01,data_out,8,20); + open_status=usb_interrupt_write(device_handle,0x01,data_out,8,20); if (open_status==8) return 0; else