unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] gnu: Add AVRDUDE
@ 2014-07-24  8:12 Manolis Ragkousis
  2014-07-24  8:18 ` Andreas Enge
  2014-07-24  8:21 ` Ludovic Courtès
  0 siblings, 2 replies; 5+ messages in thread
From: Manolis Ragkousis @ 2014-07-24  8:12 UTC (permalink / raw)
  To: Guix-devel

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



[-- Attachment #2: 0001-gnu-Add-AVRDUDE.patch --]
[-- Type: text/x-patch, Size: 9630 bytes --]

From fe4e8f626bfccc7cbe1d482e53b5a32fe019188a Mon Sep 17 00:00:00 2001
From: Manolis Ragkousis <manolis837@gmail.com>
Date: Thu, 24 Jul 2014 11:05:43 +0000
Subject: [PATCH] gnu: Add AVRDUDE

* gnu/packages/avrdude.scm: New file
* gnu-system.am (GNU_SYSTEM_MODULES): Add avrdude.scm
---
 gnu-system.am                                 |   1 +
 gnu/packages/avrdude.scm                      |  57 ++++++
 gnu/packages/patches/avrdude-fix-libusb.patch | 256 ++++++++++++++++++++++++++
 3 files changed, 314 insertions(+)
 create mode 100644 gnu/packages/avrdude.scm
 create mode 100644 gnu/packages/patches/avrdude-fix-libusb.patch

diff --git a/gnu-system.am b/gnu-system.am
index c3e1b98..d8a80cd 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -37,6 +37,7 @@ GNU_SYSTEM_MODULES =				\
   gnu/packages/autogen.scm			\
   gnu/packages/autotools.scm			\
   gnu/packages/avahi.scm			\
+  gnu/packages/avrdude.scm			\
   gnu/packages/backup.scm			\
   gnu/packages/base.scm				\
   gnu/packages/bash.scm				\
diff --git a/gnu/packages/avrdude.scm b/gnu/packages/avrdude.scm
new file mode 100644
index 0000000..bff544b
--- /dev/null
+++ b/gnu/packages/avrdude.scm
@@ -0,0 +1,57 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2014 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages avrdude)
+  #:use-module (guix licenses)
+  #:use-module (guix download)
+  #:use-module (guix packages)
+  #:use-module (gnu packages)
+  #:use-module (guix build-system gnu)
+  #:use-module (gnu packages bison)
+  #:use-module (gnu packages flex)
+  #:use-module (gnu packages elf)
+  #:use-module (gnu packages libusb)
+  #:use-module (gnu packages libftdi))
+
+(define-public avrdude
+  (package
+    (name "avrdude")
+    (version "6.1")
+    (source
+     (origin
+      (method url-fetch)
+      (uri (string-append "mirror://savannah/avrdude/avrdude-"
+                          version ".tar.gz"))
+      (sha256
+       (base32
+        "0frxg0q09nrm95z7ymzddx7ysl77ilfbdix1m81d9jjpiv5bm64y"))
+      (patches (list (search-patch "avrdude-fix-libusb.patch")))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("libelf" ,libelf)
+       ("libusb" ,libusb)
+       ("libftdi" ,libftdi)
+       ("bison" ,bison)
+       ("flex" ,flex)))
+    (home-page "http://www.nongnu.org/avrdude/")
+    (synopsis "AVR Downloader/UploaDEr")
+    (description
+     "AVRDUDE is an utility to download/upload/manipulate the ROM and
+EEPROM contents of AVR microcontrollers using the in-system programming
+technique (ISP)")
+    (license gpl2+)))
diff --git a/gnu/packages/patches/avrdude-fix-libusb.patch b/gnu/packages/patches/avrdude-fix-libusb.patch
new file mode 100644
index 0000000..13d0eca
--- /dev/null
+++ b/gnu/packages/patches/avrdude-fix-libusb.patch
@@ -0,0 +1,256 @@
+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.0.1


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

* Re: [PATCH] gnu: Add AVRDUDE
  2014-07-24  8:12 [PATCH] gnu: Add AVRDUDE Manolis Ragkousis
@ 2014-07-24  8:18 ` Andreas Enge
  2014-07-24  8:21 ` Ludovic Courtès
  1 sibling, 0 replies; 5+ messages in thread
From: Andreas Enge @ 2014-07-24  8:18 UTC (permalink / raw)
  To: Manolis Ragkousis; +Cc: Guix-devel

On Thu, Jul 24, 2014 at 08:12:42AM +0000, Manolis Ragkousis wrote:
> +     "AVRDUDE is an utility to download/upload/manipulate the ROM and

"a" utility, because it is pronounced like "youtility".

Andreas

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

* Re: [PATCH] gnu: Add AVRDUDE
  2014-07-24  8:12 [PATCH] gnu: Add AVRDUDE Manolis Ragkousis
  2014-07-24  8:18 ` Andreas Enge
@ 2014-07-24  8:21 ` Ludovic Courtès
  2014-07-30 13:41   ` Manolis Ragkousis
  1 sibling, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2014-07-24  8:21 UTC (permalink / raw)
  To: Manolis Ragkousis; +Cc: Guix-devel

Manolis Ragkousis <manolis837@gmail.com> skribis:

> From fe4e8f626bfccc7cbe1d482e53b5a32fe019188a Mon Sep 17 00:00:00 2001
> From: Manolis Ragkousis <manolis837@gmail.com>
> Date: Thu, 24 Jul 2014 11:05:43 +0000
> Subject: [PATCH] gnu: Add AVRDUDE
>
> * gnu/packages/avrdude.scm: New file
> * gnu-system.am (GNU_SYSTEM_MODULES): Add avrdude.scm

[...]

> --- a/gnu-system.am
> +++ b/gnu-system.am
> @@ -37,6 +37,7 @@ GNU_SYSTEM_MODULES =				\
>    gnu/packages/autogen.scm			\
>    gnu/packages/autotools.scm			\
>    gnu/packages/avahi.scm			\
> +  gnu/packages/avrdude.scm			\
>    gnu/packages/backup.scm			\
>    gnu/packages/base.scm				\
>    gnu/packages/bash.scm				\

You also need to add the patch in gnu-system.am.

> +    (native-inputs
> +     `(("libelf" ,libelf)
> +       ("libusb" ,libusb)
> +       ("libftdi" ,libftdi)
> +       ("bison" ,bison)
> +       ("flex" ,flex)))

