Code example for UsbManager

Methods: requestPermission

0
    public void unregisterReceiver(Context ctx) {
        ctx.unregisterReceiver(m_usbReceiver);
    } 
 
    public void handleRawDevice(UsbDevice dev) {
        m_usbManager.requestPermission(dev, m_permissionIntent);
    } 
 
    public static int matchRawDeviceToType(UsbDevice dev) {
 
        // Shupito v2.0 
        if(dev.getVendorId() == 0x4a61 && dev.getProductId() == 0x679a)
            return SerialDevice.TYPE_CDC_ACM; 
 
        return SerialDevice.TYPE_UNK; 
    } 
 
    private void processRawDevice(UsbDevice usbdev) {
        SerialDevice dev = SerialDevice.create(usbdev, this);
        if(dev == null)
            return;