all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] avrdude: Build with libusb-compat.
@ 2016-06-25  7:22 Ricardo Wurmus
  2016-06-25 17:46 ` Leo Famulari
  0 siblings, 1 reply; 4+ messages in thread
From: Ricardo Wurmus @ 2016-06-25  7:22 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 468 bytes --]

Hi Guix,

I’m using avrdude with an AVRISP mkII, a USB programmer for AVR
microcontrollers.  When I configure avrdude to use the USB device it
tells me that it was built without USB support.

The attached patch fixes this by building with libusb-compat.  I don’t
understand how building with the more recent “libusb” should have
worked.  Could someone using “avrdude” please check my patch and see if
it still works with their own programmer?

~~ Ricardo


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-avrdude-Use-libusb-compat.patch --]
[-- Type: text/x-patch, Size: 7688 bytes --]

From d3b55c37bea64c563a373f1f7c85d98162432b29 Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus <rekado@elephly.net>
Date: Sat, 25 Jun 2016 09:16:23 +0200
Subject: [PATCH] gnu: avrdude: Use libusb-compat.

* gnu/packages/patches/avrdude-fix-libusb.patch: Remove file.
* gnu/packages/flashing-tools.scm (avrdude)[source]: Remove patch.
[inputs]: Replace "libusb" with "libusb-compat".
---
 gnu/packages/flashing-tools.scm               |   5 +-
 gnu/packages/patches/avrdude-fix-libusb.patch | 256 --------------------------
 2 files changed, 2 insertions(+), 259 deletions(-)
 delete mode 100644 gnu/packages/patches/avrdude-fix-libusb.patch

diff --git a/gnu/packages/flashing-tools.scm b/gnu/packages/flashing-tools.scm
index 0ab8bc5..e3f8d80 100644
--- a/gnu/packages/flashing-tools.scm
+++ b/gnu/packages/flashing-tools.scm
@@ -90,12 +90,11 @@ programmer devices.")
                           version ".tar.gz"))
       (sha256
        (base32
-        "0frxg0q09nrm95z7ymzddx7ysl77ilfbdix1m81d9jjpiv5bm64y"))
-      (patches (search-patches "avrdude-fix-libusb.patch"))))
+        "0frxg0q09nrm95z7ymzddx7ysl77ilfbdix1m81d9jjpiv5bm64y"))))
     (build-system gnu-build-system)
     (inputs
      `(("libelf" ,libelf)
-       ("libusb" ,libusb)
+       ("libusb" ,libusb-compat)
        ("libftdi" ,libftdi)))
     (native-inputs
      `(("bison" ,bison)
diff --git a/gnu/packages/patches/avrdude-fix-libusb.patch b/gnu/packages/patches/avrdude-fix-libusb.patch
deleted file mode 100644
index 13d0eca..0000000
--- a/gnu/packages/patches/avrdude-fix-libusb.patch
+++ /dev/null
@@ -1,256 +0,0 @@
-Avrdude cannot build with our version of libusb. This patch fixes that.
-See http://savannah.nongnu.org/bugs/?41854
-
-diff --git a/dfu.c b/dfu.c
-index 7d349bc..0f80440 100644
---- a/dfu.c
-+++ b/dfu.c
-@@ -36,13 +36,14 @@
- 
- #ifndef HAVE_LIBUSB
- 
--int dfu_open(struct dfu_dev *dfu, char *port_name) {
-+struct dfu_dev * dfu_open(char *port_spec) {
-   fprintf(stderr, "%s: Error: No USB support in this compile of avrdude\n",
-     progname);
--  return -1;
-+  return NULL;
- }
- 
--int dfu_init(struct dfu_dev *dfu, unsigned short usb_pid) {
-+int dfu_init(struct dfu_dev *dfu,
-+  unsigned short vid, unsigned short pid) {
-   return -1;
- }
- 
-diff --git a/flip1.c b/flip1.c
-index b891d80..0959996 100644
---- a/flip1.c
-+++ b/flip1.c
-@@ -164,6 +164,8 @@ static void flip1_setup(PROGRAMMER * pgm);
- static void flip1_teardown(PROGRAMMER * pgm);
- 
- /* INTERNAL PROGRAMMER FUNCTION PROTOTYPES */
-+#ifdef HAVE_LIBUSB
-+// The internal ones are made conditional, as they're not defined further down #ifndef HAVE_LIBUSB
- 
- static void flip1_show_info(struct flip1 *flip1);
- 
-@@ -177,6 +179,8 @@ static const char * flip1_mem_unit_str(enum flip1_mem_unit mem_unit);
- static int flip1_set_mem_page(struct dfu_dev *dfu, unsigned short page_addr);
- static enum flip1_mem_unit flip1_mem_unit(const char *name);
- 
-+#endif /* HAVE_LIBUSB */
-+
- /* THE INITPGM FUNCTION DEFINITIONS */
- 
- void flip1_initpgm(PROGRAMMER *pgm)
-@@ -201,6 +205,7 @@ void flip1_initpgm(PROGRAMMER *pgm)
-   pgm->teardown         = flip1_teardown;
- }
- 
-+#ifdef HAVE_LIBUSB
- /* EXPORTED PROGRAMMER FUNCTION DEFINITIONS */
- 
- int flip1_open(PROGRAMMER *pgm, char *port_spec)
-@@ -876,3 +881,82 @@ enum flip1_mem_unit flip1_mem_unit(const char *name) {
-     return FLIP1_MEM_UNIT_EEPROM;
-   return FLIP1_MEM_UNIT_UNKNOWN;
- }
-+#else /* HAVE_LIBUSB */
-+// Dummy functions
-+int flip1_open(PROGRAMMER *pgm, char *port_spec)
-+{
-+  fprintf(stderr, "%s: Error: No USB support in this compile of avrdude\n",
-+    progname);
-+  return NULL;
-+}
-+
-+int flip1_initialize(PROGRAMMER* pgm, AVRPART *part)
-+{
-+  return -1;
-+}
-+
-+void flip1_close(PROGRAMMER* pgm)
-+{
-+}
-+
-+void flip1_enable(PROGRAMMER* pgm)
-+{
-+}
-+
-+void flip1_disable(PROGRAMMER* pgm)
-+{
-+}
-+
-+void flip1_display(PROGRAMMER* pgm, const char *prefix)
-+{
-+}
-+
-+int flip1_program_enable(PROGRAMMER* pgm, AVRPART *part)
-+{
-+  return -1;
-+}
-+
-+int flip1_chip_erase(PROGRAMMER* pgm, AVRPART *part)
-+{
-+  return -1;
-+}
-+
-+int flip1_read_byte(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem,
-+  unsigned long addr, unsigned char *value)
-+{
-+  return -1;
-+}
-+
-+int flip1_write_byte(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem,
-+  unsigned long addr, unsigned char value)
-+{
-+  return -1;
-+}
-+
-+int flip1_paged_load(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem,
-+  unsigned int page_size, unsigned int addr, unsigned int n_bytes)
-+{
-+  return -1;
-+}
-+
-+int flip1_paged_write(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem,
-+  unsigned int page_size, unsigned int addr, unsigned int n_bytes)
-+{
-+  return -1;
-+}
-+
-+int flip1_read_sig_bytes(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem)
-+{
-+  return -1;
-+}
-+
-+void flip1_setup(PROGRAMMER * pgm)
-+{
-+}
-+
-+void flip1_teardown(PROGRAMMER * pgm)
-+{
-+}
-+
-+
-+#endif /* HAVE_LIBUSB */
-\ No newline at end of file
-
-diff --git a/flip2.c b/flip2.c
-index ed8e996..16c4bf8 100644
---- a/flip2.c
-+++ b/flip2.c
-@@ -151,6 +151,8 @@ static void flip2_setup(PROGRAMMER * pgm);
- static void flip2_teardown(PROGRAMMER * pgm);
- 
- /* INTERNAL PROGRAMMER FUNCTION PROTOTYPES */
-+#ifdef HAVE_LIBUSB
-+// The internal ones are made conditional, as they're not defined further down #ifndef HAVE_LIBUSB
- 
- static void flip2_show_info(struct flip2 *flip2);
- 
-@@ -171,6 +173,8 @@ static const char * flip2_status_str(const struct dfu_status *status);
- static const char * flip2_mem_unit_str(enum flip2_mem_unit mem_unit);
- static enum flip2_mem_unit flip2_mem_unit(const char *name);
- 
-+#endif /* HAVE_LIBUSB */
-+
- /* THE INITPGM FUNCTION DEFINITIONS */
- 
- void flip2_initpgm(PROGRAMMER *pgm)
-@@ -195,6 +199,7 @@ void flip2_initpgm(PROGRAMMER *pgm)
-   pgm->teardown         = flip2_teardown;
- }
- 
-+#ifdef HAVE_LIBUSB
- /* EXPORTED PROGRAMMER FUNCTION DEFINITIONS */
- 
- int flip2_open(PROGRAMMER *pgm, char *port_spec)
-@@ -922,3 +927,85 @@ enum flip2_mem_unit flip2_mem_unit(const char *name) {
-     return FLIP2_MEM_UNIT_SIGNATURE;
-   return FLIP2_MEM_UNIT_UNKNOWN;
- }
-+
-+#else /* HAVE_LIBUSB */
-+
-+/* EXPORTED PROGRAMMER FUNCTION DEFINITIONS */
-+
-+int flip2_open(PROGRAMMER *pgm, char *port_spec)
-+{
-+  fprintf(stderr, "%s: Error: No USB support in this compile of avrdude\n",
-+    progname);
-+  return NULL;
-+}
-+
-+int flip2_initialize(PROGRAMMER* pgm, AVRPART *part)
-+{
-+  return -1;
-+}
-+
-+void flip2_close(PROGRAMMER* pgm)
-+{
-+}
-+
-+void flip2_enable(PROGRAMMER* pgm)
-+{
-+}
-+
-+void flip2_disable(PROGRAMMER* pgm)
-+{
-+}
-+
-+void flip2_display(PROGRAMMER* pgm, const char *prefix)
-+{
-+}
-+
-+int flip2_program_enable(PROGRAMMER* pgm, AVRPART *part)
-+{
-+  return -1;
-+}
-+
-+int flip2_chip_erase(PROGRAMMER* pgm, AVRPART *part)
-+{
-+  return -1;
-+}
-+
-+int flip2_read_byte(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem,
-+  unsigned long addr, unsigned char *value)
-+{
-+  return -1;
-+}
-+
-+int flip2_write_byte(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem,
-+  unsigned long addr, unsigned char value)
-+{
-+  return -1;
-+}
-+
-+int flip2_paged_load(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem,
-+  unsigned int page_size, unsigned int addr, unsigned int n_bytes)
-+{
-+  return -1;
-+}
-+
-+int flip2_paged_write(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem,
-+  unsigned int page_size, unsigned int addr, unsigned int n_bytes)
-+{
-+  return -1;
-+}
-+
-+int flip2_read_sig_bytes(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem)
-+{
-+  return -1;
-+}
-+
-+void flip2_setup(PROGRAMMER * pgm)
-+{
-+}
-+
-+void flip2_teardown(PROGRAMMER * pgm)
-+{
-+}
-+
-+
-+#endif /* HAVE_LIBUSB */
-- 
2.8.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] avrdude: Build with libusb-compat.
  2016-06-25  7:22 [PATCH] avrdude: Build with libusb-compat Ricardo Wurmus
@ 2016-06-25 17:46 ` Leo Famulari
  2016-06-25 19:39   ` Ricardo Wurmus
  2016-06-29  5:16   ` Ricardo Wurmus
  0 siblings, 2 replies; 4+ messages in thread
From: Leo Famulari @ 2016-06-25 17:46 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

On Sat, Jun 25, 2016 at 09:22:06AM +0200, Ricardo Wurmus wrote:
> * gnu/packages/patches/avrdude-fix-libusb.patch: Remove file.
> * gnu/packages/flashing-tools.scm (avrdude)[source]: Remove patch.
> [inputs]: Replace "libusb" with "libusb-compat".

If we delete the patch file, we will want to remove the reference in
gnu/local.mk, right?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] avrdude: Build with libusb-compat.
  2016-06-25 17:46 ` Leo Famulari
@ 2016-06-25 19:39   ` Ricardo Wurmus
  2016-06-29  5:16   ` Ricardo Wurmus
  1 sibling, 0 replies; 4+ messages in thread
From: Ricardo Wurmus @ 2016-06-25 19:39 UTC (permalink / raw)
  To: Leo Famulari; +Cc: guix-devel


Leo Famulari <leo@famulari.name> writes:

> On Sat, Jun 25, 2016 at 09:22:06AM +0200, Ricardo Wurmus wrote:
>> * gnu/packages/patches/avrdude-fix-libusb.patch: Remove file.
>> * gnu/packages/flashing-tools.scm (avrdude)[source]: Remove patch.
>> [inputs]: Replace "libusb" with "libusb-compat".
>
> If we delete the patch file, we will want to remove the reference in
> gnu/local.mk, right?

Yes, you’re right.  I’ll add that.

What’s important for me to know, though, is whether the use of the
latest libusb and the patch are supposed to work already and if it would
be bad to use libusb-compat.

~~ Ricardo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] avrdude: Build with libusb-compat.
  2016-06-25 17:46 ` Leo Famulari
  2016-06-25 19:39   ` Ricardo Wurmus
@ 2016-06-29  5:16   ` Ricardo Wurmus
  1 sibling, 0 replies; 4+ messages in thread
From: Ricardo Wurmus @ 2016-06-29  5:16 UTC (permalink / raw)
  To: Leo Famulari; +Cc: guix-devel


Leo Famulari <leo@famulari.name> writes:

> On Sat, Jun 25, 2016 at 09:22:06AM +0200, Ricardo Wurmus wrote:
>> * gnu/packages/patches/avrdude-fix-libusb.patch: Remove file.
>> * gnu/packages/flashing-tools.scm (avrdude)[source]: Remove patch.
>> [inputs]: Replace "libusb" with "libusb-compat".
>
> If we delete the patch file, we will want to remove the reference in
> gnu/local.mk, right?

I pushed the commit to master after also removing the patch from
gnu/local.mk.  Thanks for catching this mistake!

~~ Ricardo

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-06-29  5:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-25  7:22 [PATCH] avrdude: Build with libusb-compat Ricardo Wurmus
2016-06-25 17:46 ` Leo Famulari
2016-06-25 19:39   ` Ricardo Wurmus
2016-06-29  5:16   ` Ricardo Wurmus

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.