Code example for UsbManager

Methods: getDeviceList

0
        UsbDevice d = l.get(n);
        return d;
    } 
 
    private HashMap<String, UsbDevice> defDevicesList(UsbManager m) {
        HashMap<String, UsbDevice> d = m.getDeviceList();
        return d;
    } 
 
    // Getters and setters. 
    public boolean getConnection() { 
        return mConnected;
    } 
 
    private void getPermission(UsbManager m, UsbDevice d, Context context) {
        PendingIntent p = PendingIntent.getBroadcast(context, 0, new Intent(
                "com.android.example.USB_PERMISSION"), 0); 
        if (!m.hasPermission(d))
            m.requestPermission(d, p);
    }