[Nexus 9 Q&A, Help & Troubleshooting] lfrst05:
I ran into some issues with OTG with a certain device.

When I try to use my HackRF (Software defined radio peripheral) with the RF Analyzer app the device is reset immediately when the app tries to open the USB connection.

To me it seems that the Tegra USB driver does not like this device. (The app itself uses only the official Android USB API and no native code and does not require root)

I made some tests to ensure that this issue is not the app and not my OTG setup:

- Tested everything with & without a powered USB hub to make sure it is not a power issue

- USB mouse & USB flash drive are working fine on my N9

- I tested the HackRF on my Nexus 5, LG G Pad 7.0 and on the Archos 97b Titanium - it works fine there.

- My N9 is running the latest firmware (R)

I'm posting here about it because maybe one of you has an idea how this could be fixed.

References:

GitHub discussion about this issue:

https://github.com/demantz/hackrf_android/issues/2

(comments 8-11)

RF Analyzer app:

https://github.com/demantz/RFAnalyzer

https://play.google.com/store/apps/details?id=com.mantz_it.rfanalyzer

HackRF:

https://greatscottgadgets.com/hackrf/

https://github.com/mossmann/hackrf/wiki

Logcat:

I/ActivityManager( 1378): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.mantz_it.rfanalyzer/.MainActivity (has extras)} from uid 10022 on display 0
I/ActivityManager( 1378): Start proc com.mantz_it.rfanalyzer for activity com.mantz_it.rfanalyzer/.MainActivity: pid=14943 uid=10096 gids={50096, 9997, 1028, 1015, 3003} abi=arm64-v8a
I/MainActivity(14943): onCreate: started logcat (Process[pid=14962]) to /storage/emulated/0/RFAnalyzer/log.txt
D/OpenGLRenderer(14943): Render dirty regions requested: true
D/Atlas (14943): Validating map...
I/OpenGLRenderer(14943): Initialized EGL, version 1.4
D/OpenGLRenderer(14943): Enabling debug mode 0
I/ActivityManager( 1378): Displayed com.mantz_it.rfanalyzer/.MainActivity: +531ms
D/HackRFSource(14943): setBasebandFilterWidth: Setting BB filter width to 15000000
D/HackRFSource(14943): setSampleRate: setting sample rate to 20000000
D/TaskPersister( 1378): removeObsoleteFile: deleting file=349_task.xml
I/hackrf_android(14943): initHackrf: Found 1 USB devices.
D/hackrf_android(14943): initHackrf: deviceList: vendor=7504 product=24713
I/hackrf_android(14943): initHackrf: Found HackRF One at /dev/bus/usb/003/003
D/TaskPersister( 1378): removeObsoleteFile: deleting file=349_task_thumbnail.png
I/ActivityManager( 1378): START u0 {flg=0x10000000 cmp=com.android.systemui/.usb.UsbPermissionActivity (has extras)} from uid 1000 on display 0
D/hackrf_android(14943): Permission request for device /dev/bus/usb/003/003 was send. waiting...
I/art ( 1378): Background sticky concurrent mark sweep GC freed 15638(826KB) AllocSpace objects, 5(7MB) LOS objects, 14% free, 48MB/55MB, paused 14.834ms total 55.769ms
I/ActivityManager( 1378): Displayed com.android.systemui/.usb.UsbPermissionActivity: +54ms
W/InputMethodManagerService( 1378): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMeth
odClient$Stub$Proxy@2daa5ff8 attribute=null, token = android.os.BinderProxy@c48f5ae
D/OpenGLRenderer( 1553): endAllStagingAnimators on 0x558e65fbf0 (RippleDrawable) with handle 0x558de22900
D/hackrf_android(14943): initHackrf: Permission granted for device /dev/bus/usb/003/003
I/hackrf_android(14943): constructor: create Hackrf instance from /dev/bus/usb/003/003. Vendor ID: 7504 Product ID: 24713
I/hackrf_android(14943): constructor: device protocol: 0
I/hackrf_android(14943): constructor: device class: 0 subclass: 0
I/hackrf_android(14943): constructor: interface count: 2
I/hackrf_android(14943): constructor: [interface 0] interface protocol: 255 subclass: 255
I/hackrf_android(14943): constructor: [interface 0] interface class: 255
I/hackrf_android(14943): constructor: [interface 0] endpoint count: 2
I/hackrf_android(14943): constructor: [endpoint 0 (IN)] address: 129 attributes: 2 direction: 128 max_packet_size: 512
I/hackrf_android(14943): constructor: [endpoint 1 (OUT)] address: 2 attributes: 2 direction: 0 max_packet_size: 512
D/UsbHostManager( 1378): Added device UsbDevice[mName=/dev/bus/usb/003/004,mVendorId=7504,mProductId=24713,mClass=0,mSubclass=0,mProtocol=0,mManufacturerName=Great Scott Gadgets,mProductName=HackRF One,mSerialNumber=null,mConfigurations=[
D/UsbHostManager( 1378): UsbConfiguration[mId=1,mName=Transceiver,mAttributes=128,mMaxPower=250,mInterfaces=[
D/UsbHostManager( 1378): UsbInterface[mId=0,mAlternateSetting=0,mName=null,mClass=255,mSubclass=255,mProtocol=255,mEndpoints=[
D/UsbHostManager( 1378): UsbEndpoint[mAddress=129,mAttributes=2,mMaxPacketSize=512,mInterval=0]
D/UsbHostManager( 1378): UsbEndpoint[mAddress=2,mAttributes=2,mMaxPacketSize=512,mInterval=0]]]
D/UsbHostManager( 1378): UsbConfiguration[mId=2,mName=CPLD update,mAttributes=128,mMaxPower=250,mInterfaces=[
D/UsbHostManager( 1378): UsbInterface[mId=0,mAlternateSetting=0,mName=null,mClass=255,mSubclass=255,mProtocol=255,mEndpoints=[
D/UsbHostManager( 1378): UsbEndpoint[mAddress=129,mAttributes=2,mMaxPacketSize=512,mInterval=0]
D/UsbHostManager( 1378): UsbEndpoint[mAddress=2,mAttributes=2,mMaxPacketSize=512,mInterval=0]]]]
D/AndroidRuntime(14943): Shutting down VM
E/AndroidRuntime(14943): FATAL EXCEPTION: main
E/AndroidRuntime(14943): Process: com.mantz_it.rfanalyzer, PID: 14943
E/AndroidRuntime(14943): java.lang.RuntimeException: Error receiving broadcast Intent { act=com.mantz_it.hackrf_android.USB_PERMISSION flg=0x10 (has extras) } in com.mantz_it.hackrf_android.Hackrf$1@26cf1f2a
E/AndroidRuntime(14943): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:871)
E/AndroidRuntime(14943): at android.os.Handler.handleCallback(Handler.java:739)
E/AndroidRuntime(14943): at android.os.Handler.dispatchMessage(Handler.java:95)
E/AndroidRuntime(14943): at android.os.Looper.loop(Looper.java:135)
E/AndroidRuntime(14943): at android.app.ActivityThread.main(ActivityThread.java:5221)
E/AndroidRuntime(14943): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(14943): at java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime(14943): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
E/AndroidRuntime(14943): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
E/AndroidRuntime(14943): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.hardware.usb.UsbDeviceConnection.claimInterface(android.hardware.usb.UsbInterface, boolean)' on a null object reference
E/AndroidRuntime(14943): at com.mantz_it.hackrf_android.Hackrf.sendUsbRequest(Hackrf.java:469)
E/AndroidRuntime(14943): at com.mantz_it.hackrf_android.Hackrf.getBoardID(Hackrf.java:505)
E/AndroidRuntime(14943): at com.mantz_it.rfanalyzer.HackrfSource.isOpen(HackrfSource.java:113)
E/AndroidRuntime(14943): at com.mantz_it.rfanalyzer.MainActivity.startAnalyzer(MainActivity.java:724)
E/AndroidRuntime(14943): at com.mantz_it.rfanalyzer.MainActivity.onIQSourceReady(MainActivity.java:421)
E/AndroidRuntime(14943): at com.mantz_it.rfanalyzer.HackrfSource.onHackrfReady(HackrfSource.java:99)
E/AndroidRuntime(14943): at com.mantz_it.hackrf_android.Hackrf$1.onReceive(Hackrf.java:202)
E/AndroidRuntime(14943): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:861)
E/AndroidRuntime(14943): ... 8 more
W/ActivityManager( 1378): Force finishing activity com.mantz_it.rfanalyzer/.MainActivity
W/ContextImpl( 1378): Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1321 com.android.server.usb.UsbSettingsManager.deviceAttached:741 com.android.server.usb.UsbHostManager.endUsbDeviceAdded:286 com.android.server.usb.UsbHostManager.monitorUsbHostBus:-2 com.android.server.usb.UsbHostManager.access$000:47
I/OpenGLRenderer( 1378): Initialized EGL, version 1.4
I/art ( 1378): Background partial concurrent mark sweep GC freed 10113(655KB) AllocSpace objects, 11(12MB) LOS objects, 26% free, 44MB/60MB, paused 1.052ms total 111.381ms
W/ActivityManager( 1378): Activity pause timeout for ActivityRecord{1afa49bd u0 com.mantz_it.rfanalyzer/.MainActivity t351 f}
D/WifiService( 1378): acquireWifiLockLocked: WifiLock{Firepaper type=1 binder=android.os.BinderProxy@ad70817}
D/WifiService( 1378): releaseWifiLockLocked: WifiLock{Firepaper type=1 binder=android.os.BinderProxy@ad70817}
D/TaskPersister( 1378): removeObsoleteFile: deleting file=352_task_thumbnail.png

Kernel Log:

<6>[ 103.778733] usb 3-1.4: reset high-speed USB device number 6 using tegra-ehci
<6>[ 103.901440] usb 3-1.4: USB disconnect, device number 6
<6>[ 103.998737] usb 3-1.4: new high-speed USB device number 7 using tegra-ehci
<6>[ 104.109981] usb 3-1.4: New USB device found, idVendor=1d50, idProduct=6089
<6>[ 104.110017] usb 3-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
<6>[ 104.110029] usb 3-1.4: Product: HackRF One
<6>[ 104.110038] usb 3-1.4: Manufacturer: Great Scott Gadgets
<6>[ 144.698651] usb 3-1.4: reset high-speed USB device number 7 using tegra-ehci
<6>[ 144.810814] usb 3-1.4: USB disconnect, device number 7
<6>[ 144.908648] usb 3-1.4: new high-speed USB device number 8 using tegra-ehci
<6>[ 145.019949] usb 3-1.4: New USB device found, idVendor=1d50, idProduct=6089
<6>[ 145.019973] usb 3-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
<6>[ 145.019984] usb 3-1.4: Product: HackRF One
<6>[ 145.019993] usb 3-1.4: Manufacturer: Great Scott Gadgets