diff options
author | Richard Hughes <richard@hughsie.com> | 2011-08-29 16:31:16 +0100 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2011-08-29 16:31:16 +0100 |
commit | 1a347848a12824e217a37f5f5361426634655f9c (patch) | |
tree | 17c62f2090553ad40e2f6c6bb392ed8db52605df /gusb/gusb-self-test.c | |
parent | 97336907f3974abe2c629d927266bb33785176dc (diff) | |
download | gusb-1a347848a12824e217a37f5f5361426634655f9c.tar.gz |
Allow the test program to complete when test hardware is not connected
Diffstat (limited to 'gusb/gusb-self-test.c')
-rw-r--r-- | gusb/gusb-self-test.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/gusb/gusb-self-test.c b/gusb/gusb-self-test.c index 7a32112..926c51d 100644 --- a/gusb/gusb-self-test.c +++ b/gusb/gusb-self-test.c @@ -204,6 +204,13 @@ gusb_device_huey_func (void) 0x0971, 0x2005, &error); + if (device == NULL && + error->domain == G_USB_DEVICE_ERROR && + error->code == G_USB_DEVICE_ERROR_NO_DEVICE) { + g_print ("No device detected!\n"); + g_error_free (error); + goto out; + } g_assert_no_error (error); g_assert (device != NULL); @@ -271,7 +278,7 @@ gusb_device_huey_func (void) g_assert (ret); g_object_unref (device); - +out: g_object_unref (list); g_object_unref (ctx); } @@ -350,12 +357,19 @@ gusb_device_munki_func (void) list = g_usb_device_list_new (ctx); g_assert (list != NULL); - /* coldplug, and get the huey */ + /* coldplug, and get the ColorMunki */ g_usb_device_list_coldplug (list); device = g_usb_device_list_find_by_vid_pid (list, 0x0971, 0x2007, &error); + if (device == NULL && + error->domain == G_USB_DEVICE_ERROR && + error->code == G_USB_DEVICE_ERROR_NO_DEVICE) { + g_print ("No device detected!\n"); + g_error_free (error); + goto out; + } g_assert_no_error (error); g_assert (device != NULL); @@ -439,7 +453,7 @@ gusb_device_munki_func (void) g_assert (ret); g_object_unref (device); - +out: g_object_unref (list); g_object_unref (ctx); } |