Commit graph

8 commits

Author SHA1 Message Date
Chris Dickens
f90d07613c Windows: Remove support for WinCE and Visual Studio older than 2013
There appears to be no need for the WinCE backend anymore, and it is
increasingly difficult to keep healthy as the rest of the library
changes.

Require at least Visual Studio 2013 to compile. This simplifies matters
as there is some semblance of C99 support there.

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
2020-01-20 18:02:19 -08:00
Chris Dickens
cb95e3ad35 examples: testlibusb: Always print VID and PID in addition to strings
Previously the program would only print the VID when the manufacturer
string is unavailable and the PID when the product string is
unavailable. Change this to print the VID and PID unconditionally and
print the manufacturer and product strings similar to how the serial
number string is being printed. In addition, line up the string values
with the rest of the output.

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
2020-01-13 12:50:40 -08:00
Chris Dickens
88ded79caa examples: testlibusb: Formatting, whitespace and functional cleanup
Make the coding style and whitespace consistent with the rest of the
library source code.

In the print_device() function, the 'level' argument is unnecessary, so
remove it and the associated space padding. Switch to use printf()
directly instead of formatting the description into a single buffer.
This not only simplifies the code but avoids truncating the description
for devices with larger descriptor strings.

Make the output formatting consistent by lining up all the printed
values and using the same notation for all hexadecimal values.

Inspired by PR #452, enable printing all available BOS device
capability descriptors, not just the first one.

Closes #452

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
2020-01-13 12:36:59 -08:00
Victor Toso
fcf9a53595 examples: Fix format-truncation on debug
As description is used only for debug, we can extend it to be sure to
fit 256 from string variable plus 3 chars from " - " as described in
gcc warning below

 | testlibusb.c: In function ‘print_device.constprop’:
 | testlibusb.c:188:51: warning: ‘ - ’ directive output may be truncated writing 3 bytes into a region of size between 1 and 256 [-Wformat-truncation=]
 |      snprintf(description, sizeof(description), "%s - ", string);
 |                                                    ^~~
 | testlibusb.c:188:5: note: ‘snprintf’ output between 4 and 259 bytes into a destination of size 256
 |      snprintf(description, sizeof(description), "%s - ", string);
 |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Closes #460

Signed-off-by: Victor Toso <victortoso@redhat.com>

Signed-off-by: Nathan Hjelm <hjelmn@lanl.gov>
2018-12-05 10:13:08 -07:00
Chris Dickens
f69255217c examples: testlibusb: Fix DDK build warning
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
2018-03-24 17:42:46 -07:00
Chris Dickens
539a3230cf Misc: Fix testlibusb build on VS2013 and earlier and suppress warnings
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
2017-12-26 23:58:00 -08:00
Ludovic Rousseau
a1cf206218 examples: reformat testlibusb.c
convert from DOS to Unix text format
remove extra spaces at end of line
2017-07-12 17:10:55 +02:00
Anil Nair
bcac08d60f Examples: Ported testlibusb from libus-0.1 to libusb-1.0
This commit is based on Nathan's branch
https://github.com/hjelmn/libusb-darwin/blob/master/examples/testlibusb1.c

Closes #178

Signed-off-by: Nathan Hjelm <hjelmn@me.com>
2016-07-21 22:08:44 -06:00