From owner-freebsd-usb@FreeBSD.ORG Wed Nov 6 20:30:00 2013 Return-Path: Delivered-To: freebsd-usb@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id A5B3B9E7 for ; Wed, 6 Nov 2013 20:30:00 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 851A42BA1 for ; Wed, 6 Nov 2013 20:30:00 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id rA6KU0sD065913 for ; Wed, 6 Nov 2013 20:30:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.7/8.14.7/Submit) id rA6KU0XW065910; Wed, 6 Nov 2013 20:30:00 GMT (envelope-from gnats) Resent-Date: Wed, 6 Nov 2013 20:30:00 GMT Resent-Message-Id: <201311062030.rA6KU0XW065910@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-usb@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Alfred Emanuel Perlstein Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 169AF635 for ; Wed, 6 Nov 2013 20:20:37 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from oldred.freebsd.org (oldred.freebsd.org [8.8.178.121]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 03C0D2B31 for ; Wed, 6 Nov 2013 20:20:37 +0000 (UTC) Received: from oldred.freebsd.org ([127.0.1.6]) by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id rA6KKaOT067476 for ; Wed, 6 Nov 2013 20:20:36 GMT (envelope-from nobody@oldred.freebsd.org) Received: (from nobody@localhost) by oldred.freebsd.org (8.14.5/8.14.5/Submit) id rA6KKash067471; Wed, 6 Nov 2013 20:20:36 GMT (envelope-from nobody) Message-Id: <201311062020.rA6KKash067471@oldred.freebsd.org> Date: Wed, 6 Nov 2013 20:20:36 GMT From: Alfred Emanuel Perlstein To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: usb/183728: libusb20 examples filenames cause problems on windows. X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2013 20:30:00 -0000 >Number: 183728 >Category: usb >Synopsis: libusb20 examples filenames cause problems on windows. >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-usb >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Wed Nov 06 20:30:00 UTC 2013 >Closed-Date: >Last-Modified: >Originator: Alfred Emanuel Perlstein >Release: 11-current >Organization: freebsd >Environment: Microsoft Windows [Version 6.1.7600] >Description: The file "aux.*" can't be made on a windows machine. This patch renames those files. >How-To-Repeat: Try to checkout on a windows filesystem. >Fix: https://github.com/alfredperlstein/freebsd/compare/libusb_aux_names diff --git a/share/examples/libusb20/Makefile b/share/examples/libusb20/Makefile index 6f870a1..a27588a 100644 --- a/share/examples/libusb20/Makefile +++ b/share/examples/libusb20/Makefile @@ -3,11 +3,11 @@ TARGETS= bulk control all: $(TARGETS) -bulk: bulk.o aux.o - $(CC) $(CFLAGS) -o bulk bulk.o aux.o -lusb +bulk: bulk.o extras.o + $(CC) $(CFLAGS) -o bulk bulk.o extras.o -lusb -control: control.o aux.o - $(CC) $(CFLAGS) -o control control.o aux.o -lusb +control: control.o extras.o + $(CC) $(CFLAGS) -o control control.o extras.o -lusb clean: rm -f $(TARGETS) *.o *~ diff --git a/share/examples/libusb20/aux.c b/share/examples/libusb20/aux.c deleted file mode 100644 index 434972a..0000000 --- a/share/examples/libusb20/aux.c +++ /dev/null @@ -1,120 +0,0 @@ -/* ---------------------------------------------------------------------------- - * "THE BEER-WARE LICENSE" (Revision 42) (by Poul-Henning Kamp): - * wrote this file. As long as you retain this notice you - * can do whatever you want with this stuff. If we meet some day, and you think - * this stuff is worth it, you can buy me a beer in return. Joerg Wunsch - * ---------------------------------------------------------------------------- - * - * $FreeBSD$ - */ - -/* - * Helper functions common to all examples - */ - -#include -#include -#include - -#include -#include - -#include "aux.h" - -/* - * Return a textual description for error "r". - */ -const char * -usb_error(enum libusb20_error r) -{ - const char *msg = "UNKNOWN"; - - switch (r) - { - case LIBUSB20_SUCCESS: - msg = "success"; - break; - - case LIBUSB20_ERROR_IO: - msg = "IO error"; - break; - - case LIBUSB20_ERROR_INVALID_PARAM: - msg = "Invalid parameter"; - break; - - case LIBUSB20_ERROR_ACCESS: - msg = "Access denied"; - break; - - case LIBUSB20_ERROR_NO_DEVICE: - msg = "No such device"; - break; - - case LIBUSB20_ERROR_NOT_FOUND: - msg = "Entity not found"; - break; - - case LIBUSB20_ERROR_BUSY: - msg = "Resource busy"; - break; - - case LIBUSB20_ERROR_TIMEOUT: - msg = "Operation timed out"; - break; - - case LIBUSB20_ERROR_OVERFLOW: - msg = "Overflow"; - break; - - case LIBUSB20_ERROR_PIPE: - msg = "Pipe error"; - break; - - case LIBUSB20_ERROR_INTERRUPTED: - msg = "System call interrupted"; - break; - - case LIBUSB20_ERROR_NO_MEM: - msg = "Insufficient memory"; - break; - - case LIBUSB20_ERROR_NOT_SUPPORTED: - msg = "Operation not supported"; - break; - - case LIBUSB20_ERROR_OTHER: - msg = "Other error"; - break; - } - - return msg; -} - -/* - * Print "len" bytes from "buf" in hex, followed by an ASCII - * representation (somewhat resembling the output of hd(1)). - */ -void -print_formatted(uint8_t *buf, uint32_t len) -{ - int i, j; - - for (j = 0; j < len; j += 16) - { - printf("%02x: ", j); - - for (i = 0; i < 16 && i + j < len; i++) - printf("%02x ", buf[i + j]); - printf(" "); - for (i = 0; i < 16 && i + j < len; i++) - { - uint8_t c = buf[i + j]; - if(c >= ' ' && c <= '~') - printf("%c", (char)c); - else - putchar('.'); - } - putchar('\n'); - } -} diff --git a/share/examples/libusb20/aux.h b/share/examples/libusb20/aux.h deleted file mode 100644 index d43ea4e..0000000 --- a/share/examples/libusb20/aux.h +++ /dev/null @@ -1,15 +0,0 @@ -/* ---------------------------------------------------------------------------- - * "THE BEER-WARE LICENSE" (Revision 42) (by Poul-Henning Kamp): - * wrote this file. As long as you retain this notice you - * can do whatever you want with this stuff. If we meet some day, and you think - * this stuff is worth it, you can buy me a beer in return. Joerg Wunsch - * ---------------------------------------------------------------------------- - * - * $FreeBSD$ - */ - -#include -#include - -const char *usb_error(enum libusb20_error r); -void print_formatted(uint8_t *buf, uint32_t len); diff --git a/share/examples/libusb20/bulk.c b/share/examples/libusb20/bulk.c index 7b6b02c..7e6044a 100644 --- a/share/examples/libusb20/bulk.c +++ b/share/examples/libusb20/bulk.c @@ -41,7 +41,7 @@ #include #include -#include "aux.h" +#include "extras.h" /* * If you want to see the details of the internal datastructures diff --git a/share/examples/libusb20/control.c b/share/examples/libusb20/control.c index 0a9d152..79a3115 100644 --- a/share/examples/libusb20/control.c +++ b/share/examples/libusb20/control.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -44,6 +45,8 @@ #include +#include "extras.h" + /* * If you want to see the details of the internal datastructures * in the debugger, unifdef the following. diff --git a/share/examples/libusb20/extras.c b/share/examples/libusb20/extras.c new file mode 100644 index 0000000..3301e80 --- /dev/null +++ b/share/examples/libusb20/extras.c @@ -0,0 +1,120 @@ +/* ---------------------------------------------------------------------------- + * "THE BEER-WARE LICENSE" (Revision 42) (by Poul-Henning Kamp): + * wrote this file. As long as you retain this notice you + * can do whatever you want with this stuff. If we meet some day, and you think + * this stuff is worth it, you can buy me a beer in return. Joerg Wunsch + * ---------------------------------------------------------------------------- + * + * $FreeBSD$ + */ + +/* + * Helper functions common to all examples + */ + +#include +#include +#include + +#include +#include + +#include "extras.h" + +/* + * Return a textual description for error "r". + */ +const char * +usb_error(enum libusb20_error r) +{ + const char *msg = "UNKNOWN"; + + switch (r) + { + case LIBUSB20_SUCCESS: + msg = "success"; + break; + + case LIBUSB20_ERROR_IO: + msg = "IO error"; + break; + + case LIBUSB20_ERROR_INVALID_PARAM: + msg = "Invalid parameter"; + break; + + case LIBUSB20_ERROR_ACCESS: + msg = "Access denied"; + break; + + case LIBUSB20_ERROR_NO_DEVICE: + msg = "No such device"; + break; + + case LIBUSB20_ERROR_NOT_FOUND: + msg = "Entity not found"; + break; + + case LIBUSB20_ERROR_BUSY: + msg = "Resource busy"; + break; + + case LIBUSB20_ERROR_TIMEOUT: + msg = "Operation timed out"; + break; + + case LIBUSB20_ERROR_OVERFLOW: + msg = "Overflow"; + break; + + case LIBUSB20_ERROR_PIPE: + msg = "Pipe error"; + break; + + case LIBUSB20_ERROR_INTERRUPTED: + msg = "System call interrupted"; + break; + + case LIBUSB20_ERROR_NO_MEM: + msg = "Insufficient memory"; + break; + + case LIBUSB20_ERROR_NOT_SUPPORTED: + msg = "Operation not supported"; + break; + + case LIBUSB20_ERROR_OTHER: + msg = "Other error"; + break; + } + + return msg; +} + +/* + * Print "len" bytes from "buf" in hex, followed by an ASCII + * representation (somewhat resembling the output of hd(1)). + */ +void +print_formatted(uint8_t *buf, uint32_t len) +{ + int i, j; + + for (j = 0; j < len; j += 16) + { + printf("%02x: ", j); + + for (i = 0; i < 16 && i + j < len; i++) + printf("%02x ", buf[i + j]); + printf(" "); + for (i = 0; i < 16 && i + j < len; i++) + { + uint8_t c = buf[i + j]; + if(c >= ' ' && c <= '~') + printf("%c", (char)c); + else + putchar('.'); + } + putchar('\n'); + } +} diff --git a/share/examples/libusb20/extras.h b/share/examples/libusb20/extras.h new file mode 100644 index 0000000..d43ea4e --- /dev/null +++ b/share/examples/libusb20/extras.h @@ -0,0 +1,15 @@ +/* ---------------------------------------------------------------------------- + * "THE BEER-WARE LICENSE" (Revision 42) (by Poul-Henning Kamp): + * wrote this file. As long as you retain this notice you + * can do whatever you want with this stuff. If we meet some day, and you think + * this stuff is worth it, you can buy me a beer in return. Joerg Wunsch + * ---------------------------------------------------------------------------- + * + * $FreeBSD$ + */ + +#include +#include + +const char *usb_error(enum libusb20_error r); +void print_formatted(uint8_t *buf, uint32_t len); >Release-Note: >Audit-Trail: >Unformatted: