bug #41854: avrdude 6.1 does not compile on systems without libUSB

Submitted by Didrik Madheden:
* flip1.c: Provide dummy functions for the #ifndef HAVE_LIBUSB case
* flip2.c: (Dito.)



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1314 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
Joerg Wunsch 2014-05-19 12:32:33 +00:00
parent 8b3a4aab56
commit d3149cee79
3 changed files with 178 additions and 0 deletions

View File

@ -1,3 +1,10 @@
2014-05-19 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #41854: avrdude 6.1 does not compile on systems without libUSB
Submitted by Didrik Madheden:
* flip1.c: Provide dummy functions for the #ifndef HAVE_LIBUSB case
* flip2.c: (Dito.)
2014-05-19 Joerg Wunsch <j.gnu@uriah.heep.sax.de> 2014-05-19 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* libavrdude.h: Join the former "public" header files (avr.h avrpart.h pindefs.h * libavrdude.h: Join the former "public" header files (avr.h avrpart.h pindefs.h

84
flip1.c
View File

@ -163,6 +163,8 @@ static void flip1_setup(PROGRAMMER * pgm);
static void flip1_teardown(PROGRAMMER * pgm); static void flip1_teardown(PROGRAMMER * pgm);
/* INTERNAL PROGRAMMER FUNCTION PROTOTYPES */ /* 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); static void flip1_show_info(struct flip1 *flip1);
@ -176,6 +178,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 int flip1_set_mem_page(struct dfu_dev *dfu, unsigned short page_addr);
static enum flip1_mem_unit flip1_mem_unit(const char *name); static enum flip1_mem_unit flip1_mem_unit(const char *name);
#endif /* HAVE_LIBUSB */
/* THE INITPGM FUNCTION DEFINITIONS */ /* THE INITPGM FUNCTION DEFINITIONS */
void flip1_initpgm(PROGRAMMER *pgm) void flip1_initpgm(PROGRAMMER *pgm)
@ -200,6 +204,7 @@ void flip1_initpgm(PROGRAMMER *pgm)
pgm->teardown = flip1_teardown; pgm->teardown = flip1_teardown;
} }
#ifdef HAVE_LIBUSB
/* EXPORTED PROGRAMMER FUNCTION DEFINITIONS */ /* EXPORTED PROGRAMMER FUNCTION DEFINITIONS */
int flip1_open(PROGRAMMER *pgm, char *port_spec) int flip1_open(PROGRAMMER *pgm, char *port_spec)
@ -869,3 +874,82 @@ enum flip1_mem_unit flip1_mem_unit(const char *name) {
return FLIP1_MEM_UNIT_EEPROM; return FLIP1_MEM_UNIT_EEPROM;
return FLIP1_MEM_UNIT_UNKNOWN; 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 -1;
}
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 */

87
flip2.c
View File

@ -149,6 +149,8 @@ static void flip2_setup(PROGRAMMER * pgm);
static void flip2_teardown(PROGRAMMER * pgm); static void flip2_teardown(PROGRAMMER * pgm);
/* INTERNAL PROGRAMMER FUNCTION PROTOTYPES */ /* 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); static void flip2_show_info(struct flip2 *flip2);
@ -169,6 +171,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 const char * flip2_mem_unit_str(enum flip2_mem_unit mem_unit);
static enum flip2_mem_unit flip2_mem_unit(const char *name); static enum flip2_mem_unit flip2_mem_unit(const char *name);
#endif /* HAVE_LIBUSB */
/* THE INITPGM FUNCTION DEFINITIONS */ /* THE INITPGM FUNCTION DEFINITIONS */
void flip2_initpgm(PROGRAMMER *pgm) void flip2_initpgm(PROGRAMMER *pgm)
@ -193,6 +197,7 @@ void flip2_initpgm(PROGRAMMER *pgm)
pgm->teardown = flip2_teardown; pgm->teardown = flip2_teardown;
} }
#ifdef HAVE_LIBUSB
/* EXPORTED PROGRAMMER FUNCTION DEFINITIONS */ /* EXPORTED PROGRAMMER FUNCTION DEFINITIONS */
int flip2_open(PROGRAMMER *pgm, char *port_spec) int flip2_open(PROGRAMMER *pgm, char *port_spec)
@ -916,3 +921,85 @@ enum flip2_mem_unit flip2_mem_unit(const char *name) {
return FLIP2_MEM_UNIT_SIGNATURE; return FLIP2_MEM_UNIT_SIGNATURE;
return FLIP2_MEM_UNIT_UNKNOWN; 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 -1;
}
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 */