diff --git a/src/main.c b/src/main.c index c3a85a2..446806f 100644 --- a/src/main.c +++ b/src/main.c @@ -1,5 +1,6 @@ #include "libusb_wrapper.h" #include +#include int main(int argc, char *argv[]){ printf("Hello World :-|\n"); @@ -15,8 +16,25 @@ int main(int argc, char *argv[]){ } else if(strcmp(argv[1], "demo4.2") == 0){//if 4.2 printf("\e[91mDemo 4.2\e[39m\n"); - //displayDeviceEndpoints(Ourdevice); - //else + + if(argc > 3){ + uint16_t vendor_id; + uint16_t product_id; + sscanf(argv[2], "%hu", &vendor_id); + sscanf(argv[3], "%hu", &product_id); + + libusb_device_handle* handle; + handle = libusb_open_device_with_vid_pid(context, vendor_id, product_id); + if(handle != NULL){ + printf("Show endpoints of VID:%hu;PID:%hu\n", vendor_id, product_id); + displayDeviceEndpoints(NULL); + } + else{ + printf("Error while getting handle of VID:%hu;PID:%hu\n", vendor_id, product_id); + } + }else{ + printf("Error, need VID and PID\n"); + } }else{ printf("Wrong command\n"); } -- libgit2 0.21.2