Beispiel #1
0
usb_dev_handle* setup_libusb_access() 
{
	usb_dev_handle *lvr_winusb;

	usb_set_debug(255);
	usb_init();
	usb_find_busses();
	usb_find_devices();

	if(!(lvr_winusb = find_lvr_winusb())) 
	{
		printf("Couldn't find the USB device, Exiting\n");
		return NULL;
	}

	if (usb_set_configuration(lvr_winusb, 1) < 0) 
	{
		printf("Could not set configuration 1 : \n");
		return NULL;
	}

	if (usb_claim_interface(lvr_winusb, INTERFACE) < 0) 
	{
		printf("Could not claim interface: \n");
		return NULL;
	}

	return lvr_winusb;
}
Beispiel #2
0
/**
 * Initialize all Temper Devices currently attached to the system
 * @return pcsensor_devices*
 */
pcsensor_devices* setup_libusb_access() {
    static pcsensor_devices *available_devices;

    if (debug) {
        usb_set_debug(255);
    } else {
        usb_set_debug(0);
    }

    usb_init();
    usb_find_busses();
    usb_find_devices();

    // Get an array of MAX_SENSORS
    available_devices = find_lvr_winusb();

    if (available_devices->sensor_count == 0) {
        if (debug) {
            printf("Couldn't find the USB device, Exiting\n");
        }
        return NULL;
    }
    int i;

    for (i = 0; i < available_devices->sensor_count; i++) {
        usb_dev_handle *lvr_winusb = available_devices->sensors[i];

        usb_detach(lvr_winusb, INTERFACE1);

        usb_detach(lvr_winusb, INTERFACE2);


        if (usb_set_configuration(lvr_winusb, 0x01) < 0) {
            if (debug) {
                printf("Could not set configuration 1\n");
            }
            return NULL;
        }

        // Microdia tiene 2 interfaces
        if (usb_claim_interface(lvr_winusb, INTERFACE1) < 0) {
            if (debug) {
                printf("Could not claim interface\n");
            }
            return NULL;
        }

        if (usb_claim_interface(lvr_winusb, INTERFACE2) < 0) {
            if (debug) {
                printf("Could not claim interface\n");
            }
            return NULL;
        }
    }
    return available_devices;
}
Beispiel #3
0
static usb_dev_handle* setup_libusb_access() {
	usb_dev_handle *lvr_winusb;

	if(debug) {
		usb_set_debug(255);
	} else {
		usb_set_debug(0);
	}
	usb_init();
	usb_find_busses();
	usb_find_devices();

 
	if(!(lvr_winusb = find_lvr_winusb())) {
		if(debug){
			printf("Couldn't find the USB device, Exiting\n");
		}
		return NULL;
	}
        
        
	usb_detach(lvr_winusb, INTERFACE1);
        

	usb_detach(lvr_winusb, INTERFACE2);
        
 
	if (usb_set_configuration(lvr_winusb, 0x01) < 0) {
		if(debug){
			printf("Could not set configuration 1\n");
		}
		return NULL;
	}
 

	// Microdia tiene 2 interfaces
	if (usb_claim_interface(lvr_winusb, INTERFACE1) < 0) {
		if(debug){
			printf("Could not claim interface\n");
		}
		return NULL;
	}
 
	if (usb_claim_interface(lvr_winusb, INTERFACE2) < 0) {
		if(debug){
			printf("Could not claim interface\n");
		}
		return NULL;
	}
 
	return lvr_winusb;
}
Beispiel #4
0
usb_dev_handle* setup_libusb_access() {
     usb_dev_handle *lvr_winusb;
     usb_set_debug(0);
     usb_init();
     usb_find_busses();
     usb_find_devices();

     if(!(lvr_winusb = find_lvr_winusb())) {
                return NULL;
        }
/* 
Linux*/
usb_detach_kernel_driver_np(lvr_winusb,0);
        if (usb_set_configuration(lvr_winusb, 1) < 0) {
                printf("Could not set configuration 1 : \n");
                return NULL;
        }
 
        if (usb_claim_interface(lvr_winusb, INTFACE) < 0) {
                printf("Could not claim interface: \n");
                return NULL;
        }
        return lvr_winusb;
 }