c++ - segmentation fault on libusb_get_device_with_vid_pid -


i'm trying open connection camera raspberry pi 2 on usb. i'm able detect camera when try open connection using

libusb_open_device_with_vid_pid(null, vendor id, product id); 

but receive segmentation fault. i've narrowed down , line of code causes segmentation fault.

void opendevice(){     libusb_device_handle* dev;     struct libusb_device_descriptor* desc;     int err;  dev = libusb_open_device_with_vid_pid(null,0x2a0b,0x00f8);     if (dev == null){         printf("device not found\n");        }  else {      err = libusb_claim_interface(dev, 0);      }     } 

the message pi opened on putty on computer is.

segmentation fault 

any ideas doing wrong?

you getting null dev, , using anyway. add return statement after printf(), or else before libusb_claim_interface().


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

python - build a suggestions list using fuzzywuzzy -