Jump to content

Beelink X2 with armbian possible?


tpc010

Recommended Posts

Ah, ok. I thought that AP6210 is used mostly because all FW files in Android image reference it as AP6210 and extracted fex file has secondary UART enabled with flow control, which is usually used by bcmdhd for bluetooth.

 

@markbirss, so nothing to test then.

Link to comment
Share on other sites

To sum it up:

  • no BT therefore it's ok to disable the UARTs not used (it's not an SBC and only uart0 is accessible through soldering anyway)
  • does the bcmdhd driver now need additional parameters to correctly load the firmware? If so we should think about jernej's suggestion
  • no firmware .deb means upgraded installations don't get more recent Wi-Fi firmwares. Would be nice if we could fix that
  • line787 in the fex file should be changed to 0 (otherwise average load will always be 1 or above)

Something I missed?

Link to comment
Share on other sites

Hi @tkaiser and others

 

i found that by default the bcmdhd module requires a config.txt and nvram.txt file present in /lib/firmware/ap6212 unless you specify them specifically with modprobe

 

modprobe bcmdhd nvram_path=/lib/firmware/ap6212/nvram_ap6210.txt 
conf_path=/lib/firmware/ap6212/myconfig.txt
 
nvram.txt is the nvram_ap6210.txt 
config.txt (not sure)
 
provided the firmware files (fw_bcm40181a2.bin) is also in /lib/firmware/ap6212 and been added to /etc/modules the wifi works 
 
 
What about getting the IR remote controller working ?
Link to comment
Share on other sites

After module is rebuild, we could load bcmdhd based on board with only

modprobe bcmdhd nvram_path=/lib/firmware/bcmdhd/nvram_ap6210.txt

for example...

 

Noob question: Do you think we're able to use bcmdhd driver for both BPi M2+ and Beelink X2 without adding any module parameters to /etc/modules? Background: https://github.com/igorpecovnik/lib/commit/c13fe2e59c1fc5f561db0e281d856097c2291f38#commitcomment-17875420

Link to comment
Share on other sites

What about getting the IR remote controller working ?

 

What's not working? Pin mapping is identical to Orange Pi [1] so jernej's backported IR driver should work like on any Orange Pi. Never dealt with that so not sure which module to load. In case you figure it out please report back so that we can add this to the board config to be enabled (or commented) in /etc/modules.

 

[1] https://github.com/igorpecovnik/lib/blob/master/config/fex/beelinkx2.fex#L1021vs. 

 

https://github.com/igorpecovnik/lib/blob/master/config/fex/orangepipc.fex#L675

Link to comment
Share on other sites

Maybe, i don't have BPi M2+ but i passed no module parameters in /etc/modules for bmdhd module, left the 

