Bug 183728 - libusb20 examples filenames cause problems on windows.
Summary: libusb20 examples filenames cause problems on windows.
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: usb (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-usb (Nobody)
URL:
Keywords:
: 171347 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-11-06 20:30 UTC by Alfred Perlstein
Modified: 2014-08-12 14:53 UTC (History)
2 users (show)

See Also:


Attachments
file.diff (8.50 KB, patch)
2013-11-06 20:30 UTC, Alfred Perlstein
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alfred Perlstein freebsd_committer freebsd_triage 2013-11-06 20:30:00 UTC
The file "aux.*" can't be made on a windows machine.  This patch renames those files.

Fix: https://github.com/alfredperlstein/freebsd/compare/libusb_aux_names
How-To-Repeat: Try to checkout on a windows filesystem.
Comment 1 dfilter service freebsd_committer freebsd_triage 2013-11-07 07:23:01 UTC
Author: hselasky
Date: Thu Nov  7 07:22:51 2013
New Revision: 257779
URL: http://svnweb.freebsd.org/changeset/base/257779

Log:
  - Use libusb20_strerror() function instead of custom usb_error() one.
  - Rename "aux.[ch]" to "util.[ch]" which is a more common name for
  utility functions and allows checkout on some non-FreeBSD systems
  where the "aux.*" namespace is reserved.
  - Fix some compile warnings while at it.
  
  PR:		usb/183728
  MFC after:	2 weeks

Added:
  head/share/examples/libusb20/util.c
     - copied, changed from r238603, head/share/examples/libusb20/aux.c
  head/share/examples/libusb20/util.h
     - copied, changed from r238603, head/share/examples/libusb20/aux.h
Deleted:
  head/share/examples/libusb20/aux.c
  head/share/examples/libusb20/aux.h
Modified:
  head/share/examples/libusb20/Makefile
  head/share/examples/libusb20/bulk.c
  head/share/examples/libusb20/control.c

Modified: head/share/examples/libusb20/Makefile
==============================================================================
--- head/share/examples/libusb20/Makefile	Thu Nov  7 04:52:25 2013	(r257778)
+++ head/share/examples/libusb20/Makefile	Thu Nov  7 07:22:51 2013	(r257779)
@@ -1,13 +1,14 @@
 # $FreeBSD$
 TARGETS=	bulk control
+CFLAGS+=	-Wall
 
 all: $(TARGETS)
 
-bulk: bulk.o aux.o
-	$(CC) $(CFLAGS) -o bulk bulk.o aux.o -lusb
+bulk: bulk.o util.o
+	$(CC) $(CFLAGS) -o bulk bulk.o util.o -lusb
 
-control: control.o aux.o
-	$(CC) $(CFLAGS) -o control control.o aux.o -lusb
+control: control.o util.o
+	$(CC) $(CFLAGS) -o control control.o util.o -lusb
 
 clean:
 	rm -f $(TARGETS) *.o *~

Modified: head/share/examples/libusb20/bulk.c
==============================================================================
--- head/share/examples/libusb20/bulk.c	Thu Nov  7 04:52:25 2013	(r257778)
+++ head/share/examples/libusb20/bulk.c	Thu Nov  7 07:22:51 2013	(r257779)
@@ -41,7 +41,7 @@
 #include <libusb20.h>
 #include <libusb20_desc.h>
 
-#include "aux.h"
+#include "util.h"
 
 /*
  * If you want to see the details of the internal datastructures
@@ -74,7 +74,7 @@ doit(struct libusb20_device *dev)
    */
   if ((rv = libusb20_dev_open(dev, 2)) != 0)
     {
-      fprintf(stderr, "libusb20_dev_open: %s\n", usb_error(rv));
+      fprintf(stderr, "libusb20_dev_open: %s\n", libusb20_strerror(rv));
       return;
     }
 
@@ -84,7 +84,7 @@ doit(struct libusb20_device *dev)
    */
   if ((rv = libusb20_dev_set_config_index(dev, 0)) != 0)
     {
-      fprintf(stderr, "libusb20_dev_set_config_index: %s\n", usb_error(rv));
+      fprintf(stderr, "libusb20_dev_set_config_index: %s\n", libusb20_strerror(rv));
       return;
     }
 
@@ -97,7 +97,7 @@ doit(struct libusb20_device *dev)
 
   if (xfr_in == NULL || xfr_out == NULL)
     {
-      fprintf(stderr, "libusb20_tr_get_pointer: %s\n", usb_error(rv));
+      fprintf(stderr, "libusb20_tr_get_pointer: %s\n", libusb20_strerror(rv));
       return;
     }
 
@@ -107,12 +107,12 @@ doit(struct libusb20_device *dev)
    */
   if ((rv = libusb20_tr_open(xfr_out, 0, 1, out_ep)) != 0)
     {
-      fprintf(stderr, "libusb20_tr_open: %s\n", usb_error(rv));
+      fprintf(stderr, "libusb20_tr_open: %s\n", libusb20_strerror(rv));
       return;
     }
   if ((rv = libusb20_tr_open(xfr_in, 0, 1, in_ep)) != 0)
     {
-      fprintf(stderr, "libusb20_tr_open: %s\n", usb_error(rv));
+      fprintf(stderr, "libusb20_tr_open: %s\n", libusb20_strerror(rv));
       return;
     }
 
@@ -124,7 +124,7 @@ doit(struct libusb20_device *dev)
       if ((rv = libusb20_tr_bulk_intr_sync(xfr_out, out_buf, out_len, &rlen, TIMEOUT))
 	  != 0)
 	{
-	  fprintf(stderr, "libusb20_tr_bulk_intr_sync (OUT): %s\n", usb_error(rv));
+	  fprintf(stderr, "libusb20_tr_bulk_intr_sync (OUT): %s\n", libusb20_strerror(rv));
 	}
       printf("sent %d bytes\n", rlen);
     }