I think only Bison and Flex need to be native inputs (think about
cross-compilation), the rest should be inputs.

> +    (home-page "http://www.nongnu.org/avrdude/")
> +    (synopsis "AVR Downloader/UploaDEr")

Just “AVR downloader and uploader”.

> +    (description
> +     "AVRDUDE is an utility to download/upload/manipulate the ROM and
> +EEPROM contents of AVR microcontrollers using the in-system programming
> +technique (ISP)")

Mission period.

Could you send an updated patch?

Thanks,
Ludo’.

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

* Re: [PATCH] gnu: Add AVRDUDE
  2014-07-24  8:21 ` Ludovic Courtès
@ 2014-07-30 13:41   ` Manolis Ragkousis
  2014-08-11 16:39     ` Ludovic Courtès
  0 siblings, 1 reply; 5+ messages in thread
From: Manolis Ragkousis @ 2014-07-30 13:41 UTC (permalink / raw)
  To: Guix-devel

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

Updated patch.

[-- Attachment #2: 0001-gnu-Add-AVRDUDE.patch --]
[-- Type: text/x-patch, Size: 10192 bytes --]

From 4aa2ac68c5d36a2f8223db7427063b9085e8c852 Mon Sep 17 00:00:00 2001
From: Manolis Ragkousis <manolis837@gmail.com>
Date: Thu, 24 Jul 2014 11:05:43 +0000
Subject: [PATCH] gnu: Add AVRDUDE

* gnu/packages/avrdude.scm: New file
* gnu-system.am (GNU_SYSTEM_MODULES): Add avrdude.scm
* gnu/packages/patches/avrdude-fix-libusb.patch: New patch.
* gnu-system.am (dist_patch_DATA): Add it.
---
 gnu-system.am                                 |   2 +
 gnu/packages/avrdude.scm                      |  58 ++++++
 gnu/packages/patches/avrdude-fix-libusb.patch | 256 ++++++++++++++++++++++++++
 3 files changed, 316 insertions(+)
 create mode 100644 gnu/packages/avrdude.scm
 create mode 100644 gnu/packages/patches/avrdude-fix-libusb.patch

diff --git a/gnu-system.am b/gnu-system.am
index c3e1b98..c1e9932 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -37,6 +37,7 @@ GNU_SYSTEM_MODULES =				\
   gnu/packages/autogen.scm			\
   gnu/packages/autotools.scm			\
   gnu/packages/avahi.scm			\
+  gnu/packages/avrdude.scm			\
   gnu/packages/backup.scm			\
   gnu/packages/base.scm				\
   gnu/packages/bash.scm				\
@@ -279,6 +280,7 @@ dist_patch_DATA =						\
   gnu/packages/patches/apr-skip-getservbyname-test.patch	\
   gnu/packages/patches/automake-skip-amhello-tests.patch	\
   gnu/packages/patches/avahi-localstatedir.patch		\
+  gnu/packages/patches/avrdude-fix-libusb.patch			\
   gnu/packages/patches/bigloo-gc-shebangs.patch			\
   gnu/packages/patches/binutils-ld-new-dtags.patch		\
   gnu/packages/patches/binutils-loongson-workaround.patch	\
diff --git a/gnu/packages/avrdude.scm b/gnu/packages/avrdude.scm
new file mode 100644
index 0000000..2845604
--- /dev/null
+++ b/gnu/packages/avrdude.scm
@@ -0,0 +1,58 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2014 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages avrdude)
+  #:use-module (guix licenses)
+  #:use-module (guix download)
+  #:use-module (guix packages)
+  #:use-module (gnu packages)
+  #:use-module (guix build-system gnu)
+  #:use-module (gnu packages bison)
+  #:use-module (gnu packages flex)
+  #:use-module (gnu packages elf)
+  #:use-module (gnu packages libusb)
+  #:use-module (gnu packages libftdi))
+
+(define-public avrdude
+  (package
+    (name "avrdude")
+    (version "6.1")
+    (source
+     (origin
+      (method url-fetch)
+      (uri (string-append "mirror://savannah/avrdude/avrdude-"
+                          version ".tar.gz"))
+      (sha256
+       (base32
+        "0frxg0q09nrm95z7ymzddx7ysl77ilfbdix1m81d9jjpiv5bm64y"))
+      (patches (list (search-patch "avrdude-fix-libusb.patch")))))
+    (build-system gnu-build-system)
+    (inputs
+     `(("libelf" ,libelf)
+       ("libusb" ,libusb)
+       ("libftdi" ,libftdi)))
+    (native-inputs
+     `(("bison" ,bison)
+       ("flex" ,flex)))
+    (home-page "http://www.nongnu.org/avrdude/")
+    (synopsis "AVR downloader and uploader")
+    (description
+     "AVRDUDE is a utility to download/upload/manipulate the ROM and
+EEPROM contents of AVR microcontrollers using the in-system programming
+technique (ISP).")
+    (license gpl2+)))
diff --git a/gnu/packages/patches/avrdude-fix-libusb.patch b/gnu/packages/patches/avrdude-fix-libusb.patch
new file mode 100644
index 0000000..13d0eca
--- /dev/null
+++ b/gnu/packages/patches/avrdude-fix-libusb.patch
@@ -0,0 +1,256 @@
+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.0.3


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

* Re: [PATCH] gnu: Add AVRDUDE
  2014-07-30 13:41   ` Manolis Ragkousis
@ 2014-08-11 16:39     ` Ludovic Courtès
  0 siblings, 0 replies; 5+ messages in thread
From: Ludovic Courtès @ 2014-08-11 16:39 UTC (permalink / raw)
  To: Manolis Ragkousis; +Cc: Guix-devel

Manolis Ragkousis <manolis837@gmail.com> skribis:

> From 4aa2ac68c5d36a2f8223db7427063b9085e8c852 Mon Sep 17 00:00:00 2001
> From: Manolis Ragkousis <manolis837@gmail.com>
> Date: Thu, 24 Jul 2014 11:05:43 +0000
> Subject: [PATCH] gnu: Add AVRDUDE
>
> * gnu/packages/avrdude.scm: New file
> * gnu-system.am (GNU_SYSTEM_MODULES): Add avrdude.scm
> * gnu/packages/patches/avrdude-fix-libusb.patch: New patch.
> * gnu-system.am (dist_patch_DATA): Add it.

Pushed, thanks.

Ludo’.

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

end of thread, other threads:[~2014-08-11 16:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-24  8:12 [PATCH] gnu: Add AVRDUDE Manolis Ragkousis
2014-07-24  8:18 ` Andreas Enge
2014-07-24  8:21 ` Ludovic Courtès
2014-07-30 13:41   ` Manolis Ragkousis
2014-08-11 16:39     ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).