shangdawei / android-ftdi-usb2serial-driver-package

Automatically exported from code.google.com/p/android-ftdi-usb2serial-driver-package
0 stars 0 forks source link

Permission to mUsbDevice failed #6

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I was receiving a null pointer error as getDeviceDescriptor() was called before 
mUsbDevice was set. I have now addressed that, however 
if(!mManager.hasPermission(mUsbDevice)) in getDeviceDescriptor() is returning 
false. 

Does the code provide for permission to be granted? I am a newbie and have seen 
some code to do this on the android site but am unsure how to implement it.  
Many thanks. 

Original issue reported on code.google.com by anish.bh...@gmail.com on 3 Jul 2012 at 10:18

GoogleCodeExporter commented 9 years ago
modify Android Manifest:

add feature:
<uses-feature android:name="android.hardware.usb.host" />

change activity declaration:

        <activity
            android:name=".SandboxAppActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

            <intent-filter>
                <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />                
            </intent-filter>

            <meta-data
                android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
                android:resource="@xml/device_filter" />
        </activity>

Original comment by krzyszto...@gmail.com on 30 Aug 2012 at 8:43