@@ -132,7 +132,7 @@ doit(struct libusb20_device *dev)
   if ((rv = libusb20_tr_bulk_intr_sync(xfr_in, in_buf, BUFLEN, &rlen, TIMEOUT))
       != 0)
     {
-      fprintf(stderr, "libusb20_tr_bulk_intr_sync: %s\n", usb_error(rv));
+      fprintf(stderr, "libusb20_tr_bulk_intr_sync: %s\n", libusb20_strerror(rv));
     }
       printf("received %d bytes\n", rlen);
       if (rlen > 0)

Modified: head/share/examples/libusb20/control.c
==============================================================================
--- head/share/examples/libusb20/control.c	Thu Nov  7 04:52:25 2013	(r257778)
+++ head/share/examples/libusb20/control.c	Thu Nov  7 07:22:51 2013	(r257779)
@@ -11,8 +11,6 @@
 /*
  * Simple demo program to illustrate the handling of FreeBSD's
  * libusb20.
- *
- * XXX
  */
 
 /*
@@ -38,12 +36,15 @@
 #include <stdlib.h>
 #include <sysexits.h>
 #include <unistd.h>
+#include <string.h>
 
 #include <libusb20.h>
 #include <libusb20_desc.h>
 
 #include <sys/queue.h>
 
+#include "util.h"
+
 /*
  * If you want to see the details of the internal datastructures
  * in the debugger, unifdef the following.
@@ -86,7 +87,7 @@ doit(struct libusb20_device *dev)
    */
   if ((rv = libusb20_dev_open(dev, 1)) != 0)
     {
-      fprintf(stderr, "libusb20_dev_open: %s\n", usb_error(rv));
+      fprintf(stderr, "libusb20_dev_open: %s\n", libusb20_strerror(rv));
       return;
     }
 
@@ -96,7 +97,7 @@ doit(struct libusb20_device *dev)
    */
   if ((rv = libusb20_dev_set_config_index(dev, 0)) != 0)
     {
-      fprintf(stderr, "libusb20_dev_set_config_index: %s\n", usb_error(rv));
+      fprintf(stderr, "libusb20_dev_set_config_index: %s\n", libusb20_strerror(rv));
       return;
     }
 
@@ -126,7 +127,7 @@ doit(struct libusb20_device *dev)
 					  0 /* flags */)) != 0)
 	{
 	  fprintf(stderr,
-		  "libusb20_dev_request_sync: %s\n", usb_error(rv));
+		  "libusb20_dev_request_sync: %s\n", libusb20_strerror(rv));
 	}
       printf("sent %d bytes\n", actlen);
       if ((setup.bmRequestType & 0x80) != 0)
@@ -146,7 +147,7 @@ doit(struct libusb20_device *dev)
 
       if (xfr_intr == NULL)
 	{
-	  fprintf(stderr, "libusb20_tr_get_pointer: %s\n", usb_error(rv));
+	  fprintf(stderr, "libusb20_tr_get_pointer: %s\n", libusb20_strerror(rv));
 	  return;
 	}
 
@@ -155,7 +156,7 @@ doit(struct libusb20_device *dev)
        */
       if ((rv = libusb20_tr_open(xfr_intr, 0, 1, intr_ep)) != 0)
 	{
-	  fprintf(stderr, "libusb20_tr_open: %s\n", usb_error(rv));
+	  fprintf(stderr, "libusb20_tr_open: %s\n", libusb20_strerror(rv));
 	  return;
 	}
 
