From b0b04ed226984ba52dcbf343a0381ddaea4d6f97 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Mon, 20 Jun 2011 23:15:30 -0300 Subject: [PATCH] tools/atrf-gpio/atusb.c (restore_gpios): send ATUSB_GPIO_CLEANUP --- tools/atrf-gpio/atusb.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/atrf-gpio/atusb.c b/tools/atrf-gpio/atusb.c index c8a2553..6cb6c50 100644 --- a/tools/atrf-gpio/atusb.c +++ b/tools/atrf-gpio/atusb.c @@ -23,6 +23,7 @@ #define FROM_DEV ATUSB_FROM_DEV(0) +#define TO_DEV ATUSB_TO_DEV(0) static const char *name[24] = { @@ -105,10 +106,17 @@ static void dump(const uint8_t *data, const uint8_t *dir, static void restore_gpios(void) { - int i; + int i, res; for (i = 0; i != 3; i++) gpio(orig_dsc, i+1, orig_data+i, orig_dir+i, 0xff); + + res = usb_control_msg(atrf_usb_handle(orig_dsc), + TO_DEV, ATUSB_GPIO_CLEANUP, 0, 0, NULL, 0, 1000); + if (res < 0) { + fprintf(stderr, "ATUSB_GPIO_CLEANUP: %s\n", usb_strerror()); + _exit(1); + } }