Closed ebc81 closed 1 year ago
It turned out to be an issue with PendingIntent.FLAG_MUTABLE
that was being set in the PendingIntent
preventing it from receiving extra arguments.
Should be fixed in https://github.com/signalwareltd/rtl_tcp_andro-/commit/ec6916e7fd4a13618b90a239da5ade6a52ae8ef0 and will appear in next release.
You can reproduce the error as following: Fresh Installation of RTL SDR Driver
Error then is the following:
onStart RtlSdr: found 1 device opening options HackRF: found 0 device opening options Only 1 option available, no need to ask user. Opening rtl-sdr /dev/bus/usb/001/003 Closing service Queueing Arguments SdrTcpArguments{gain=24, samplerateHz=1024000, frequencyHz=91800000, address='0.0.0.0', port=14423, ppm=0} Starting service with device rtl-sdr /dev/bus/usb/001/003 Got a permission for an unexpected device NULL. Expected UsbDevice[mName=/dev/bus/usb/001/003,mVendorId=3034,mProductId=10296,mClass=0,mSubclass=0,mProtocol=0,mManufacturerName=Realtek,mProductName=RTL2838UHIDIR,mVersion=1.00,mSerialNumberReader=android.hardware.usb.IUsbSerialReader$Stub$Proxy@38a97ae, mHasAudioPlayback=false, mHasAudioCapture=false, mHasMidi=false, mHasVideoCapture=false, mHasVideoPlayback=false, mConfigurations=[ UsbConfiguration[mId=1,mName=USB2.0-Bulk&Iso,mAttributes=128,mMaxPower=250,mInterfaces=[ UsbInterface[mId=0,mAlternateSetting=0,mName=Bulk-In, Interface,mClass=255,mSubclass=255,mProtocol=255,mEndpoints=[ UsbEndpoint[mAddress=129,mAttributes=2,mMaxPacketSize=512,mInterval=0]] UsbInterface[mId=1,mAlternateSetting=0,mName=Bulk-In, Interface,mClass=255,mSubclass=255,mProtocol=255,mEndpoints=[]]]. Caught exception RuntimeException: Could not get a connection -> RtlSdrDevice -> RtlSdrDevice$1 Closed service due to exception RuntimeException: Could not get a connection ERROR STARTING! Reason: unknown_error
Most likely reason is in UsbPermissionObtainer.java UsbDevice device = intent.getParcelableExtra(UsbManager.EXTRA_DEVICE);
UsbDevice device = intent.getParcelableExtra(UsbManager.EXTRA_DEVICE); if (device != null && device.equals(usbDevice)) { if (intent.getBooleanExtra(UsbManager.EXTRA_PERMISSION_GRANTED, false)) { if (!manager.hasPermission(device)) { Log.appendLine("Permissions were granted but can't access the device"); task.setDone(null); } else { Log.appendLine("Permissions granted and device is accessible"); task.setDone(manager.openDevice(device)); } } else { Log.appendLine("Extra permission was not granted"); task.setDone(null); } context.unregisterReceiver(this); } else { Log.appendLine("Got a permission for an unexpected device %s. Expected %s.", device == null ? "NULL" : device, usbDevice); task.setDone(null); }
see [https://developer.android.com/reference/android/content/Intent] _This method was deprecated in API level 33. Use the type-safer getParcelableArrayListExtra(java.lang.String, java.lang.Class) starting from Android Build.VERSION_CODES#TIRAMISU._