Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rfkill is not used correctly when setup bluetooth with ap6212 #1352

Open
xiongyihui opened this issue Apr 19, 2019 · 9 comments
Open

rfkill is not used correctly when setup bluetooth with ap6212 #1352

xiongyihui opened this issue Apr 19, 2019 · 9 comments
Labels
Can be closed? Ping developers on stalled issues / PR

Comments

@xiongyihui
Copy link

In ap6212-bluetooth, rfkill is not used correctly.

        rfkill unblock all
        echo "0" > /sys/class/rfkill/rfkill0/state
        echo "1" > /sys/class/rfkill/rfkill0/state

for Nanopi Neo Air and Orangepi Zero Plus2 H5, rfkill0 is Wi-Fi in the default settings of armbian

pi@nanopiair:~$ rfkill list
0: phy0: Wireless LAN
        Soft blocked: no
        Hard blocked: no

For Nanopi Neo Air, I tried to add bluetooth reset to rfkill using a dts file, but failed. The dts is:

/dts-v1/;
/plugin/;

/ {
    compatible = "allwinner,sun8i-h3";

    fragment@0 {
        target = <&pio>;
        __overlay__ {
            bt_pwr_pin: bt_pwr_pin@0 {
                pins = "PG13";
                function = "gpio_out";
            };
        };
    };

    fragment@1 {
        target-path = "/";
        __overlay__ {
            rfkill_bt {
                compatible = "rfkill-gpio";
                pinctrl-names = "default";
                pinctrl-0 = <&bt_pwr_pin>;
                reset-gpios = <&pio 6 13 1>;
                clocks = <&osc32k>;
                clock-frequency = <32768>;
                rfkill-name = "sunxi-bt";
                rfkill-type = "bluetooth";
            };
        };
    };
};

The command rfkill list doesn't have "sunxi-bt". Something should be missing in the dts file.
Any idea?

@igorpecovnik
Copy link
Member

Bluetooth is in a bad shape in general so yes, its possible that things are missing. For me it's low priority ... but I guess once this should be sorted out. At least for AP6212, which is most common.

@xiongyihui
Copy link
Author

It seems that we need a patch for rfkill-gpio to add bluetooth reset pin to rfkill-gpio

igorpecovnik added a commit that referenced this issue Apr 21, 2019
… but tested only for building + related kernel config changes and bump with version due to yet another armbian-config update.

#1352
@igorpecovnik
Copy link
Member

Some progress:

|  \| |/ _` | '_ \ / _ \| |_) | | | |_) | |
| |\  | (_| | | | | (_) |  __/| | |  _ <| |
|_| \_|\__,_|_| |_|\___/|_|   |_| |_| \_\_|
                                           

Welcome to ARMBIAN 5.82 user-built Ubuntu 18.04.2 LTS 4.19.36-sunxi   
System load:   0.00 0.00 0.00  	Up time:       31 min		
Memory usage:  8 % of 999MB  	IP:            
CPU temp:      33°C           	
Usage of /:    3% of 30G    	

Last login: Mon Apr 22 11:24:25 2019 from 10.0.10.42

root@nanopi:~# rfkill list
0: sunxi-bt: Bluetooth
	Soft blocked: no
	Hard blocked: no
1: phy0: Wireless LAN
	Soft blocked: no
	Hard blocked: no

@konkhra
Copy link

konkhra commented Apr 2, 2021

In Armbian Focal (mainline based kernel 5.10.y) the problem still persists. Bluetooth not working. Maybe something broken up and the question is what and where?

@msabatini-met
Copy link

Some progress:

|  \| |/ _` | '_ \ / _ \| |_) | | | |_) | |
| |\  | (_| | | | | (_) |  __/| | |  _ <| |
|_| \_|\__,_|_| |_|\___/|_|   |_| |_| \_\_|
                                           

Welcome to ARMBIAN 5.82 user-built Ubuntu 18.04.2 LTS 4.19.36-sunxi   
System load:   0.00 0.00 0.00  	Up time:       31 min		
Memory usage:  8 % of 999MB  	IP:            
CPU temp:      33°C           	
Usage of /:    3% of 30G    	

Last login: Mon Apr 22 11:24:25 2019 from 10.0.10.42

root@nanopi:~# rfkill list
0: sunxi-bt: Bluetooth
	Soft blocked: no
	Hard blocked: no
1: phy0: Wireless LAN
	Soft blocked: no
	Hard blocked: no

Hi, I took from https://www.armbian.com/orange-pi-zero-plus-2-h3/ the Buster image, and bluetooth is not working; is this patch supposed to be included in a new release?

@igorpecovnik
Copy link
Member

is this patch supposed to be included in a new release?

If not in the release documents and if issue not closed with a commit, unlikely:
https://docs.armbian.com/Release_Changelog/

@walterjj
Copy link

walterjj commented May 15, 2021

Could we have a workaround in the while to make BLE work on a NanoPi NEO Air on Armbian 21.05.1 Focal with Linux 5.10.34-sunxi ? Thanyou!

@msabatini-met
Copy link

Give a look here to see how I found a solution:
https://forum.armbian.com/topic/18100-ap6212a-bt-not-working-on-orange-pi-zero-plus2-h3/
edit the ap6212-bluetooth script if needed for your platform.

@pyavitz
Copy link
Collaborator

pyavitz commented Oct 26, 2021

To get this working on the NanoPi NEO Plus2, I created said patches: dts patch and rfkill-gpio patch

Compiled: brcm_patchram_plus
Added the following: firmware
Created said script: nanopi-bthelper

Followed by systemd service:

[Unit]
Description=Bluetooth Helper
Before=bluetooth.service

[Service]
Type=oneshot
ExecStart=/usr/local/sbin/nanopi-bthelper -s
ExecStop=/usr/local/sbin/nanopi-bthelper -k
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

rfkill list

0: sunxi-bt: Bluetooth
	Soft blocked: no
	Hard blocked: no
1: phy0: Wireless LAN
	Soft blocked: no
	Hard blocked: no
3: hci0: Bluetooth
	Soft blocked: no
	Hard blocked: no

bluetoothctl

Agent registered
[CHG] Controller 6C:0E:3E:BA:9A:56 Pairable: yes

This has been tested on Linux 5.14.14

@igorpecovnik igorpecovnik added the Can be closed? Ping developers on stalled issues / PR label Nov 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Can be closed? Ping developers on stalled issues / PR
Development

No branches or pull requests

6 participants