examples/hotplugtest: Match any device by default

I spent some time trying to figure out why, when I run this example,
it's not showing any events, until I looked into the code and saw it has
some hardcoded VID:PID.

Most people probably don't have the specific device hardcoded here, and
it seems better to default to showing events for any device unless
overridden.

While at it, also updated device detached message to match the attached
one to show VID:PID.

Closes #1350

[Tormod: Print error strings on failures]
Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
diff --git a/examples/hotplugtest.c b/examples/hotplugtest.c
index 98b01ee..270fe5a 100644
--- a/examples/hotplugtest.c
+++ b/examples/hotplugtest.c
@@ -37,12 +37,14 @@
 	(void)user_data;
 
 	rc = libusb_get_device_descriptor(dev, &desc);
-	if (LIBUSB_SUCCESS != rc) {
-		fprintf (stderr, "Error getting device descriptor\n");
+	if (LIBUSB_SUCCESS == rc) {
+		printf ("Device attached: %04x:%04x\n", desc.idVendor, desc.idProduct);
+	} else {
+		printf ("Device attached\n");
+		fprintf (stderr, "Error getting device descriptor: %s\n",
+			 libusb_strerror((enum libusb_error)rc));
 	}
 
-	printf ("Device attached: %04x:%04x\n", desc.idVendor, desc.idProduct);
-
 	if (handle) {
 		libusb_close (handle);
 		handle = NULL;
@@ -50,7 +52,8 @@
 
 	rc = libusb_open (dev, &handle);
 	if (LIBUSB_SUCCESS != rc) {
-		fprintf (stderr, "Error opening device\n");
+		fprintf (stderr, "Error opening device: %s\n",
+			 libusb_strerror((enum libusb_error)rc));
 	}
 
 	done++;
@@ -60,12 +63,22 @@
 
 static int LIBUSB_CALL hotplug_callback_detach(libusb_context *ctx, libusb_device *dev, libusb_hotplug_event event, void *user_data)
 {
+	struct libusb_device_descriptor desc;
+	int rc;
+
 	(void)ctx;
 	(void)dev;
 	(void)event;
 	(void)user_data;
 
-	printf ("Device detached\n");
+	rc = libusb_get_device_descriptor(dev, &desc);
+	if (LIBUSB_SUCCESS == rc) {
+		printf ("Device detached: %04x:%04x\n", desc.idVendor, desc.idProduct);
+	} else {
+		printf ("Device detached\n");
+		fprintf (stderr, "Error getting device descriptor: %s\n",
+			 libusb_strerror((enum libusb_error)rc));
+	}
 
 	if (handle) {
 		libusb_close (handle);
@@ -83,14 +96,15 @@
 	int product_id, vendor_id, class_id;
 	int rc;
 
-	vendor_id  = (argc > 1) ? (int)strtol (argv[1], NULL, 0) : 0x045a;
-	product_id = (argc > 2) ? (int)strtol (argv[2], NULL, 0) : 0x5005;
+	vendor_id  = (argc > 1) ? (int)strtol (argv[1], NULL, 0) : LIBUSB_HOTPLUG_MATCH_ANY;
+	product_id = (argc > 2) ? (int)strtol (argv[2], NULL, 0) : LIBUSB_HOTPLUG_MATCH_ANY;
 	class_id   = (argc > 3) ? (int)strtol (argv[3], NULL, 0) : LIBUSB_HOTPLUG_MATCH_ANY;
 
 	rc = libusb_init_context(/*ctx=*/NULL, /*options=*/NULL, /*num_options=*/0);
-	if (rc < 0)
+	if (LIBUSB_SUCCESS != rc)
 	{
-		printf("failed to initialise libusb: %s\n", libusb_error_name(rc));
+		printf ("failed to initialise libusb: %s\n",
+			libusb_strerror((enum libusb_error)rc));
 		return EXIT_FAILURE;
 	}
 
@@ -118,8 +132,9 @@
 
 	while (done < 2) {
 		rc = libusb_handle_events (NULL);
-		if (rc < 0)
-			printf("libusb_handle_events() failed: %s\n", libusb_error_name(rc));
+		if (LIBUSB_SUCCESS != rc)
+			printf ("libusb_handle_events() failed: %s\n",
+				libusb_strerror((enum libusb_error)rc));
 	}
 
 	if (handle) {
diff --git a/libusb/version_nano.h b/libusb/version_nano.h
index 155d1e0..0c09b8c 100644
--- a/libusb/version_nano.h
+++ b/libusb/version_nano.h
@@ -1 +1 @@
-#define LIBUSB_NANO 11813
+#define LIBUSB_NANO 11814