I'm trying to open a connection to a camera from a raspberry pi 2 over usb. I'm able to detect the camera but when I try to open a connection using
libusb_open_device_with_vid_pid(null, vendor id, product id);
But I receive a segmentation fault. I've narrowed it down and that line of code is what causes the 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 from the pi opened over putty on my computer is.
Segmentation fault
Any ideas as to what I am doing wrong?