summaryrefslogtreecommitdiff
path: root/examples
AgeCommit message (Collapse)AuthorFilesLines
2012-05-28Core: Define log levels in libusb.hPete Batard1-2/+1
* Also update xusb sample to use these levels
2012-05-28All: Add parent and port topology callsPete Batard1-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
2012-05-23Misc: Ensure all sources are UTF-8Pete Batard4-7/+4
* Also remove extra lines at the end of samples
2012-05-10Samples: Use the implicit _SOURCES ruleLudovic Rousseau1-6/+0
* By default automake looks for a source file foo.c for a foo binary.
2012-05-10Samples: Use a common LDADD for all examplesLudovic Rousseau1-4/+2
* Similar to libusb patch a129732fb45fc424743f26f01c906e4514f11521
2012-05-10Samples: prefer __linux__ over __linux define in xusbPete Batard1-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
2012-05-08Samples: fix strcat vs strlcat warning on OpenBSDPete Batard1-2/+1
* Without this, OpenBSD produces the following warning: strcat() is almost always misused, please use strlcat()
2012-05-02Samples: Remove interface requests when querying WCID devicesPete Batard1-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.
2012-04-20Samples: Fix not handled in switch warning in xusb.cLudovic Rousseau1-1/+1
xusb.c: In function ‘test_device’: xusb.c:722:2: warning: enumeration value ‘USE_GENERIC’ not handled in switch [-Wswitch-enum]
2012-04-20Samples: Remove unneeded inline in xusb.cLudovic Rousseau1-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]
2012-04-15Samples: Fix initialization discards qualifiers warnings in xusb.cLudovic Rousseau1-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
2012-04-15Samples: Fix no previous prototype warnings in xusb.cLudovic Rousseau1-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’
2012-04-10Core: Add get_version() callPete Batard1-5/+1
* Also some formatting/typo improvements
2012-04-09examples: Use snprintf() instead of sprintf() in dpfp and dpfp_threadedPeter Stuge2-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>
2012-04-03Misc: Rebrand to libusbxPete Batard4-11/+10
* Mentions of 'libusb' in doxygen are changed to 'libusbx' * Also update copyright notices and remove unneeded EOF LFs
2012-04-01Samples: Fix "warning: no newline at end of file" in xusb.cPete Batard1-4/+4
* Also remove trailing whitespaces
2012-03-28Samples: fix a "value is always 0" Clang warning in xusb.cPete Batard1-7/+8
* Remove the use of os_fd[i].recipient and alter comments with regards to Windows Extended Props test limitations with WinUSB
2012-03-28Examples: add xusb samplePete Batard2-2/+882
* Also improvements to WDK build scripts: cd to original dir on error, use 2 cores if available
2012-02-08Rename the lsusb example program to listdevsPeter Stuge2-3/+3
This is intended to reduce confusion with the much more significant lsusb utility which is part of the usbutils package.
2012-01-13examples: Link only with ../libusb/libusb-1.0.la and not with -lusb-1.0Xiaofan Chen1-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
2011-07-24Linux: Fix warnings seen when compiling with gcc-4.6Hans de Goede2-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]
2011-06-13dpfp_threaded: return instead of pthread_exit() to avoid Cygwin warningPete Batard1-1/+1
2010-11-22examples: #include <libusb.h> without directory nameLudovic Rousseau4-4/+4
The libusb-1.0 directory name belongs in the compile command, e.g. via pkg-config --cflags. Fixes #58.
2010-10-16examples: Silence warnings about return value of fwrite()Peter Stuge2-2/+4
2010-08-23Introduced calling convention (for Windows)Pete Batard2-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]
2010-08-06removed trailing whitespacesPete Batard1-3/+3
2010-07-22Only compile dpfp examples when sigaction is availableDaniel Drake1-1/+6
It's not available on MinGW.
2010-05-12Whitespace cleanupPete Batard1-7/+7
2010-05-12Add internal abstraction for POSIX ThreadsPeter Stuge1-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]
2009-11-21lsusb example: make print_devs() staticLudovic Rousseau1-1/+1
lsusb.c:26: warning: no previous prototype for ‘print_devs’
2008-06-26Introduce contexts to the APIDaniel Drake3-15/+15
Suggested by David Zeuthen. This allows multiple libraries in the same process to independently use libusb without interfering.
2008-05-11Handle hot-unpluggingDaniel Drake1-8/+14
This involved moving from select() to poll() because there is no way to distinguish usbfs's POLLERR condition with select().
2008-05-09Rework configuration handlingDaniel Drake1-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.
2008-05-09libusb_get_device_list() can return negative error codeDaniel Drake1-1/+2
2008-05-04Fix libusb_get_device_list return valueDaniel Drake1-3/+4
It was documented to return the list length, but was returning 0.
2008-05-02Expose bus number and device addressDaniel Drake1-1/+3
2008-04-29Remove libusb_cancel_transfer_syncDaniel Drake2-42/+32
This wasn't a particularly nice API. Cancellation should be handled by the completion handler.
2008-04-19add threaded example programDaniel Drake2-1/+557
2008-04-01Constify some return dataDaniel Drake1-1/+1
Make it clear that apps should not mess with these structures
2008-03-30Rename libusb_poll() to libusb_handle_events()Daniel Drake1-1/+1
2008-03-30Isochronous endpoint I/ODaniel Drake1-3/+3
Due to variable-sized structures, this involved changing allocation mechanism. All transfers must now be allocated and freed through libusb. A synchronous function is missing, and I could do with writing a few more helper functions to simplify things.
2008-03-20API documentationDaniel Drake1-2/+2
Hopefully mostly complete. Some constants were renamed and move into enums.
2008-03-13Beginnings of cross-platform abstractionDaniel Drake1-1/+1
This also includes a libusb_get_pollfds API change
2008-03-10Add transfer flagsDaniel Drake1-2/+2
2008-03-10Simplify libusb_fill_control_transfer()Daniel Drake1-4/+3
Transfer length can be inferred from the setup packet.
2008-03-10get_device fixupDaniel Drake1-1/+2
Rename API away from "devh" and fix implementation to match header
2008-03-09Rename descriptor-getting functionsDaniel Drake1-1/+2
Based on feedback from Tim Roberts
2008-03-09Simplify cancellation APIDaniel Drake1-3/+3
No need to provide the device here.
2008-03-09Rename libusb_dev_handle to libusb_device_handleDaniel Drake1-1/+1
2008-03-09Separate transfer allocation and submissionDaniel Drake1-111/+75
Leads to some hefty API changes. Now we're much more similar to the Linux kernel model. Problems with dealing with asynchronous control transfers are passed on to the user, basically you must allocate a buffer, start with the setup, and put the data after. This won't make much sense until documented (soon...)