Code example for UsbDevice

Methods: getDeviceName

0
     */ 
    public void openDevice(final UsbDevice device) {
	final UsbManager manager = (UsbManager) getSystemService(Context.USB_SERVICE);
 
	if (device != null && !manager.hasPermission(device)) {
	    logger.debug("Requesting permission for device {}", device.getDeviceName());
	    manager.requestPermission(device, permissionIntent);
	    return; 
	} 
 
	if (device == null || !manager.hasPermission(device)) {
	    return; 
	} 
 
	final UsbDeviceConnection connection = manager.openDevice(device);
	if (connection != null) {
	    logger.debug("Adding file descriptor {} for {}", connection.getFileDescriptor(), device.getDeviceName());
	    fileDescriptors.put(device.getDeviceName(), connection.getFileDescriptor());
	} 
    } 
 
    /** 
     * Gets a usb device via intent or the first one returned from the usb service and opens it. 
Stop searching for code, let great code find you!  Add Codota to your java IDE