summaryrefslogtreecommitdiff
path: root/utils/hwstub/tools/hwstub_shell.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'utils/hwstub/tools/hwstub_shell.cpp')
-rw-r--r--utils/hwstub/tools/hwstub_shell.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/utils/hwstub/tools/hwstub_shell.cpp b/utils/hwstub/tools/hwstub_shell.cpp
index d0fcdfabc2..a10a1dad4e 100644
--- a/utils/hwstub/tools/hwstub_shell.cpp
+++ b/utils/hwstub/tools/hwstub_shell.cpp
@@ -754,15 +754,22 @@ int main(int argc, char **argv)
754 754
755 // look for device 755 // look for device
756 if(!g_quiet) 756 if(!g_quiet)
757 printf("Looking for device %#04x:%#04x...\n", HWSTUB_USB_VID, HWSTUB_USB_PID); 757 printf("Looking for hwstub device ...\n");
758 758 // open first device
759 libusb_device_handle *handle = libusb_open_device_with_vid_pid(ctx, 759 libusb_device **list;
760 HWSTUB_USB_VID, HWSTUB_USB_PID); 760 ssize_t cnt = hwstub_get_device_list(ctx, &list);
761 if(handle == NULL) 761 if(cnt <= 0)
762 { 762 {
763 printf("No device found\n"); 763 printf("No device found\n");
764 return 1; 764 return 1;
765 } 765 }
766 libusb_device_handle *handle;
767 if(libusb_open(list[0], &handle) != 0)
768 {
769 printf("Cannot open device\n");
770 return 1;
771 }
772 libusb_free_device_list(list, 1);
766 773
767 // admin stuff 774 // admin stuff
768 libusb_device *mydev = libusb_get_device(handle); 775 libusb_device *mydev = libusb_get_device(handle);