summaryrefslogtreecommitdiff
path: root/examples/xusb.c
diff options
context:
space:
mode:
authorChris Dickens <christopher.a.dickens@gmail.com>2017-12-26 16:37:34 -0800
committerChris Dickens <christopher.a.dickens@gmail.com>2017-12-26 16:37:34 -0800
commit0fece895911febddffac66cb246edd82dcce0bfe (patch)
tree3658e33db64d54dffe229361ef49a9bf47c21d97 /examples/xusb.c
parentd8c1f7caa9f00496097037adc266bcdfbe866bda (diff)
downloadlibusb-0fece895911febddffac66cb246edd82dcce0bfe.tar.gz
Examples: Misc. cleanup to xusb
Make data that is unchanged const, remove an unused return value, and add a missing newline to an error message. Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
Diffstat (limited to 'examples/xusb.c')
-rw-r--r--examples/xusb.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/examples/xusb.c b/examples/xusb.c
index 1489bfc..209007b 100644
--- a/examples/xusb.c
+++ b/examples/xusb.c
@@ -58,16 +58,13 @@ static bool extra_info = false;
static bool force_device_request = false; // For WCID descriptor queries
static const char* binary_name = NULL;
-static int perr(char const *format, ...)
+static void perr(char const *format, ...)
{
va_list args;
- int r;
va_start (args, format);
- r = vfprintf(stderr, format, args);
+ vfprintf(stderr, format, args);
va_end(args);
-
- return r;
}
#define ERR_EXIT(errcode) do { perr(" %s\n", libusb_strerror((enum libusb_error)errcode)); return -1; } while (0)
@@ -125,7 +122,7 @@ struct command_status_wrapper {
uint8_t bCSWStatus;
};
-static uint8_t cdb_length[256] = {
+static const uint8_t cdb_length[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
06,06,06,06,06,06,06,06,06,06,06,06,06,06,06,06, // 0
06,06,06,06,06,06,06,06,06,06,06,06,06,06,06,06, // 1
@@ -812,8 +809,8 @@ static int test_device(uint16_t vid, uint16_t pid)
int i, j, k, r;
int iface, nb_ifaces, first_iface = -1;
struct libusb_device_descriptor dev_desc;
- const char* speed_name[5] = { "Unknown", "1.5 Mbit/s (USB LowSpeed)", "12 Mbit/s (USB FullSpeed)",
- "480 Mbit/s (USB HighSpeed)", "5000 Mbit/s (USB SuperSpeed)"};
+ const char* const speed_name[5] = { "Unknown", "1.5 Mbit/s (USB LowSpeed)", "12 Mbit/s (USB FullSpeed)",
+ "480 Mbit/s (USB HighSpeed)", "5000 Mbit/s (USB SuperSpeed)" };
char string[128];
uint8_t string_index[3]; // indexes of the string descriptors
uint8_t endpoint_in = 0, endpoint_out = 0; // default IN and OUT endpoints
@@ -1106,7 +1103,7 @@ int main(int argc, char** argv)
old_dbg_str = getenv("LIBUSB_DEBUG");
if (debug_mode) {
if (putenv("LIBUSB_DEBUG=4") != 0) // LIBUSB_LOG_LEVEL_DEBUG
- printf("Unable to set debug level");
+ printf("Unable to set debug level\n");
}
version = libusb_get_version();