summaryrefslogtreecommitdiff
path: root/examples/ezusb.c
Commit message (Collapse)AuthorAgeFilesLines
* examples: Do not assume positive errno macrosTormod Volden2022-01-221-4/+14
| | | | | | | | | | | | | | Some functions were returning e.g. -ENOMEM and the caller would check for negative return values. However, on Haiku, contrary to modern standards, these macros are negative, so this logic would fail. In any case, change the function to return -1 instead. For good measure also set errno to the appropriate value, although it is not used in the current code. This was discovered on Haiku builds because the value for ENOMEM is INT_MIN which cannot be negated without overflow. Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
* Fix various typos in docs/commentsluz paz2021-10-311-1/+1
| | | | | | Found via `codespell -q 3` Closes #1015
* build: Prepare config.h for inclusion in examples/testsChris Dickens2020-11-271-3/+3
| | | | | | | | | | | | There are certain games played in the examples and tests source to account for differences in build environments and target platforms. This can be simplified by including config.h and using the definitions there. To that end, move the printf function attribute definition from libusbi.h to config.h and leverage it where it is used in the examples and tests. Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
* Fixed many compiler warnings about sign and size mismatchSean McBride2019-01-301-1/+1
| | | | | | | | | | - added various casts - added some asserts where the casts made assumptions - enabled additional warnings in Xcode project (especially -Wshorten-64-to-32) Closes #509 Signed-off-by: Nathan Hjelm <hjelmn@me.com>
* examples: fix 2 compiler warningsLudovic Rousseau2016-03-021-2/+2
| | | | | | | | | | | | | ezusb.c:136:13: warning: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Wsign-compare] if (status != len) { ~~~~~~ ^ ~~~ ezusb.c:159:13: warning: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Wsign-compare] if (status != len) { ~~~~~~ ^ ~~~ Signed-off-by: Ludovic Rousseau <ludovic.rousseau@free.fr>
* core: fix/silence issues reported by CoverityPete Batard2014-05-161-5/+9
| | | | | | * libusb has been added to Coverity at https://scan.coverity.com/projects/2180 * Use "// coverity[keyword]" to silence the issues we don't care about * All other issues from the Windows build have been fixed, apart from the closing of the DLLs.
* Misc: Revert all references to libusb/libusb.infohjelmn@cs.unm.edu2014-01-081-4/+4
|
* examples: check value returned by ftell()Ludovic Rousseau2013-10-061-1/+5
| | | | | | | | | Problem detected by the Coverity tool CID 1042546 (#1 of 1): Argument cannot be negative (NEGATIVE_RETURNS)3. negative_returns: "initial_pos" is passed to a parameter that cannot be negative. fseek(3) can't be called with a negative offset with SEEK_SET
* examples: fix warningLudovic Rousseau2013-09-281-1/+1
| | | | | | | ezusb.c: In function 'ezusb_load_ram': ezusb.c:719:6: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized] int ret;
* examples: Fix a memory leakLudovic Rousseau2013-09-201-7/+19
| | | | | | | | Close the image file before exiting the function Problem detected by the Coverity tool CID 1042549 (#2 of 3): Resource leak (RESOURCE_LEAK)9. leaked_storage: Variable "image" going out of scope leaks the storage it points to.
* examples: Fix a memory leakLudovic Rousseau2013-09-201-14/+29
| | | | | | | | Close the image file before exiting the function Problem detected by the Coverity tool CID 1042550 (#1 of 15): Resource leak (RESOURCE_LEAK)7. leaked_storage: Variable "image" going out of scope leaks the storage it points to.
* made some globals static to fix warningsSean McBride2013-07-301-3/+3
|
* Samples: Fix timeout error on FX3 and logging improvements for fxloadPete Batard2013-04-141-11/+61
| | | | | | | | | | * Add a specific ezusb_fx3_jump() that handles timeout as a non-error This is required as a successful jump call makes the device disconnect from the bus * Set default verbosity to 1 and adjust some messages' verbosity level * Add a new -q option to decrease verbosity * Add readout of the bootloader version for FX3 devices * Filter the image types actually supported for FX3 * Fix the "errcode shadows a global variable" warning on some systems
* Samples: More fxload improvements and cleanupPete Batard2013-03-161-8/+13
| | | | | | | * Type detection when bus,addr is specified * Improved check for FX3 image header * Switch back to using -p for bus,addr and use a comma to match the output of listdevs
* Samples: fix compiler warningLudovic Rousseau2013-03-151-1/+1
| | | | | | Make fx3_load_ram a static function. ezusb.c:534: warning: no previous prototype for ‘fx3_load_ram’
* Samples: fxload improvements and cleanupFederico Manzan2013-03-151-20/+44
| | | | | | | * fix C++ compilation * use stdint types * allow to specify bus:address as a parameter * allocate a buffer when transferring FX3 image and check for R/W errors
* Samples: Add FX3 firmware upload support for fxloadFederico Manzan2013-03-101-0/+101
|
* Examples: Fix compiler warningLudovic Rousseau2013-02-151-1/+1
| | | | | | examples/ezusb.c:251:9: warning: implicit conversion loses integer precision: 'unsigned long' to 'unsigned int' [-Wshorten-64-to-32] off = strtoul(buf+3, NULL, 16); ~ ^~~~~~~~~~~~~~~~~~~~~~~~
* All: Use "" instead of <> for local includesLudovic Rousseau2012-10-131-1/+1
| | | | | System header files are used with #include <foo.h> Xcode can't find local headers using this syntax.
* Samples: Fix compiler warnings in fxloadLudovic Rousseau2012-09-151-7/+12
| | | | | | | | | | | | ezusb.c: In function "ezusb_cpucs" ezusb.c:163: warning: initialization discards qualifiers from pointer target type ezusb.c: At top level: ezusb.c:193: warning: no previous prototype for "parse_ihex" ezusb.c:340: warning: no previous prototype for "parse_bin" ezusb.c:377: warning: no previous prototype for "parse_iic" ezusb.c: In function "ram_poke": ezusb.c:451: warning: enumeration value "_undef" not handled in switch ezusb.c:491: warning: passing argument 2 of "ezusb_write" discards qualifiers from pointer target type
* Samples: Add fxload sample for Cypress EZ-USB chipsPete Batard2012-09-131-0/+611
* This program was modified from the original fxload at: http://linux-hotplug.sourceforge.net to add libusbx as well as non HEX images support. * Only supports RAM upload for now, with EEPROM and FX3 support to be added at a later stage.