/*
* open octopus with a libusb dev
handle
*/
int octopus_open_dev(struct octopus_context *octopus, struct usb_device *dev)
{
if (octopus == NULL)
octopus_error_return(-1,"octopus
handle is wrong or missing");
if (dev == NULL)
octopus_error_return(-2,"device
handle is wrong or missing");
if (!(octopus->usb_handle = usb_open(dev)))
octopus_error_return(-3,"can't open usb device");
if (usb_set_configuration (octopus->usb_handle,dev->config[0].bConfigurationValue) < 0)
octopus_error_return(-4,"Ich can't set configuration for given usb device");
if (usb_claim_interface(octopus->usb_handle, 0) < 0)
octopus_error_return(-5,"can't claim interface for given usb device");
if (usb_set_altinterface(octopus->usb_handle,0) < 0)
octopus_error_return(-6,"can't set altinterface for given usb device");
return 1;
}