2 text files in the /lib/firmnware/ap6212 folder (don't know if the same nvram_ap6210.txt works for both devices)

 

Noob question: Do you think we're able to use bcmdhd driver for both BPi M2+ and Beelink X2 without adding any module parameters to /etc/modules? Background: https://github.com/igorpecovnik/lib/commit/c13fe2e59c1fc5f561db0e281d856097c2291f38#commitcomment-17875420

Link to comment
Share on other sites

Ah, ok, thank you, when i have time will have a look

 

What's not working? Pin mapping is identical to Orange Pi [1] so jernej's backported IR driver should work like on any Orange Pi. Never dealt with that so not sure which module to load. In case you figure it out please report back so that we can add this to the board config to be enabled (or commented) in /etc/modules.

 

[1] https://github.com/igorpecovnik/lib/blob/master/config/fex/beelinkx2.fex#L1021vs. 

 

https://github.com/igorpecovnik/lib/blob/master/config/fex/orangepipc.fex#L675

Link to comment
Share on other sites

FYI, backported driver completely ignores IR settings in fex file. They are used only for resuming from sleep, IIRC.

 

Thx for the reminder. But fortunately the same pin mapping is used. I just did this

root@beelinkx2:/home/tk# modprobe sunxi-cir

root@beelinkx2:/home/tk# ir-keytable -p NEC,RC-5,RC-6,JVC,SONY,LIRC,OTHER ; ir-keytable -c ; ir-keytable -t
Invalid parameter(s)
ir-keytable: -p: (PROGRAM ERROR) Option should have been recognized!?
Try `ir-keytable --help' or `ir-keytable --usage' for more information.
Old keytable cleared
Testing events. Please, press CTRL-C to abort.
1466427392.393181: event type EV_MSC(0x04): scancode = 0x03
1466427392.393209: event type EV_SYN(0x00).
1466427392.837740: event type EV_MSC(0x04): scancode = 0x03
1466427392.837767: event type EV_SYN(0x00).
1466427393.983779: event type EV_MSC(0x04): scancode = 0x02
1466427393.983808: event type EV_SYN(0x00).
1466427397.780964: event type EV_MSC(0x04): scancode = 0x48
1466427397.780994: event type EV_SYN(0x00).
1466427398.716936: event type EV_MSC(0x04): scancode = 0x48
1466427398.716964: event type EV_SYN(0x00).
1466427401.090401: event type EV_MSC(0x04): scancode = 0x14
1466427401.090431: event type EV_SYN(0x00).
1466427402.939626: event type EV_MSC(0x04): scancode = 0x5c
1466427402.939656: event type EV_SYN(0x00).
1466427403.581513: event type EV_MSC(0x04): scancode = 0x5c
1466427403.581539: event type EV_SYN(0x00).
1466427407.404387: event type EV_MSC(0x04): scancode = 0x0b
1466427407.404416: event type EV_SYN(0x00).
1466427411.510339: event type EV_MSC(0x04): scancode = 0x58
1466427411.510367: event type EV_SYN(0x00).
1466427412.160997: event type EV_MSC(0x04): scancode = 0x58
1466427412.161022: event type EV_SYN(0x00).

So IR also works. Since Beelink X2 ships with a remote someone a bit familiar with this stuff could start now (read as: before we release Armbian 5.15) to add an appropriate config file we could then integrate into the build (but I have to admit that I'm such a NOOB regarding IR that I don't know how to deal with the information from this thread where I found how to check the scancodes)

 

On a related note. The on/off button on Beelink X2 also uses the correct pin mapping. After installation of the acpid package this is possible:

root@beelinkx2:/home/tk# acpi_listen 
button/power PBTN 00000080 00000000

So all we need to do is to define a shutdown action for the 'button/power' event, in the most simple form as follows:

echo -e 'event=button/power\naction=/etc/acpi/check-and-shutdown.sh' >/etc/acpi/events/powerbtn
echo -e '#!/bin/bash\nshutdown -h now' >/etc/acpi/check-and-shutdown.sh
chmod 755 /etc/acpi/check-and-shutdown.sh

Then the simple press of the power button executes the script code in /etc/acpi/check-and-shutdown.sh (in the aforementioned example without a check -- but on an Orange Pi Lite I currently use as a backup device I added some code to check whether a backup is currently running delaying the shutdown until the task is finished). Of course anything else can also happen when the power button is pressed, it's just the execution of some script code (and the same applies to each and every Orange Pi out there too)

Link to comment
Share on other sites

Hmm... an alternative to shutting the device down can also be suspend to RAM. Then /etc/acpi/check-and-shutdown.sh might look like this:

#!/bin/bash                                                  
echo none >/sys/class/leds/*green*/trigger
echo default-on >/sys/class/leds/*red*/trigger
echo mem >/sys/power/state

Then pressing the power button sends the device to sleep but wake up from sleep (also through power button) wasn't that reliable and I also don't know which hook to use to switch led colors back.

Link to comment
Share on other sites

Then pressing the power button sends the device to sleep but wake up from sleep (also through power button) wasn't that reliable and I also don't know which hook to use to switch led colors back.

 

systemd service works, for example:

[Unit]
Description=h3 suspend service
Before=sleep.target
StopWhenUnneeded=yes

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=-/bin/sh -c "echo 1 > /sys/class/leds/green_led/brightness; echo 1 > /sys/class/leds/red_led/brightness"
ExecStop=-/bin/sh -c "echo 0 > /sys/class/leds/green_led/brightness; echo 0 > /sys/class/leds/red_led/brightness"

[Install]
WantedBy=sleep.target

ExecStart will execute at suspend and ExecStop will execute at resume. Please note that above example is taken from OpenELEC, which has slightly different LED settings, but principle is the same.

Link to comment
Share on other sites

systemd service works, for example -- ExecStart will execute at suspend and ExecStop will execute at resume. Please note that above example is taken from OpenELEC, which has slightly different LED settings, but principle is the same.

 

Ah, that's nice. And also works with power button?

 

BTW: I would recommend changing these led adjustments to this style since it will survive switch between legacy and mainline kernel (at least with H3 devices based on .dts contents for Oranges):

echo none >/sys/class/leds/*green*/trigger
echo default-on >/sys/class/leds/*red*/trigger

And currently we treat the blue led on Beelink X2 as green (name in fex file) since otherwise we would've to differentiate again between different sunxi devices (NanoPi M1 for example has a blue led instead of the red one with same pin mapping)

Link to comment
Share on other sites

Ah, that's nice. And also works with power button?

 

That's the point.

 

BTW: I would recommend changing these led adjustments to this style since it will survive switch between legacy and mainline kernel (at least with H3 devices based on .dts contents for Oranges):

 

I will probably leave it as is. A lot will change anyway and I can't switch so quickly, because a lot of drivers still missing.

Link to comment
Share on other sites

About the Wi-Fi, when I try in ARMBIAN 5.14 jessie desktop 3.4.112-sun8i:
 

sudo modprobe bcmdhd
modprobe: ERROR: could not insert 'bcmdhd': No such device

I need to do something more?

 

in /etc/modules I have:

# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.

#gpio_sunxi
bcmdhd
sndspdif
sunxi_sndspdif
sunxi_spdif
sunxi_spdma

And when I do lsmod obtain:

Module                  Size  Used by
mali_drm                2732  1
drm                   178255  2 mali_drm
mali                  123208  0
ump                    29379  3 mali
sunxi_spdma             3703  1
sunxi_spdif             7037  1
sunxi_sndspdif          3885  0
sndspdif                2743  1
8189es               1076034  0
hid_logitech_dj        10040  0

I need to do something more to have the internal Wi-Fi working?

Thanks in advance.

Link to comment
Share on other sites

I put the firmware file on my webserver http://www.itgubben.eu/files/

 

Hi slinde, inside the firmware file there is no bcmdhd.bin file.

When I do a:

sudo modprobe bcmdhd firmware_path=/lib/firmware/ap6210/bcmdhd.bin nvram_path=/lib/firmware/ap6210/nvram.txt

I have a message like this:

modprobe: ERROR: could not insert 'bcmdhd': No such device

And the dmesg shows me:

[ 1004.060351] failed to power up DHD generic adapter, 0 retry left

Any help?

Link to comment
Share on other sites

All those firmware files should be in package armbian-firmware which should come by default in latest image. I am getting a Belink X2 probably today, so I'll check and fix if something needed a fix :)

Link to comment
Share on other sites

All those firmware files should be in package armbian-firmware which should come by default in latest image. I am getting a Belink X2 probably today, so I'll check and fix if something needed a fix :)

 

Thanks a million Igor. 
Link to comment
Share on other sites

Hi slinde, inside the firmware file there is no bcmdhd.bin file.

When I do a:

sudo modprobe bcmdhd firmware_path=/lib/firmware/ap6210/bcmdhd.bin nvram_path=/lib/firmware/ap6210/nvram.txt

I have a message like this:

modprobe: ERROR: could not insert 'bcmdhd': No such device

And the dmesg shows me:

[ 1004.060351] failed to power up DHD generic adapter, 0 retry left

Any help?

 

Hi manuti, I tested this once more today and it works for me as earlier described and with the file I uploaded to my web server. See the full logfile for details:

root@beelinkx2:~# lsmod
Module                  Size  Used by
sunxi_spdma             3703  1
sunxi_spdif             7037  1
sunxi_sndspdif          3885  0
sndspdif                2743  1
bcmdhd                648477  0

root@beelinkx2:~# wget http://www.itgubben.eu/files/ap6210.tar.xz
--2016-07-09 15:55:33--  http://www.itgubben.eu/files/ap6210.tar.xz
Resolving www.itgubben.eu (www.itgubben.eu)... 2001:470:27:75b::2, 83.209.13.109
Connecting to www.itgubben.eu (www.itgubben.eu)|2001:470:27:75b::2|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 225284 (220K) [application/x-xz]
Saving to: ‘ap6210.tar.xz’

ap6210.tar.xz       100%[=====================>] 220.00K  1.19MB/s   in 0.2s

2016-07-09 15:55:33 (1.19 MB/s) - ‘ap6210.tar.xz’ saved [225284/225284]

root@beelinkx2:~# cd /lib/firmware/
root@beelinkx2:/lib/firmware# tar xvf ~/ap6210.tar.xz
ap6210/
ap6210/fw_bcm40181a2_p2p.bin
ap6210/nvram.txt
ap6210/fw_bcm40181a2_apsta.bin
ap6210/fw_bcm40181a2.bin

root@beelinkx2:/lib/firmware# cd

root@beelinkx2:~# lsmod
Module                  Size  Used by
sunxi_spdma             3703  1
sunxi_spdif             7037  1
sunxi_sndspdif          3885  0
sndspdif                2743  1
bcmdhd                648477  0

root@beelinkx2:~# rmmod bcmdhd

root@beelinkx2:~# modprobe bcmdhd firmware_path=/lib/firmware/ap6210/bcmdhd.bin nvram_path=/lib/firmware/ap6210/nvram.txt

root@beelinkx2:~# lsmod
Module                  Size  Used by
bcmdhd                648477  0
sunxi_spdma             3703  1
sunxi_spdif             7037  1
sunxi_sndspdif          3885  0
sndspdif                2743  1

root@beelinkx2:~# ifconfig wlan0 up

root@beelinkx2:~# iwlist wlan0 scan
wlan0     Scan completed :
          Cell 01 - Address: 14:CC:20:CB:A4:72
                    ESSID:"XXXXXXX"
                    Mode:Managed
                    Frequency:2.437 GHz (Channel 6)
                    Quality:5/5  Signal level:-40 dBm  Noise level:-82 dBm...

This test was done with a Beelink X2 and the file Armbian_5.14_Beelinkx2_Debian_jessie_3.4.112.7z downloaded today.

I agree there is no file called "bcmdhd.bin" in the ap6210.tar.xz file but somehow it seems to work anyhow. If I look in the /var/syslog file I see that the driver finds the correct paths:

Jul  9 15:59:45 localhost kernel: [  498.139371] dhd_bus_devreset: == WLAN ON ==
Jul  9 15:59:45 localhost kernel: [  498.139671] F1 signature read @0x18000000=0x1591a962
Jul  9 15:59:45 localhost kernel: [  498.140467] dhd_conf_set_hw_oob_intr: Enable HW OOB for 43362
Jul  9 15:59:45 localhost kernel: [  498.146815] F1 signature OK, socitype:0x1 chip:0xa962 rev:0x1 pkg:0x9
Jul  9 15:59:45 localhost kernel: [  498.149117] DHD: dongle ram size is set to 245760(orig 245760) at 0x0
Jul  9 15:59:45 localhost kernel: [  498.152761] dhd_conf_read_config: Ignore config file /lib/firmware/ap6212/config.txt
Jul  9 15:59:45 localhost kernel: [  498.152836] dhd_conf_set_fw_name_by_chip: firmware_path=/lib/firmware/ap6210/fw_bcm40181a2.bin
Jul  9 15:59:45 localhost kernel: [  498.152888] Final fw_path=/lib/firmware/ap6210/fw_bcm40181a2.bin
Jul  9 15:59:45 localhost kernel: [  498.152925] Final nv_path=/lib/firmware/ap6210/nvram.txt
Jul  9 15:59:45 localhost kernel: [  498.152959] Final conf_path=/lib/firmware/ap6212/config.txt
Jul  9 15:59:45 localhost kernel: [  498.197314] NVRAM version: AP6210_NVRAM_V1.3_08182013

Link to comment
Share on other sites

 

I agree there is no file called "bcmdhd.bin" in the ap6210.tar.xz file but somehow it seems to work anyhow.

 

 

Yeah, bcmdhd driver has some strange things inside the code. It seems mandatory to have some file specified, but later on it gets replaced with correct FW name based on chip id. If you check driver source, you can see a lot of different FW file names.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines