? libgpio/build 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/07/22 21:07:23 @@ -25,3 +25,5 @@ gpio-usb.lo gpioConf.sh libgpio.la +Makefile +Makefile.in Index: libgpio/gpio-network.c =================================================================== RCS file: /cvs/gnome/libgpio/gpio-network.c,v retrieving revision 1.1 diff -u -r1.1 gpio-network.c --- libgpio/gpio-network.c 2000/07/13 22:40:34 1.1 +++ libgpio/gpio-network.c 2000/07/22 21:07:23 @@ -20,6 +20,7 @@ Boston, MA 02111-1307, USA. */ +#include #include "gpio.h" /* network prototypes Index: libgpio/gpio-serial.c =================================================================== RCS file: /cvs/gnome/libgpio/gpio-serial.c,v retrieving revision 1.10 diff -u -r1.10 gpio-serial.c --- libgpio/gpio-serial.c 2000/07/21 18:56:24 1.10 +++ libgpio/gpio-serial.c 2000/07/22 21:07:23 @@ -49,6 +49,8 @@ #include "gpio.h" +#define GPIO_SERIAL_DEBUG 1 + #ifdef HAVE_TERMIOS_H static struct termios term_old; #else @@ -134,6 +136,9 @@ } int gpio_serial_init (gpio_device *dev) { +#ifdef GPIO_SERIAL_DEBUG + printf("gpio_serial_init() called\n"); +#endif /* save previous setttings in to dev->settings_saved */ #if HAVE_TERMIOS_H if (tcgetattr(dev->device_fd, &term_old) < 0) { @@ -150,11 +155,13 @@ } int gpio_serial_exit (gpio_device *dev) { - } int gpio_serial_open(gpio_device * dev) { +#ifdef GPIO_SERIAL_DEBUG + printf("gpio_serial_open() called\n"); +#endif #ifdef __FreeBSD__ dev->device_fd = open(dev->settings.serial.port, O_RDWR | O_NOCTTY | O_NONBLOCK); @@ -175,6 +182,9 @@ int gpio_serial_close(gpio_device * dev) { +#ifdef GPIO_SERIAL_DEBUG + printf("gpio_serial_close() called\n"); +#endif if (close(dev->device_fd) == -1) { perror("gpio_serial_close: tried closing device file descriptor"); return GPIO_ERROR; @@ -185,7 +195,15 @@ int gpio_serial_write(gpio_device * dev, char *bytes, int size) { int len, ret; +#ifdef GPIO_SERIAL_DEBUG + int i; + printf("gpio_serial_write(): "); + for (i = 0; i < size; i++) + printf("%02x ", (unsigned char)bytes[i]); + printf("\n"); +#endif + len = 0; while (len < size) { /* Make sure we write all data while handling */ /* the harmless errors */ @@ -254,6 +272,16 @@ return GPIO_ERROR; } } +#ifdef GPIO_SERIAL_DEBUG + { + int i; + + printf("gpio_serial_read(timeout=%d): ",dev->timeout); + for (i = 0; i < readen; i++) + printf("%02x ", (unsigned char)(bytes[i])); + printf("\n"); + } +#endif return readen; } @@ -305,29 +333,54 @@ { int bit,request; +#ifdef GPIO_SERIAL_DEBUG + printf("gpio_serial_set_pin(): "); +#endif + switch(pin) { case PIN_RTS: +#ifdef GPIO_SERIAL_DEBUG + printf("pin=PIN_RTS "); +#endif bit = TIOCM_RTS; break; case PIN_DTR: +#ifdef GPIO_SERIAL_DEBUG + printf("pin=PIN_DTR "); +#endif bit = TIOCM_DTR; break; case PIN_CTS: +#ifdef GPIO_SERIAL_DEBUG + printf("pin=PIN_CTS "); +#endif bit = TIOCM_CTS; break; case PIN_DSR: +#ifdef GPIO_SERIAL_DEBUG + printf("pin=PIN_DSR "); +#endif bit = TIOCM_DSR; break; case PIN_CD: +#ifdef GPIO_SERIAL_DEBUG + printf("pin=PIN_CD "); +#endif bit = TIOCM_CD; break; case PIN_RING: +#ifdef GPIO_SERIAL_DEBUG + printf("pin=PIN_RING "); +#endif bit = TIOCM_RNG; break; default: return GPIO_ERROR; } +#ifdef GPIO_SERIAL_DEBUG + printf("level=%d\n", level); +#endif switch(level) { case 0: request = TIOCMBIS; @@ -353,6 +406,9 @@ */ int gpio_serial_update(gpio_device * dev) { +#ifdef GPIO_SERIAL_DEBUG + printf("gpio_serial_update() called\n"); +#endif memcpy(&dev->settings, &dev->settings_pending, sizeof(dev->settings)); if (dev->device_fd != 0) { @@ -377,6 +433,10 @@ #if HAVE_TERMIOS_H struct termios tio; +#ifdef GPIO_SERIAL_DEBUG + printf("gpio_serial_set_baudrate(speed=%d) called\n", + dev->settings.serial.speed); +#endif if (tcgetattr(dev->device_fd, &tio) < 0) { perror("tcgetattr"); return GPIO_ERROR; @@ -415,6 +475,10 @@ #else struct sgttyb ttyb; +#ifdef GPIO_SERIAL_DEBUG + printf("gpio_serial_set_baudrate(speed=%d) called\n", + dev->settings.serial.speed); +#endif if (ioctl(dev->device_fd, TIOCGETP, &ttyb) < 0) { perror("ioctl(TIOCGETP)"); return GPIO_ERROR; Index: libgpio/gpio-usb.c =================================================================== RCS file: /cvs/gnome/libgpio/gpio-usb.c,v retrieving revision 1.12 diff -u -r1.12 gpio-usb.c --- libgpio/gpio-usb.c 2000/07/21 18:56:24 1.12 +++ libgpio/gpio-usb.c 2000/07/22 21:07:23 @@ -115,13 +115,22 @@ return gpio_usb_open(dev); } -int gpio_usb_clear_halt(gpio_device * dev) +int gpio_usb_clear_halt (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) Index: libgpio/gpio-usb.h =================================================================== RCS file: /cvs/gnome/libgpio/gpio-usb.h,v retrieving revision 1.2 diff -u -r1.2 gpio-usb.h --- libgpio/gpio-usb.h 2000/06/11 18:58:08 1.2 +++ libgpio/gpio-usb.h 2000/07/22 21:07:23 @@ -13,4 +13,12 @@ extern struct gpio_operations gpio_usb_operations; +int gpio_usb_clear_halt (gpio_device * dev, int ep); + +enum { + GPIO_USB_IN_ENDPOINT, + GPIO_USB_OUT_ENDPOINT +}; + + #endif /* _GPIO_USB_H_ */ Index: libgpio/gpio.h.in =================================================================== RCS file: /cvs/gnome/libgpio/gpio.h.in,v retrieving revision 1.15 diff -u -r1.15 gpio.h.in --- libgpio/gpio.h.in 2000/07/17 17:25:24 1.15 +++ libgpio/gpio.h.in 2000/07/22 21:07:23 @@ -1,6 +1,8 @@ #ifndef _GPIO_H_ #define _GPIO_H_ +typedef struct gpio_device gpio_device; + #ifdef OS2 #include #include @@ -91,7 +93,6 @@ struct gpio_device; -typedef struct gpio_device gpio_device; struct gpio_operations { int (*list) (gpio_device_info *, int*); int (*init) (gpio_device *);