keesj / librtlsdr-android

Getting rtl-sdr to work on android (the library part)
GNU General Public License v2.0
30 stars 4 forks source link

Libusb error #1

Open clarktristan opened 6 years ago

clarktristan commented 6 years ago

I keep getting this error that my app cannot open or access the SDR. I have established a connection via Java, so I believe I have the appropriate permissions, but every time I try opening the SDR via pyrtlsdr, I get an error code -3. I narrowed it down to an access denied error according to the libusb.so file that is installed with librtlsdr-android.

Thanks.

keesj commented 6 years ago

Hi,

I have not touched this code in .. ages. are you positive you are using this library? The code here depends on the c code calling back to java (I think) see

https://github.com/keesj/librtlsdr-android/commit/754fb3512dab88b248b3729eeb4387cc1e12e2fe

https://github.com/keesj/android-rtlsdr/blob/master/src/rtlsdr/android/MainActivity.java

clarktristan commented 6 years ago

Yes, I install it as a native library in order to use the librtlsdr and libusb libraries from my app. It is the only librtlsdr library I have found that will successfully install with the app.

clarktristan commented 6 years ago

Yes, I install it as a native library in order to use the librtlsdr and libusb libraries from my app. It is the only librtlsdr library I have found that will successfully install with the app.

keesj commented 6 years ago

If you just want something that works have a look at installing f-droid 's pacakges (not mine)

https://f-droid.org/en/packages/marto.rtl_tcp_andro/ and https://f-droid.org/en/packages/com.mantz_it.rfanalyzer/

nishankhadka09 commented 10 months ago

@keesj Would you be willing to update it so that the .so file gets generated for each architecture? Currently the libusb.so is not compatible with aarch64 and x86_64, even if I get the libusb.so for aarch64 from the official page, I run into some errors in the libusbhelper.c class.

keesj commented 9 months ago

Hello @nishankhadka09,

I think this should not be that hard are only the .so files missing or is there more going on? I a willing to put some effort if you find it useful

nishankhadka09 commented 9 months ago

Well, I just compiled for the armv7a architecture, and built the library. But when I try to run it with project it says something like this:

12-19 11:09:15.166   679   679 E audit   : type=1400 audit(1702948155.161:67991): avc:  denied  { read } for  pid=21356 comm="ataDistribution" name="usb" dev="tmpfs" ino=591 scontext=u:r:untrusted_app:s0:c86,c257,c512,c768 tcontext=u:object_r:usb_device:s0 tclass=dir permissive=0 SEPF_SM-A536E_12_0001 audit_filtered
12-19 11:09:15.167   679   679 E audit   : type=1400 audit(1702948155.161:67992): avc:  denied  { read } for  pid=21356 comm="ataDistribution" name="devices" dev="sysfs" ino=30880 scontext=u:r:untrusted_app:s0:c86,c257,c512,c768 tcontext=u:object_r:sysfs:s0 tclass=dir permissive=0 SEPF_SM-A536E_12_0001 audit_filtered
12-19 11:09:15.168 21356 21356 F libc    : Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xffffffec in tid 21356 (ataDistribution), pid 21356 (ataDistribution)

I guess this is due to permission error. I thought updating the rtl-sdr.rules rules would help but it didn't. I am not exactly sure what's going on, and I didn't have the time to pursue this further. But any guidance is more than welcome, and yes! we do believe that if we get this library to work, it would be very useful for what we are trying to achieve.

keesj commented 9 months ago

Does you manifest have the correct permissions? https://github.com/keesj/android-rtlsdr/blob/master/AndroidManifest.xml#L6