? libgpio/build
? libgpio/ieee1394/.cvsignore
? libgpio/include/.cvsignore
? libgpio/libgpio/.cvsignore
? libgpio/network/.cvsignore
? libgpio/parallel/.cvsignore
? libgpio/serial/.cvsignore
? libgpio/usb/.cvsignore
Index: libgpio/.cvsignore
===================================================================
RCS file: /cvs/gnome/libgpio/.cvsignore,v
retrieving revision 1.3
diff -u -r1.3 .cvsignore
--- libgpio/.cvsignore	2000/07/21 18:56:24	1.3
+++ libgpio/.cvsignore	2000/08/02 11:38:52
@@ -25,3 +25,5 @@
 gpio-usb.lo
 gpioConf.sh
 libgpio.la
+Makefile
+Makefile.in
Index: libgpio/configure.in
===================================================================
RCS file: /cvs/gnome/libgpio/configure.in,v
retrieving revision 1.7
diff -u -r1.7 configure.in
--- libgpio/configure.in	2000/07/31 23:41:26	1.7
+++ libgpio/configure.in	2000/08/02 11:38:52
@@ -63,8 +63,8 @@
 AC_PATH_PROG(LIBUSB_CONFIG,libusb-config)
 if test -n "${LIBUSB_CONFIG}"; then
   IOLIB_SUBDIRS="$IOLIB_SUBDIRS usb"
-  IOLIB_LDFLAGS="$IOLIB_LDFLAGS -Lusb -lgpio_usb"
-  IOLIB_CFLAGS="$IOLIB_CFLAGS -DGPIO_USB"
+  IOLIB_LDFLAGS="$IOLIB_LDFLAGS `libusb-config --libs` -lgpio_usb"
+  IOLIB_CFLAGS="$IOLIB_CFLAGS -DGPIO_USB `libusb-config --cflags`"
 else
   AC_MSG_WARN([
 
Index: libgpio/include/gpio.h
===================================================================
RCS file: /cvs/gnome/libgpio/include/gpio.h,v
retrieving revision 1.1
diff -u -r1.1 gpio.h
--- libgpio/include/gpio.h	2000/07/31 23:41:26	1.1
+++ libgpio/include/gpio.h	2000/08/02 11:38:52
@@ -89,6 +89,13 @@
 
 } gpio_device_settings;
 
+#ifdef GPIO_USB
+enum {
+	GPIO_USB_IN_ENDPOINT,
+	GPIO_USB_OUT_ENDPOINT
+};
+#endif
+
 
 struct gpio_device;
 typedef struct gpio_device gpio_device;
@@ -108,7 +115,7 @@
 #ifdef GPIO_USB
 	/* for USB devices */
 	int (*find_device)(gpio_device * dev, int idvendor, int idproduct);
-	int (*clear_halt) (gpio_device * dev);
+	int (*clear_halt) (gpio_device * dev, int ep);
 	int (*msg_write)  (gpio_device * dev, int value, char *bytes, int size);
 	int (*msg_read)   (gpio_device * dev, int value, char *bytes, int size);
 #endif
@@ -241,6 +248,12 @@
 				  successful: number of bytes read
 				unsuccessful: GPIO_ERROR
 		*/
+       int gpio_update		(gpio_device *dev);
+       		/* Updates the settings by closing/reopening the device
+			return values:
+				  successful: GPIO_OK
+				unsuccessful: GPIO_ERROR
+		*/
 
 
 /* Serial and Parallel specific functions
@@ -272,7 +285,7 @@
 #ifdef GPIO_USB
 	/* must port libusb to other platforms for this to drop-in */
 	int gpio_usb_find_device (gpio_device * dev, int idvendor, int idproduct);
-	int gpio_usb_clear_halt  (gpio_device * dev);
+	int gpio_usb_clear_halt  (gpio_device * dev, int ep);
 	int gpio_usb_msg_write   (gpio_device * dev, int value, char *bytes, int size);
 	int gpio_usb_msg_read    (gpio_device * dev, int value, char *bytes, int size);
 #endif
Index: libgpio/libgpio/gpio.c
===================================================================
RCS file: /cvs/gnome/libgpio/libgpio/gpio.c,v
retrieving revision 1.2
diff -u -r1.2 gpio.c
--- libgpio/libgpio/gpio.c	2000/07/31 23:52:09	1.2
+++ libgpio/libgpio/gpio.c	2000/08/02 11:38:52
@@ -228,6 +228,11 @@
 	return GPIO_OK;
 }
 
