Code example for UsbInterface

Methods: getEndpoint, getEndpointCount

0
			toast.show();
			return; 
		} 
		UsbInterface intf = device.getInterface(0);
		// device should have two endpoints 
		if (intf.getEndpointCount() != 2) {
			Toast toast = Toast.makeText(context, "could not find endpoint", duration);
			toast.show();
			return; 
		} 
 
		// endpoint should be of type bulk 
		UsbEndpoint ep = intf.getEndpoint(0);
		UsbEndpoint epOut = null;
		UsbEndpoint epIn = null;
		if (ep.getType() == UsbConstants.USB_ENDPOINT_XFER_BULK) {
			if (ep.getDirection() == UsbConstants.USB_DIR_OUT) {
				epOut = ep;
				//Toast toast = Toast.makeText(context, "endpoint 0 is out", duration); 
				//toast.show(); 
			} else { 
				epIn = ep;
				//Toast toast = Toast.makeText(context, "endpoint 0 is in", duration); // actually is in 
				//toast.show(); 
			} 
			mEndpointIn = epIn;
		} else { 
			return; 
		} 
 
		UsbEndpoint ep1 = intf.getEndpoint(1);
		if (ep1.getType() == UsbConstants.USB_ENDPOINT_XFER_BULK) {
			if (ep1.getDirection() == UsbConstants.USB_DIR_OUT) {
				epOut = ep;
				//Toast toast = Toast.makeText(context, "endpoint 1 is out", duration); // actually is out 
				//toast.show();