Code example for UsbManager

Methods: getDeviceList, openDevice

0
                getIntent().getStringExtra("usb_device_name"); 
            Log.i(TAG, "Clicked " + deviceName); 
 
            mDeviceNameView.setText(deviceName); 
 
            Map<String, UsbDevice> devices = mUsbManager.getDeviceList(); 
            UsbDevice device = devices.get(deviceName); 
            mInterfaceCountView.setText( 
                    Integer.toString(device.getInterfaceCount())); 
            UsbInterface iface = device.getInterface(0); 
            mEndpointCountView.setText( 
                    Integer.toString(iface.getEndpointCount())); 
            mEndpoint = iface.getEndpoint(1); 
            mConnection = mUsbManager.openDevice(device); 
            mConnection.claimInterface(iface, true); 
 
            new Thread(new Runnable() { 
                public void run() { 
                    transferData(); 
                } 
            }).start();