@@ -165,7 +166,7 @@ doit(struct libusb20_device *dev)
       if ((rv = libusb20_tr_bulk_intr_sync(xfr_intr, in_buf, BUFLEN, &rlen, TIMEOUT))
 	  != 0)
 	{
-	  fprintf(stderr, "libusb20_tr_bulk_intr_sync: %s\n", usb_error(rv));
+	  fprintf(stderr, "libusb20_tr_bulk_intr_sync: %s\n", libusb20_strerror(rv));
 	}
       printf("received %d bytes\n", rlen);
       if (rlen > 0)

Copied and modified: head/share/examples/libusb20/util.c (from r238603, head/share/examples/libusb20/aux.c)
==============================================================================
--- head/share/examples/libusb20/aux.c	Wed Jul 18 21:30:17 2012	(r238603, copy source)
+++ head/share/examples/libusb20/util.c	Thu Nov  7 07:22:51 2013	(r257779)
@@ -19,77 +19,7 @@
 #include <libusb20.h>
 #include <libusb20_desc.h>
 
-#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;
-}
+#include "util.h"
 
 /*
  * Print "len" bytes from "buf" in hex, followed by an ASCII

Copied and modified: head/share/examples/libusb20/util.h (from r238603, head/share/examples/libusb20/aux.h)
==============================================================================
--- head/share/examples/libusb20/aux.h	Wed Jul 18 21:30:17 2012	(r238603, copy source)
+++ head/share/examples/libusb20/util.h	Thu Nov  7 07:22:51 2013	(r257779)
@@ -11,5 +11,4 @@
 #include <stdint.h>
 #include <libusb20.h>
 
-const char *usb_error(enum libusb20_error r);
 void print_formatted(uint8_t *buf, uint32_t len);
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Comment 2 dfilter service freebsd_committer freebsd_triage 2013-11-07 14:05:57 UTC
Author: glebius
Date: Thu Nov  7 14:05:49 2013
New Revision: 257796
URL: http://svnweb.freebsd.org/changeset/base/257796

Log:
  Finish r257779.
  
  PR:	usb/183728

Modified:
  head/ObsoleteFiles.inc
  head/share/examples/Makefile

Modified: head/ObsoleteFiles.inc
==============================================================================
--- head/ObsoleteFiles.inc	Thu Nov  7 12:40:42 2013	(r257795)
+++ head/ObsoleteFiles.inc	Thu Nov  7 14:05:49 2013	(r257796)
@@ -38,6 +38,9 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20131107: example files removed
+OLD_FILES+=usr/share/examples/libusb20/aux.c
+OLD_FILES+=usr/share/examples/libusb20/aux.h
 # 20131103: WITH_LIBICONV_COMPAT removal
 OLD_FILES+=usr/include/_libiconv_compat.h
 OLD_FILES+=usr/lib/libiconv.a

Modified: head/share/examples/Makefile
==============================================================================
--- head/share/examples/Makefile	Thu Nov  7 12:40:42 2013	(r257795)
+++ head/share/examples/Makefile	Thu Nov  7 14:05:49 2013	(r257796)
@@ -107,8 +107,8 @@ XFILES=	BSD_daemon/FreeBSD.pfa \
 	kld/syscall/test/call.c \
 	libusb20/Makefile \
 	libusb20/README \
-	libusb20/aux.c \
-	libusb20/aux.h \
+	libusb20/util.c \
+	libusb20/util.h \
 	libusb20/bulk.c \
 	libusb20/control.c \
 	libvgl/Makefile \
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Comment 3 Joerg Wunsch freebsd_committer freebsd_triage 2014-08-08 15:16:27 UTC
*** Bug 171347 has been marked as a duplicate of this bug. ***
Comment 4 Ed Maste freebsd_committer freebsd_triage 2014-08-12 14:53:26 UTC
now merged to stable/10
Comment 5 commit-hook freebsd_committer freebsd_triage 2014-08-12 14:53:30 UTC
A commit references this bug:

Author: emaste
Date: Tue Aug 12 14:53:03 UTC 2014
New revision: 269879
URL: http://svnweb.freebsd.org/changeset/base/269879

Log:
  MFC cleanup of libusb20 example

  r257779 by hselasky:

    - Use libusb20_strerror() function instead of custom usb_error() one.
    - Rename "aux.[ch]" to "util.[ch]" which is a more common name for
    utility functions and allows checkout on some non-FreeBSD systems
    where the "aux.*" namespace is reserved.
    - Fix some compile warnings while at it.

  r257796 by glebius:

    Finish r257779.

  PR:		183728

Changes:
_U  stable/10/
  stable/10/ObsoleteFiles.inc
  stable/10/share/examples/Makefile
  stable/10/share/examples/libusb20/Makefile
  stable/10/share/examples/libusb20/aux.c
  stable/10/share/examples/libusb20/aux.h
  stable/10/share/examples/libusb20/bulk.c
  stable/10/share/examples/libusb20/control.c
  stable/10/share/examples/libusb20/util.c
  stable/10/share/examples/libusb20/util.h