+int gpio_update(gpio_device *dev)
+{
+	return dev->ops->update(dev);
+}
+
 /* Serial and Parallel-specific functions */
 /* ------------------------------------------------------------------ */
 
@@ -260,12 +265,12 @@
 
 	return (dev->ops->find_device(dev, idvendor, idproduct));
 }
-int gpio_usb_clear_halt (gpio_device * dev)
+int gpio_usb_clear_halt (gpio_device * dev, int ep)
 {
 	if (!dev->ops->clear_halt)
 		return (GPIO_ERROR);
 
-	return (dev->ops->clear_halt(dev));
+	return (dev->ops->clear_halt(dev, ep));
 }
 
 int gpio_usb_msg_write (gpio_device * dev, int value, char *bytes, int size)
Index: libgpio/libgpio/library.c
===================================================================
RCS file: /cvs/gnome/libgpio/libgpio/library.c,v
retrieving revision 1.3
diff -u -r1.3 library.c
--- libgpio/libgpio/library.c	2000/08/01 00:20:11	1.3
+++ libgpio/libgpio/library.c	2000/08/02 11:38:52
@@ -1,5 +1,7 @@
 #include <dlfcn.h>
 #include <stdio.h>
+#include <string.h>
+#include <dirent.h>
 
 #include "gpio.h"
 #include "library.h"
Index: libgpio/serial/unix.c
===================================================================
RCS file: /cvs/gnome/libgpio/serial/unix.c,v
retrieving revision 1.1
diff -u -r1.1 unix.c
--- libgpio/serial/unix.c	2000/07/31 23:41:28	1.1
+++ libgpio/serial/unix.c	2000/08/02 11:38:52
@@ -56,6 +56,8 @@
 static struct sgttyb term_old;
 #endif
 
+extern int device_debug;
+
 /* Serial prototypes
    ------------------------------------------------------------------ */
 int 		gpio_serial_init(gpio_device *dev);
