Code example for UsbManager

Methods: openAccessory

0
		unregisterReceiver(mUsbReceiver);
		super.onDestroy(); 
	} 
 
	private void openAccessory(UsbAccessory accessory) {
		mFileDescriptor = mUsbManager.openAccessory(accessory);
		if (mFileDescriptor != null) {
			mAccessory = accessory;
			FileDescriptor fd = mFileDescriptor.getFileDescriptor();
			mInputStream = new FileInputStream(fd);
			mOutputStream = new FileOutputStream(fd);
			Thread thread = new Thread(null, this, "DemoKit");
			thread.start();
			Log.d(TAG, "accessory opened");
			enableControls(true); 
		} else { 
			Log.d(TAG, "accessory open fail");
		} 
	} 
 
	private void closeAccessory() {