Bluetooth Scanning and Tasker

Post Reply
nbetcher
Posts: 8
Joined: Sun Mar 25, 2018 10:31 am
languages_spoken: english
ODROIDs: C2, N2
Location: Phoenix, Arizona, United States, North America, Earth, Milky Way, Dimension 0
Has thanked: 0
Been thanked: 0
Contact:

Bluetooth Scanning and Tasker

Unread post by nbetcher » Fri Mar 27, 2020 5:27 am

Hello,
Over the past year or so I've had an issue with both my ODroid-C2 and now ODroid-N2 which I've yet to be able to resolve. I have Android Pie 32bit build 20191223 installed with the following configuration:
  • Tasker installed.
  • Tasker profile setup to look for a nearby Bluetooth device by MAC address. (Lets call this profile, "BT Found")
  • A separate Tasker profile setup to look if that Bluetooth device is NOT near. (Lets call this profile, "BT Not Found")
  • Bluetooth device has been paired in the Android Bluetooth system settings.
After a random amount of time -- usually days or weeks -- Tasker is suddenly unable to, "see" nearby paired Bluetooth devices. The reason I feel this is not a Tasker issue is because I've reported it to the developer who can find nothing wrong in the code; the Tasker configuration works on a non-ODroid device just fine; and the Tasker profile named, "BT Not Found" is NOT triggered either. Looking at the adb logcat, I do not see any attempts to scan for Bluetooth devices by Tasker, but there could be an error in the logcat that I don't know about which is in-place of where I'd normally see BT scan messages. The only message (Informational) I can see which might have anything to do with it is:

Code: Select all

03-26 13:00:42.868  4960  4960 I Binder:4960_4: type=1400 audit(0.0:268): avc: denied { open } for path="/sys/devices/virtual/android_usb/android0/state" dev="sysfs" ino=22231 scontext=u:r:priv_app:s0:c512,c768 tcontext=u:object_r:sysfs_android_usb:s0 tclass=file permissive=1
Since the Bluetooth Dongle is plugged into the USB port. The BT Dongle is a DAYKIT Mini USB Bluetooth CSR 4.0 Dual Mode and has worked perfectly otherwise.

The only way I can fix it is to shutdown the device, unplug the BT dongle and plug it into a different USB port, or -- if that doesn't work -- to uninstall Tasker and reinstall it while also changing the USB port the BT Dongle is plugged into. During the time that Tasker cannot scan for BT devices, it is possible to scan for BT devices in the Android Bluetooth settings.

I have attached the logcat during the time Tasker is unable to find any BT devices.
Thanks,
--Nick
Attachments
Tasker-Cant-Find-BT-Devices-logcat.txt
(71.16 KiB) Downloaded 3 times

nbetcher
Posts: 8
Joined: Sun Mar 25, 2018 10:31 am
languages_spoken: english
ODROIDs: C2, N2
Location: Phoenix, Arizona, United States, North America, Earth, Milky Way, Dimension 0
Has thanked: 0
Been thanked: 0
Contact:

Re: Bluetooth Scanning and Tasker

Unread post by nbetcher » Fri Apr 03, 2020 11:15 am

Since there hasn't been any reply, I decided to write my own small Bluetooth scanning utility that is barebones. All it does it scans for nearby BT devices and prints them to logcat. Attached you can find the source code for it. When I run it, all it prints out is this:

Code: Select all

04-02 19:08:16.702 10521 10521 V BTDebug : BT Adapter found, checking if Bluetooth is on...
04-02 19:08:16.704 10521 10521 V BTDebug : BT Adapter had its Bluetooth on, scanning for devices...
And messages about found BT devices are NOT ever printed. I checked my cellphone and there are numerous nearby devices that show up in the Bluetooth settings dialog, but despite that I put my phone into pairing mode (left it on the BT screen) and scanned again from the N2 using my app -- still nothing found.

At this point it appears that for some reason, at the higher API layer of Android, the N2 can no longer discover devices nearby when this issue happens. However, the Bluetooth settings on the N2 -- when you click, "Pair new device" -- does find nearby devices still.

Can someone please help resolve this?
Attachments
BTDebug.java.txt
(2.75 KiB) Downloaded 3 times

nbetcher
Posts: 8
Joined: Sun Mar 25, 2018 10:31 am
languages_spoken: english
ODROIDs: C2, N2
Location: Phoenix, Arizona, United States, North America, Earth, Milky Way, Dimension 0
Has thanked: 0
Been thanked: 0
Contact:

Re: Bluetooth Scanning and Tasker

Unread post by nbetcher » Tue Apr 07, 2020 7:31 am

At this point nothing I do seems to resolve the issue as I previously had been able to do.

User avatar
odroid
Site Admin
Posts: 33698
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean, Japanese
ODROIDs: ODROID
Has thanked: 515 times
Been thanked: 507 times
Contact:

Re: Bluetooth Scanning and Tasker

Unread post by odroid » Wed Apr 08, 2020 10:32 am

Since we don't know how the Bluetooth driver & framework works in Android OS, we can't help you. Sorry about that.

As far as I heard, Lineage OS has a different Bluetooth APIs and it must be worth to try probably.

Post Reply

Return to “Android”

Who is online

Users browsing this forum: No registered users and 2 guests