@@ -159,6 +161,7 @@
    ------------------------------------------------------------------ */
 
 int gpio_serial_init (gpio_device *dev) {
+	gpio_debug_printf("gpio_serial_init() called\n");
 	/* save previous setttings in to dev->settings_saved */
 #if HAVE_TERMIOS_H
 	if (tcgetattr(dev->device_fd, &term_old) < 0) {
@@ -175,11 +178,11 @@
 }
 
 int gpio_serial_exit (gpio_device *dev) {
-
 }
 
 int gpio_serial_open(gpio_device * dev)
 {
+	gpio_debug_printf("gpio_serial_open() called\n");
 
 #ifdef __FreeBSD__
 	dev->device_fd = open(dev->settings.serial.port, O_RDWR | O_NOCTTY | O_NONBLOCK);
@@ -200,6 +203,7 @@
 
 int gpio_serial_close(gpio_device * dev)
 {
+	gpio_debug_printf("gpio_serial_close() called\n");
 	if (close(dev->device_fd) == -1) {
 		perror("gpio_serial_close: tried closing device file descriptor");
 		return GPIO_ERROR;
@@ -210,6 +214,14 @@
 int gpio_serial_write(gpio_device * dev, char *bytes, int size)
 {
 	int len, ret;
+	int i;
+
+	if (device_debug) {
+		gpio_debug_printf("gpio_serial_write(): ");
+		for (i = 0; i < size; i++)
+			gpio_debug_printf("%02x ", (unsigned char)bytes[i]);
+		gpio_debug_printf("\n");
+	}
 
 	len = 0;
 	while (len < size) {	/* Make sure we write all data while handling */
@@ -279,6 +291,14 @@
 			return GPIO_ERROR;
 		}
 	}
+	if (device_debug) {
+		int i;
+
+		gpio_debug_printf("gpio_serial_read(timeout=%d): ",dev->timeout);
+		for (i = 0; i < readen; i++)
+		  gpio_debug_printf("%02x ", (unsigned char)(bytes[i]));
+		gpio_debug_printf("\n");
+	}
 	return readen;
 }
 
@@ -330,29 +350,38 @@
 {
 	int bit,request;
 
+	gpio_debug_printf("gpio_serial_set_pin(): ");
+
 	switch(pin) {
 		case PIN_RTS:
+			gpio_debug_printf("pin=PIN_RTS ");
 			bit = TIOCM_RTS;
 			break;
 		case PIN_DTR:
+			gpio_debug_printf("pin=PIN_DTR ");
 			bit = TIOCM_DTR;
 			break;
 		case PIN_CTS:
+			gpio_debug_printf("pin=PIN_CTS ");
 			bit = TIOCM_CTS;
 			break;
 		case PIN_DSR:
+			gpio_debug_printf("pin=PIN_DSR ");
 			bit = TIOCM_DSR;
 			break;
 		case PIN_CD:
+			gpio_debug_printf("pin=PIN_CD ");
 			bit = TIOCM_CD;
 			break;
 		case PIN_RING:
+			gpio_debug_printf("pin=PIN_RING ");
 			bit = TIOCM_RNG;
 			break;
 		default:
 			return GPIO_ERROR;
 	}
 	
+	gpio_debug_printf("level=%d\n", level);
 	switch(level) {
 		case 0:
 			request = TIOCMBIS;
@@ -378,6 +407,7 @@
  */
 int gpio_serial_update(gpio_device * dev)
 {
+	gpio_debug_printf("gpio_serial_update() called\n");
 	memcpy(&dev->settings, &dev->settings_pending, sizeof(dev->settings));
 
 	if (dev->device_fd != 0) {
@@ -402,6 +432,8 @@
 #if HAVE_TERMIOS_H
 	struct termios tio;
 
+	gpio_debug_printf("gpio_serial_set_baudrate(speed=%d) called\n",
+		dev->settings.serial.speed);
 	if (tcgetattr(dev->device_fd, &tio) < 0) {
 		perror("tcgetattr");
 		return GPIO_ERROR;
@@ -440,6 +472,8 @@
 #else
 	struct sgttyb ttyb;
 
+	gpio_debug_printf("gpio_serial_set_baudrate(speed=%d) called\n",
+		dev->settings.serial.speed);
 	if (ioctl(dev->device_fd, TIOCGETP, &ttyb) < 0) {
 		perror("ioctl(TIOCGETP)");
 		return GPIO_ERROR;
Index: libgpio/usb/libusb.c
===================================================================
RCS file: /cvs/gnome/libgpio/usb/libusb.c,v
retrieving revision 1.1
diff -u -r1.1 libusb.c
--- libgpio/usb/libusb.c	2000/07/31 23:41:29	1.1
+++ libgpio/usb/libusb.c	2000/08/02 11:38:52
@@ -31,7 +31,7 @@
 #include <usb.h>
 #include "gpio.h"
 
-#undef GPIO_USB_DEBUG
+extern int device_debug;
 
 int gpio_usb_list(gpio_device_info *list, int *count);
 int gpio_usb_init(gpio_device *dev);
@@ -45,7 +45,7 @@
 int gpio_usb_set_pin(gpio_device * dev, int pin, int level);
 int gpio_usb_update(gpio_device * dev);
 
-int gpio_usb_clear_halt_lib(gpio_device * dev);
+int gpio_usb_clear_halt_lib(gpio_device * dev, int ep);
 int gpio_usb_msg_read_lib(gpio_device * dev, int value, char *bytes, int size);
 int gpio_usb_msg_write_lib(gpio_device * dev, int value, char *bytes, int size);
 int gpio_usb_find_device_lib(gpio_device *dev, int idvendor, int idproduct);
@@ -85,6 +85,8 @@
 	usb_find_busses();
 	usb_find_devices();
 
+	gpio_debug_printf ("gpio_library_list() : &usb_busses=%x\n",&usb_busses);
+	gpio_debug_printf ("gpio_library_list() : usb_busses=%x\n",usb_busses);
 	list[*count].type = GPIO_DEVICE_USB;
 	strcpy(list[*count].name, "Universal Serial Bus");
 	strcpy(list[*count].path, "usb");
@@ -106,9 +108,7 @@
 {
 	int ret;
 
-#ifdef GPIO_USB_DEBUG
-	printf ("gpio_usb_open() called\n");
-#endif
+	gpio_debug_printf ("gpio_usb_open() called\n");
 	dev->device_handle = usb_open(dev->usb_device);
 	if (!dev->device_handle)
 		return GPIO_ERROR;
@@ -142,9 +142,7 @@
 {
 	int ret;
 
-#ifdef GPIO_USB_DEBUG
-	printf ("gpio_usb_close() called\n");
-#endif
+	gpio_debug_printf ("gpio_usb_close() called\n");
 	if (usb_close(dev->device_handle) < 0)
 		fprintf(stderr, "gpio_usb_close: %s\n",
 			strerror(errno));
@@ -160,25 +158,34 @@
 	return gpio_usb_open(dev);
 }
 
-int gpio_usb_clear_halt_lib(gpio_device * dev)
+int gpio_usb_clear_halt_lib(gpio_device * dev, int ep)
 {
-	if (usb_clear_halt(dev->device_handle, dev->settings.usb.inep)
-		|| usb_clear_halt(dev->device_handle, dev->settings.usb.outep))
-		return GPIO_ERROR;
-	else
-		return GPIO_OK;
+	int ret=0;
+
+	switch (ep) {
+		case GPIO_USB_IN_ENDPOINT :
+			ret=usb_clear_halt(dev->device_handle, dev->settings.usb.inep);
+			break;
+		case GPIO_USB_OUT_ENDPOINT :
+			ret=usb_clear_halt(dev->device_handle, dev->settings.usb.outep);
+			break;
+		default:
+			fprintf(stderr,"gpio_usb_clear_halt: bad EndPoint argument\n");
+			return GPIO_ERROR;
+	}
+	return (ret ? GPIO_ERROR : GPIO_OK);
 }
 
 int gpio_usb_write(gpio_device * dev, char *bytes, int size)
 {
 	int i;
 
-#ifdef GPIO_USB_DEBUG
-	printf("gpio_usb_write(): ");
-	for (i = 0; i < size; i++)
-	  printf("%02x ",(unsigned char)bytes[i]);
-	printf("\n");
-#endif
+	if (device_debug) {
+		gpio_debug_printf("gpio_usb_write(): ");
+		for (i = 0; i < size; i++)
+			gpio_debug_printf("%02x ",(unsigned char)bytes[i]);
+		gpio_debug_printf("\n");
+	}
 	return usb_bulk_write(dev->device_handle, dev->settings.usb.outep,
 			      bytes, size, dev->timeout);
 }
@@ -192,12 +199,12 @@
 	if (ret < 0)
 		return GPIO_ERROR;
 
-#ifdef GPIO_USB_DEBUG
-	printf("gpio_usb_read(timeout=%d): ", dev->timeout);
-	for (i = 0; i < ret; i++)
-	  printf("%02x ",(unsigned char)(bytes[i]));
-	printf("\n");
-#endif
+	if (device_debug) {
+		printf("gpio_usb_read(timeout=%d): ", dev->timeout);
+		for (i = 0; i < ret; i++)
+			printf("%02x ",(unsigned char)(bytes[i]));
+		printf("\n");
+	}
 	return ret;
 }
 
@@ -231,6 +238,11 @@
 	struct usb_bus *bus;
 	struct usb_device *dev;
 
+	usb_init();
+	usb_find_busses();
+	usb_find_devices();
+	gpio_debug_printf ("gpio_usb_find_device_lib() : &usb_busses=%x\n",&usb_busses);
+	gpio_debug_printf ("gpio_usb_find_device_lib() : usb_busses=%x\n",usb_busses);
 	for (bus = usb_busses; bus; bus = bus->next) {
 		for (dev = bus->devices; dev; dev = dev->next) {
 			if ((dev->descriptor.idVendor == idvendor) &&
