Code example for UsbDevice

Methods: getDeviceNamegetInterfacegetProductIdgetVendorId

	 * initialize the PL2303 converter 
	 * @return true on success 
	public boolean initalize() { 
		Log.d(TAG, "Device Name: "+mDevice.getDeviceName());
		Log.d(TAG, "VendorID: "+mDevice.getVendorId());
		Log.d(TAG, "ProductID: "+mDevice.getProductId());
		intf = mDevice.getInterface(0);
		if (intf == null) {
			Log.e(TAG, "Getting interface failed!");
			return false; 
		// endpoint addr 0x81 = input interrupt 
		ep0 = intf.getEndpoint(0); 
		if ((ep0.getType() != UsbConstants.USB_ENDPOINT_XFER_INT) || (ep0.getDirection() != UsbConstants.USB_DIR_IN)) {
			Log.e(TAG, "Getting endpoint 0 (control) failed!");
			return false; 
Stop searching for code, let great code find you!  Add Codota to your java IDE