summaryrefslogtreecommitdiff
path: root/examples
Commit message (Collapse)AuthorAgeFilesLines
* Misc: Fix missing files from dist packagePete Batard2012-09-161-1/+1
|
* 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: Display VID:PID of the tested device in xusbLudovic Rousseau2012-09-141-2/+2
| | | | | * Also amend the wording of the "no option" comment. * Closes #42
* Samples: Add fxload sample for Cypress EZ-USB chipsPete Batard2012-09-137-1/+2411
| | | | | | | | * 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.
* Samples: xusb improvementsPete Batard2012-09-051-21/+28
| | | | | | * update and fix usage details * make topology and speed printout optional (option -i) * remove unneeded option -g
* Samples: Make target mandatory with -b option in xusbPete Batard2012-08-121-8/+6
|
* Core: Prefix LOG_LEVEL_ with LIBUSB_ to avoid conflictsPete Batard2012-07-031-1/+1
| | | | | | | | | * The LOG_LEVEL_ enums, that were moved to the public API in 933a319469bcccc962031c989e39d9d1f44f2885 may conflict with applications/headers that also define their own LOG_LEVEL_ values internally. * As a matter of fact, as per Trac #31, this produces a conflict with libusb-compat, as it defines its own levels.
* Misc: Fix more Clang warnings in core and darwinPete Batard2012-07-022-2/+2
| | | | | | | | | | * http://sourceforge.net/mailarchive/message.php?msg_id=29418038 * core.c:700:4: warning: Function call argument is an uninitialized value * darwin_usb.c:1713:11: warning: Access to field 'cfSource' results in a dereference of a null pointer (loaded from variable 'hpriv') * sync.c/dpfp.c/dpfp_threaded.c: warning: Result of 'malloc' is converted to a pointer of type 'unsigned char', which is incompatible with sizeof operand type
* Windows: Address MSVC Level 4 & WDK's OACR/Prefast warningsPete Batard2012-07-021-1/+4
| | | | | | | | | | | | | * The library is now compiled with warning level 4 for VS2010 * Move silencing of 4200, 28125 and 28719 to msvc/config.h * Add fixes in core to silence unused variables warnings * Ensure that spinlock is always set interlocked in poll_windows * Add missing check for calloc return value * Fix data assignation in conditionals warnings * Fix an OACR/Prefast error related to the use of strncpy in xusb.c * Also fixes whitespace inconsistencies in core * Issues reported by Orin Eman and Xiaofan Chen. See: https://sourceforge.net/mailarchive/message.php?msg_id=29412656
* Samples: Remove USB version for speed designations in xusbXiaofan Chen2012-06-141-2/+2
|
* Samples: Fix no previous prototype warnings in xusbLudovic Rousseau2012-06-041-2/+2
|
* Autotools: Apply autoupdate 2.68 recommendationsLudovic Rousseau2012-06-041-1/+1
| | | | | * Not applied: AC_PREREQ([2.68]) as this doesn't seem necessary and 2.68 was released less than 2 years ago.
* Windows: Restore HID supportPete Batard2012-05-281-2/+169
|
* Core: Define log levels in libusb.hPete Batard2012-05-281-2/+1
| | | | * Also update xusb sample to use these levels
* All: Add parent and port topology callsPete Batard2012-05-281-4/+0
| | | | | | * Adds libusb_get_port_number, libusb_get_parent and libusb_get_port_path * Linux implementation provided by Alan Stern, OS X by Nathan Hjelm * Unsupported for *BSD platforms
* Misc: Ensure all sources are UTF-8Pete Batard2012-05-234-7/+4
| | | | * Also remove extra lines at the end of samples
* Samples: Use the implicit _SOURCES ruleLudovic Rousseau2012-05-101-6/+0
| | | | * By default automake looks for a source file foo.c for a foo binary.
* Samples: Use a common LDADD for all examplesLudovic Rousseau2012-05-101-4/+2
| | | | * Similar to libusb patch a129732fb45fc424743f26f01c906e4514f11521
* Samples: prefer __linux__ over __linux define in xusbPete Batard2012-05-101-3/+3
| | | | | | * While both should work, __linux__ seems to be preferred and what we use in threads_posix.c * Also fix a typo in .private/README.txt
* Samples: fix strcat vs strlcat warning on OpenBSDPete Batard2012-05-081-2/+1
| | | | | * Without this, OpenBSD produces the following warning: strcat() is almost always misused, please use strlcat()
* Samples: Remove interface requests when querying WCID devicesPete Batard2012-05-021-10/+3
| | | | | | * As per MS documentation, querying of the Extended Properties is a device request (0xC0), not an interface one (0xC1), so there is no issue with the WinUSB wIndex override.
* Samples: Fix not handled in switch warning in xusb.cLudovic Rousseau2012-04-201-1/+1
| | | | | xusb.c: In function ‘test_device’: xusb.c:722:2: warning: enumeration value ‘USE_GENERIC’ not handled in switch [-Wswitch-enum]
* Samples: Remove unneeded inline in xusb.cLudovic Rousseau2012-04-201-1/+1
| | | | | | Fixes: warning: function ‘perr’ can never be inlined because it uses variable argument lists [-Winline] warning: inlining failed in call to ‘perr’: function not inlinable [-Winline]
* Samples: Fix initialization discards qualifiers warnings in xusb.cLudovic Rousseau2012-04-151-2/+2
| | | | | | | | | | | | xusb.c: In function ‘read_ms_winsub_feature_descriptors’: xusb.c:542: warning: initialization discards qualifiers from pointer target type xusb.c:543: warning: initialization discards qualifiers from pointer target type xusb.c: In function ‘test_device’: xusb.c:598: warning: initialization discards qualifiers from pointer target type xusb.c:598: warning: initialization discards qualifiers from pointer target type xusb.c:598: warning: initialization discards qualifiers from pointer target type xusb.c:599: warning: initialization discards qualifiers from pointer target type xusb.c:599: warning: initialization discards qualifiers from pointer target type
* Samples: Fix no previous prototype warnings in xusb.cLudovic Rousseau2012-04-151-10/+10
| | | | | | | | | | | | | xusb.c:139: warning: no previous prototype for ‘display_buffer_hex’ xusb.c:169: warning: no previous prototype for ‘display_ps3_status’ xusb.c:260: warning: no previous prototype for ‘display_xbox_status’ xusb.c:281: warning: no previous prototype for ‘set_xbox_actuators’ xusb.c:299: warning: no previous prototype for ‘send_mass_storage_command’ xusb.c:354: warning: no previous prototype for ‘get_mass_storage_status’ xusb.c:401: warning: no previous prototype for ‘get_sense’ xusb.c:431: warning: no previous prototype for ‘test_mass_storage’ xusb.c:530: warning: no previous prototype for ‘read_ms_winsub_feature_descriptors’ xusb.c:583: warning: no previous prototype for ‘test_device’
* Core: Add get_version() callPete Batard2012-04-101-5/+1
| | | | * Also some formatting/typo improvements
* examples: Use snprintf() instead of sprintf() in dpfp and dpfp_threadedPeter Stuge2012-04-092-2/+2
| | | | | | | The OpenBSD C compiler generates a warning for every use of sprintf() and for a good reason. Reported in http://marc.info/?m=133376187514495 Reported-by: Xiaofan Chen <xiaofanc@gmail.com>
* Misc: Rebrand to libusbxPete Batard2012-04-034-11/+10
| | | | | * Mentions of 'libusb' in doxygen are changed to 'libusbx' * Also update copyright notices and remove unneeded EOF LFs
* Samples: Fix "warning: no newline at end of file" in xusb.cPete Batard2012-04-011-4/+4
| | | | * Also remove trailing whitespaces
* Samples: fix a "value is always 0" Clang warning in xusb.cPete Batard2012-03-281-7/+8
| | | | | * Remove the use of os_fd[i].recipient and alter comments with regards to Windows Extended Props test limitations with WinUSB
* Examples: add xusb samplePete Batard2012-03-282-2/+882
| | | | | * Also improvements to WDK build scripts: cd to original dir on error, use 2 cores if available
* Rename the lsusb example program to listdevsPeter Stuge2012-02-082-3/+3
| | | | | This is intended to reduce confusion with the much more significant lsusb utility which is part of the usbutils package.
* examples: Link only with ../libusb/libusb-1.0.la and not with -lusb-1.0Xiaofan Chen2012-01-131-3/+3
| | | | | | | | | | Previous _LDFLAGS included both the freshly built libusb in ../libusb and -lusb-1.0, where libtool would usually resolve the latter to an already-installed libusb library in the system. The extra reference to a second libusb library resulted in failure to build examples on Mac OS X in some cases, and is plain wrong. See also the thread at http://marc.info/?m=132637593623667
* Linux: Fix warnings seen when compiling with gcc-4.6Hans de Goede2011-07-242-4/+2
| | | | | | | | | | | | | | | | | | | Compiling with gcc-4.6 results in the following warnings: os/linux_usbfs.c: In function 'op_get_configuration': os/linux_usbfs.c:1144:6: warning: variable 'r' set but not used ... os/linux_usbfs.c: In function 'op_handle_events': os/linux_usbfs.c:2091:40: warning: 'status' may be used uninitialized ... os/linux_usbfs.c:2044:6: note: 'status' was declared here dpfp.c: In function 'save_to_file': dpfp.c:228:9: warning: variable 'ignore' set but not used ... dpfp_threaded.c: In function 'save_to_file': dpfp_threaded.c:257:9: warning: variable 'ignore' set but not used ... This patch fixes these. (The second comes from handle_control_completion() which gcc seems to inline into op_handle_events().) Signed-off-by: Hans de Goede <hdegoede@redhat.com> [stuge: Add fixes for dpfp examples and update source references]
* dpfp_threaded: return instead of pthread_exit() to avoid Cygwin warningPete Batard2011-06-131-1/+1
|
* examples: #include <libusb.h> without directory nameLudovic Rousseau2010-11-224-4/+4
| | | | | The libusb-1.0 directory name belongs in the compile command, e.g. via pkg-config --cflags. Fixes #58.
* examples: Silence warnings about return value of fwrite()Peter Stuge2010-10-162-2/+4
|
* Introduced calling convention (for Windows)Pete Batard2010-08-232-6/+6
| | | | | | | | | | | | | | | | | | Under Windows, a variety of compilers and configurations are available, meaning that the manner of parameter passing (e.g. registers vs stack) can vary. Match the Windows API calling convention and document this appropriately. This calling convention will be used regardless of the configuration of the user's development platform. The only user-level complication is that all functions used as libusb callbacks must use the same calling convention as libusb. The LIBUSB_CALL macro is provided to make this easy. Signed-off-by: Michael Plante <michael.plante@gmail.com> Signed-off-by: Pete Batard <pbatard@gmail.com> [dsd: slight change of strategy, add documentation]
* removed trailing whitespacesPete Batard2010-08-061-3/+3
|
* Only compile dpfp examples when sigaction is availableDaniel Drake2010-07-221-1/+6
| | | | It's not available on MinGW.
* Whitespace cleanupPete Batard2010-05-121-7/+7
|
* Add internal abstraction for POSIX ThreadsPeter Stuge2010-05-121-2/+5
| | | | | | | | | | | | | | | | This prepares for a Windows backend without dependency on pthreads-w32. pthread_* is renamed to usbi_* and PTHREAD_* to USBI_*. A usbi_mutex_static_t and usbi_mutex_static_lock() and _unlock() are introduced for statically initialized mutexes, since they may be implemented using other types when pthreads mutexes aren't used. Move -pthread from libusb/Makefile.am to host-specific THREAD_CFLAGS in configure.ac. This will enable optional use of -lpthread for cygwin. [dsd: minor tweaks, and roll in a change based on patches from Pete Batard to only build dpfp_threaded example when we're using pthreads]
* lsusb example: make print_devs() staticLudovic Rousseau2009-11-211-1/+1
| | | | lsusb.c:26: warning: no previous prototype for ‘print_devs’
* Introduce contexts to the APIDaniel Drake2008-06-263-15/+15
| | | | | Suggested by David Zeuthen. This allows multiple libraries in the same process to independently use libusb without interfering.
* Handle hot-unpluggingDaniel Drake2008-05-111-8/+14
| | | | | This involved moving from select() to poll() because there is no way to distinguish usbfs's POLLERR condition with select().
* Rework configuration handlingDaniel Drake2008-05-091-3/+8
| | | | | | libusb no longer caches descriptors in libusb_device but backends are intended to be able to provide copies from memory. In the common linux case we can use sysfs.
* libusb_get_device_list() can return negative error codeDaniel Drake2008-05-091-1/+2
|
* Fix libusb_get_device_list return valueDaniel Drake2008-05-041-3/+4
| | | | It was documented to return the list length, but was returning 0.
* Expose bus number and device addressDaniel Drake2008-05-021-1/+3
|
* Remove libusb_cancel_transfer_syncDaniel Drake2008-04-292-42/+32
| | | | | This wasn't a particularly nice API. Cancellation should be handled by the completion handler.