Implementing drivers for Wifi/Bluetooth chip AM7256 driver

Hello,

I want to implement the bluetooth drivers in Emuelec for the tv box X96_max_plus2_T which has the AM7256 Wifi/bluetooth chip

My vendor have give me this driver however I don’t know how to implement in EmuELEC. Could anybody help me to do it ?

BTW: I’ve followed this tutorial from Halogen’s blog, but it just enable the wifi, but bluetooth misbehave, I read in a blog that the drivers for bluetooth and wifi must be implemented separately.

Don’t you mean implement in CoreELEC?

CoreELEC (and EmuELEC) already includes newer driver bcmdhd.100.10.545.x as part of the package ap6xxx-aml with this driver.

Any such problems are hard to resolve without physical testing from devs itself. If you get to some direct solution I’m sure it could be included in CE. Until then … we can’t help much.

You could try to adjust this package to use your version bcmdhd.100.10.315.x if there would be any difference.

1 Like

Thank you very much, I’ll try it

I’m, trying to build the image for EmuELEC, but it displays this error and I can’t figure out how to solve it

Here are the logs:

stderr
stdout

I’ll appreciate if you could help me

You can try to change in file packages/addons/addon-depends/jre-depends/apache-ant/package.mk

PKG_VERSION="1.10.11"
PKG_SHA256="baa049855cdecbefa62539555824058e52412e5ebe8f102e1db944cb762e06d9"

Hi,
I’ve tried it, but has the same problem

Does it could be due to I forked from and old version of EmuELEC ?
I must say that I needed to replace this packages with the newer ones from the latest version:
SDL_Sound
Physfs
Duckstation

Here is my repo

Logs:
stderr
stdout

Why the h*** you are using some old version and then ask for help? Use the current one and then ask if there is some trouble with a package. We all have then already downloaded and doesn’t spot such issues.

Also don’t post images of the screen but instead use text copy/paste.

And the file https://archive.apache.org/dist/ant/source/apache-ant-1.10.7-src.tar.xz is downloaded fine here. Also 1.10.11 version. Ignore what I wrote above for changing version. Seems there are some issues only on your side.

Hello,
Please forgive me,
I’ve forked the latest version of EmuELEC and downloaded the latest Ubuntu for making the image, however, I still have the same problems :confused: I can’t pair 2 ps3 bt controllers at once.

Can you please check if I implemented well the drivers ? My fork of ap6xxx-aml

Thanks

I think your changes in ap6xxx-aml driver are not build because you also need to change version:

PKG_VERSION="571850de0e95c3a94c1f4350286d53d484248855"
PKG_SHA256=""

You should see driver version used with dmesg command

dmesg | grep dhd

Hi, here is the output, but i can’t see any number related to the package version, can you help me ?

[    0.986258] <6>[    0.986258@3] aml_wifi wifi: [wifi_dev_probe] dhd_static_buf setup
[    0.986272] <6>[    0.986272@3] Wifi: bcmdhd_init_wlan_mem: bcmdhd_init_wlan_mem(): 100.10.545.3
[    0.987300] <6>[    0.987300@3] Wifi: bcmdhd_init_wlan_mem: bcmdhd_init_wlan_mem prealloc ok
[   11.973941] <4>[   11.973941@2] dhd_module_init: in Dongle Host Driver, version 100.10.545.5 (r826445-20190922-1) (amlogic-20191015-3)
[   11.979030] <4>[   11.979030@2] ======== dhd_wlan_init_plat_data ========
[   11.984090] <4>[   11.984090@2] dhd_wlan_init_gpio: WL_HOST_WAKE=-1, oob_irq=79, oob_irq_flags=0x418
[   11.991741] <4>[   11.991741@2] dhd_wlan_init_gpio: WL_REG_ON=-1
[   11.996121] <4>[   11.996121@2] dhd_wifi_platform_load: Enter
[   13.048104] <6>[   13.048104@3] Wifi: bcmdhd_mem_prealloc: sectoin 3, size 139264
[   13.057980] <6>[   13.057980@3] Wifi: bcmdhd_mem_prealloc: sectoin 4, size 0
[   13.073112] <4>[   13.073112@3] dhdsdio_probe : no mutex held. set lock
[   13.097078] <6>[   13.097078@3] Wifi: bcmdhd_mem_prealloc: sectoin 7, size 25064
[   13.102811] <3>[   13.102811@3] [dhd] dhd_conf_set_chiprev : chip=0x4354, chiprev=1
[   13.108877] <6>[   13.108877@3] Wifi: bcmdhd_mem_prealloc: sectoin 0, size 10320
[   13.115463] <6>[   13.115463@3] Wifi: bcmdhd_mem_prealloc: sectoin 5, size 65536
[   13.120950] <6>[   13.120950@3] [dhd] CFG80211-ERROR) wl_cfg80211_netdev_notifier_call : wdev null. Do nothing
[   13.128891] <6>[   13.128891@3] [dhd] CFG80211-ERROR) wl_cfg80211_netdev_notifier_call : wdev null. Do nothing
[   13.137282] <6>[   13.137282@3] [dhd] CFG80211-ERROR) wl_cfg80211_netdev_notifier_call : wdev null. Do nothing
[   13.145689] <6>[   13.145689@3] [dhd] CFG80211-ERROR) wl_cfg80211_netdev_notifier_call : wdev null. Do nothing
[   13.154115] <6>[   13.154115@3] [dhd] CFG80211-ERROR) wl_cfg80211_netdev_notifier_call : wdev null. Do nothing
[   13.162502] <6>[   13.162502@3] [dhd] CFG80211-ERROR) wl_cfg80211_netdev_notifier_call : wdev null. Do nothing
[   13.170906] <6>[   13.170906@3] [dhd] CFG80211-ERROR) wl_cfg80211_netdev_notifier_call : wdev null. Do nothing
[   13.179315] <6>[   13.179315@3] [dhd] CFG80211-ERROR) wl_cfg80211_netdev_notifier_call : wdev null. Do nothing
[   13.187922] <6>[   13.187922@3] Wifi: bcmdhd_mem_prealloc: sectoin 19, size 65652
[   13.193649] <6>[   13.193649@3] Wifi: bcmdhd_mem_prealloc: sectoin 20, size 262144
[   13.199640] <6>[   13.199640@3] Wifi: bcmdhd_mem_prealloc: sectoin 22, size 65536
[   13.205494] <4>[   13.205494@3] dhd_log_dump_init: kernel log buf size = 512KB; logdump_prsrv_tailsize = 80KB; limit prsrv tail size to = 76KB
[   13.216651] <4>[   13.216651@3] dhd_log_dump_init : Try to allocate memory total(4194304) special(8192)
[   13.224470] <6>[   13.224470@3] Wifi: bcmdhd_mem_prealloc: sectoin 15, size 4194304
[   13.231275] <6>[   13.231275@3] Wifi: bcmdhd_mem_prealloc: sectoin 16, size 8192
[   13.236639] <4>[   13.236639@3] dhd_attach(): thread:dhd_watchdog_thread:d70 started
[   13.242606] <4>[   13.242606@3] dhd_attach(): thread:dhd_dpc:d71 started
[   13.247808] <4>[   13.247808@3] dhd_attach(): thread:dhd_rxf:d72 started
[   13.252723] <4>[   13.252723@3] dhd_deferred_work_init: work queue initialized
[   13.258353] <4>[   13.258353@3] dhd_tcpack_suppress_set: TCP ACK Suppress mode 0 -> mode 2
[   13.273624] <4>[   13.273624@3] dhd_get_memdump_info: MEMDUMP ENABLED = 3
[   13.278810] <6>[   13.278810@3] Wifi: bcmdhd_mem_prealloc: sectoin 1, size 10300
[   13.284622] <6>[   13.284622@3] Wifi: bcmdhd_mem_prealloc: sectoin 2, size 65536
[   13.290515] <4>[   13.290515@3] dhdsdio_probe_init: making DHD_BUS_DOWN
[   13.330129] <4>[   13.330129@3] dhd_dbg_detach_pkt_monitor, 2099
[   13.334454] <4>[   13.334454@3] dhd_bus_devreset: == Power OFF ==
[   13.339374] <4>[   13.339374@3] dhd_bus_stop: making DHD_BUS_DOWN
[   13.353856] <4>[   13.353856@3] dhd_bus_devreset: making dhdpub up FALSE
[   13.358964] <4>[   13.358964@3] dhd_txglom_enable: enable 0
[   13.362945] <4>[   13.362945@3] dhd_bus_devreset: making DHD_BUS_DOWN
[   13.367787] <4>[   13.367787@3] dhd_bus_devreset:  WLAN OFF DONE
[   13.382734] <4>[   13.382734@3] dhd_ifname: ifidx 16 out of range
[   13.391785] <4>[   13.391785@3] dhd_ifname: ifidx 16 out of range
[   13.396295] <4>[   13.396295@3] dhd_register_if: _dhd_set_mac_address() failed
[   13.409595] <4>[   13.409595@3] dhdsdio_probe : the lock is released.
[   13.414680] <4>[   13.414680@3] dhd_module_init: Exit err=0
[   18.562750] <6>[   18.562750@3] [dhd] CFG80211-ERROR) wl_cfg80211_netdev_notifier_call : wdev null. Do nothing
[   18.660731] <6>[   18.660731@0] [dhd] CFG80211-ERROR) wl_cfg80211_netdev_notifier_call : wdev null. Do nothing
[   18.668847] <6>[   18.668847@3] [dhd] CFG80211-ERROR) wl_cfg80211_netdev_notifier_call : wdev null. Do nothing
[   19.620627] <4>[   19.620627@2] dhd_open: Enter wlan0
[   19.620663] <4>[   19.620663@2] dhd_open : no mutex held. set lock
[   19.633707] <3>[   19.633707@2] [dhd-wlan0] wl_android_wifi_on : in g_wifi_on=0
[   20.837148] <4>[   20.837148@2] dhd_bus_devreset: == Power ON ==
[   20.868001] <4>[   20.868001@3] dhd_bus_devreset: making DHD_BUS_DOWN
[   20.873342] <4>[   20.873342@3] dhdsdio_probe_init: making DHD_BUS_DOWN
[   20.879241] <4>[   20.879241@3] dhd_os_open_image1: /vendor/etc/wifi/buildin/config.txt (102 bytes) open success
[   20.886986] <3>[   20.886986@3] [dhd] dhd_conf_read_sdio_params : dhd_slpauto = 0
[   20.892275] <3>[   20.892275@3] [dhd] dhd_conf_read_country_list : ccode = XS
[   20.898050] <3>[   20.898050@3] [dhd] dhd_conf_read_country_list : regrev = 0
[   20.903435] <3>[   20.903435@3] [dhd] dhd_conf_set_path_params : Final fw_path=/vendor/etc/wifi/buildin/fw_bcm4354a1_ag.bin
[   20.912926] <3>[   20.912926@3] [dhd] dhd_conf_set_path_params : Final nv_path=/vendor/etc/wifi/buildin/nvram_ap6354.txt
[   20.922137] <3>[   20.922137@3] [dhd] dhd_conf_set_path_params : Final clm_path=/vendor/etc/wifi/buildin/clm_bcm4354a1_ag.blob
[   20.932123] <3>[   20.932123@3] [dhd] dhd_conf_set_path_params : Final conf_path=/vendor/etc/wifi/buildin/config.txt
[   20.944426] <4>[   20.944426@1] dhd_os_open_image1: /vendor/etc/wifi/buildin/fw_bcm4354a1_ag.bin (654038 bytes) open success
[   21.136000] <4>[   21.136000@3] dhd_os_open_image1: /vendor/etc/wifi/buildin/nvram_ap6354.txt (3043 bytes) open success
[   21.145992] <4>[   21.145992@3] dhdsdio_write_vars: Download, Upload and compare of NVRAM succeeded.
[   21.196276] <4>[   21.196276@2] dhd_bus_init: enable 0x06, ready 0x06 (waited 0us)
[   21.211363] <4>[   21.211363@2] dhd_get_memdump_info: MEMDUMP ENABLED = 3
[   21.217207] <4>[   21.217207@2] dhd_tcpack_suppress_set: TCP ACK Suppress mode 2 -> mode 1
[   21.227745] <4>[   21.227745@2] dhd_apply_default_clm: Ignore clm file /vendor/etc/wifi/buildin/clm_bcm4354a1_ag.blob
[   21.245996] <4>[   21.245996@2] dhd_preinit_ioctls: event_log_max_sets: 26 ret: -23
[   21.274081] <4>[   21.274081@3] dhd_preinit_ioctls failed -23
[   21.277634] <4>[   21.277634@0] dhd_txglom_enable: enable 1
[   21.281187] <3>[   21.281187@0] [dhd] dhd_conf_set_txglom_params : txglom_mode=copy
[   21.287964] <3>[   21.287964@0] [dhd] dhd_conf_set_txglom_params : txglomsize=36, deferred_tx_len=0
[   21.294850] <3>[   21.294850@0] [dhd] dhd_conf_set_txglom_params : txinrx_thres=128, dhd_txminmax=-1
[   21.302851] <3>[   21.302851@0] [dhd] dhd_conf_set_txglom_params : tx_max_offset=0, txctl_tmo_fix=300
[   21.310042] <3>[   21.310042@0] [dhd] dhd_conf_get_disable_proptx : fw_proptx=1, disable_proptx=-1
[   21.318629] <4>[   21.318629@3] dhd_wlfc_hostreorder_init(): successful bdcv2 tlv signaling, 64
[   21.325839] <4>[   21.325839@3] dhd_pno_init: Support Android Location Service
[   21.366160] <4>[   21.366160@3] dhd_rtt_init : FTM is not supported
[   21.366603] <4>[   21.366603@3] dhd_rtt_ftm_config : failed to set config
[   21.385001] <4>[   21.385001@1] dhd_preinit_ioctls: Failed to get preserve log # !
[   21.385752] <3>[   21.385752@0] [dhd] dhd_conf_set_country : set country XS, revision 0
[   21.394968] <3>[   21.394968@2] [dhd] dhd_conf_set_country : Country code: XS (XS/0)
[   21.403009] <3>[   21.403009@2] [dhd-wlan0] wl_android_wifi_on : Success
[   21.473269] <4>[   21.473269@3] dhd_open : the lock is released.
[   21.473304] <4>[   21.473304@3] dhd_open: Exit wlan0 ret=0
[   21.683084] <4>[   21.683084@2] dhd_dbg_set_event_log_tag set log tag iovar failed -23
[   21.685287] <4>[   21.685287@3] dhd_dbg_set_event_log_tag set log tag iovar failed -23
[   21.691534] <4>[   21.691534@0] dhd_dbg_set_event_log_tag set log tag iovar failed -23
[   21.698149] <4>[   21.698149@2] dhd_dbg_set_event_log_tag set log tag iovar failed -23
[   21.705437] <4>[   21.705437@3] dhd_dbg_set_event_log_tag set log tag iovar failed -23
[   21.710909] <4>[   21.710909@3] dhd_dbg_set_event_log_tag set log tag iovar failed -23
[   21.716824] <4>[   21.716824@0] dhd_dbg_set_event_log_tag set log tag iovar failed -23
[   21.723854] <4>[   21.723854@3] dhd_dbg_set_event_log_tag set log tag iovar failed -23
[   21.729512] <4>[   21.729512@0] dhd_dbg_set_event_log_tag set log tag iovar failed -23
[   21.736060] <4>[   21.736060@3] dhd_dbg_set_event_log_tag set log tag iovar failed -23
[   21.742089] <4>[   21.742089@2] dhd_dbg_set_event_log_tag set log tag iovar failed -23
[   21.748336] <4>[   21.748336@2] dhd_dbg_set_event_log_tag set log tag iovar failed -23
[   21.754926] <4>[   21.754926@2] dhd_dbg_set_event_log_tag set log tag iovar failed -23
[   21.762768] <4>[   21.762768@2] dhd_dbg_set_event_log_tag set log tag iovar failed -23
[   21.767413] <4>[   21.767413@2] dhd_dbg_set_event_log_tag set log tag iovar failed -23
[   21.773725] <4>[   21.773725@2] dhd_dbg_set_event_log_tag set log tag iovar failed -23
[   21.780016] <4>[   21.780016@2] dhd_dbg_set_event_log_tag set log tag iovar failed -23
[   21.786498] <4>[   21.786498@2] dhd_dbg_set_event_log_tag set log tag iovar failed -23
[   21.792729] <4>[   21.792729@2] dhd_dbg_set_event_log_tag set log tag iovar failed -23
[   21.799103] <4>[   21.799103@2] dhd_dbg_set_event_log_tag set log tag iovar failed -23
[   21.805298] <4>[   21.805298@2] dhd_dbg_set_event_log_tag set log tag iovar failed -23
[   21.811659] <4>[   21.811659@2] dhd_dbg_set_event_log_tag set log tag iovar failed -23
[   21.818014] <4>[   21.818014@2] dhd_dbg_set_event_log_tag set log tag iovar failed -23
[   21.824664] <4>[   21.824664@0] dhd_dbg_set_event_log_tag set log tag iovar failed -23
[   21.830994] <4>[   21.830994@3] dhd_dbg_set_event_log_tag set log tag iovar failed -23
[   21.837248] <4>[   21.837248@0] dhd_dbg_set_event_log_tag set log tag iovar failed -23
[   21.845470] <4>[   21.845470@3] dhd_dbg_attach_pkt_monitor, 1501
[   32.205630] <3>[   32.205630@3] [dhd-wlan0] wl_run_escan : LEGACY_SCAN sync ID: 0, bssidx: 0
[   38.967184] <6>[   38.967184@1] [dhd] CFG80211-ERROR) wl_set_wsec_info_algos : wsec_info error (-23)
[   38.971274] <6>[   38.971274@1] [dhd] CFG80211-ERROR) wl_set_set_cipher : set wsec_info error (0)
[   38.989595] <3>[   38.989595@3] [dhd-wlan0] wl_cfg80211_connect : Connecting with 94:8f:cf:98:8c:0d ssid "Chikungunya_house", len (17), sec=wpa2psk/aes, channel=11
[   39.035864] <4>[   39.035864@3] dhd_dbg_start_pkt_monitor, 1621
[   39.035900] <4>[   39.035900@3] __dhd_dbg_free_tx_pkts, 1412
[   39.038658] <4>[   39.038658@3] __dhd_dbg_free_rx_pkts, 1431
[   39.099461] <3>[   39.099461@2] [dhd-wlan0] wl_iw_event : Link UP with 94:8f:cf:98:8c:0d
[   39.100488] <3>[   39.100488@2] [dhd-wlan0] wl_ext_iapsta_event : [S] Link UP with 94:8f:cf:98:8c:0d
[   39.111738] <3>[   39.111738@3] [dhd-wlan0] wl_bss_connect_done : Report connect result - connection succeeded
[   39.205047] <3>[   39.205047@2] [dhd-wlan0] wl_add_keyext : key index (0)
[   39.214410] <6>[   39.214410@1] [dhd] CFG80211-ERROR) wl_set_wsec_info_algos : wsec_info error (-23)
[   39.224926] <6>[   39.224926@2] [dhd] CFG80211-ERROR) wl_set_wsec_info_algos : wsec_info error (-23)
[   39.266978] <4>[   39.266978@2] dhd_dev_apf_get_version: firmware doesn't support APF
[   39.267627] <4>[   39.267627@2] dhd_dev_apf_get_max_len: firmware doesn't support APF
[   52.239606] <3>[   52.239606@3] [dhd-wlan0] wl_run_escan : LEGACY_SCAN sync ID: 1, bssidx: 0
[   78.968836] <3>[   78.968836@2] [dhd-wlan0] wl_run_escan : LEGACY_SCAN sync ID: 2, bssidx: 0
[   96.970053] <4>[   96.970053@3] dhd_dbg_monitor_get_tx_pkts, 1913
[   96.970109] <4>[   96.970109@3] dhd_dbg_monitor_get_tx_pkts(): no tx_status in tx completion messages, make sure that 'd11status' is enabled in firmware, status_pos=0
[   96.986101] <4>[   96.986101@0] dhd_dbg_monitor_get_rx_pkts, 2010
[  120.074820] <3>[  120.074820@3] [dhd-wlan0] wl_run_escan : LEGACY_SCAN sync ID: 3, bssidx: 0
[  215.180224] <3>[  215.180224@2] [dhd-wlan0] wl_run_escan : LEGACY_SCAN sync ID: 4, bssidx: 0
[  375.185916] <3>[  375.185916@2] [dhd-wlan0] wl_run_escan : LEGACY_SCAN sync ID: 5, bssidx: 0
[  615.302235] <3>[  615.302235@1] [dhd-wlan0] wl_run_escan : LEGACY_SCAN sync ID: 6, bssidx: 0
[  775.303369] <3>[  775.303369@3] [dhd-wlan0] wl_run_escan : LEGACY_SCAN sync ID: 7, bssidx: 0
[  935.287854] <3>[  935.287854@3] [dhd-wlan0] wl_run_escan : LEGACY_SCAN sync ID: 8, bssidx: 0
dhd_module_init: in Dongle Host Driver, version 100.10.545.5 (r826445-20190922-1) (amlogic-20191015-3)

How does it looks ?

I need to say that the driver my vendor gives me is the bcmdhd.100.10.315.x which not corresponds to the 100.10.545.5 driver version outputed in dmesg

As I wrote you need to change PKG_VERSION with a commit points to your version. Now it is still used from what EmuELEC has in.

Sorry, I was doing some changes to test several variables, could you check this sintaxis and see if it’s correct?

# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2017-2018 Team LibreELEC (https://libreelec.tv)
# Copyright (C) 2018-present Team CoreELEC (https://coreelec.org)

PKG_NAME="ap6xxx-aml"
PKG_VERSION="100.10.545.5"
PKG_SHA256=""
PKG_ARCH="arm aarch64"
PKG_LICENSE="GPL"
PKG_SITE="https://github.com/kevinrivm/ap6xxx-aml"
PKG_URL="https://github.com/kevinrivm/ap6xxx-aml/archive/$PKG_VERSION.tar.gz"
PKG_DEPENDS_TARGET="toolchain linux"
PKG_NEED_UNPACK="$LINUX_DEPENDS"
PKG_LONGDESC="ap6xxx: Linux drivers for AP6xxx WLAN chips used in some devices based on Amlogic SoCs"
PKG_IS_KERNEL_PKG="yes"
PKG_TOOLCHAIN="manual"

pre_make_target() {
  unset LDFLAGS
}

make_target() {
  echo
  echo "building ap6356s and others"
  make -C  $PKG_BUILD/bcmdhd.1.363.59.144.x.cn \
       PWD=$PKG_BUILD/bcmdhd.1.363.59.144.x.cn \
       KDIR=$(kernel_path) \
       ARCH=$TARGET_KERNEL_ARCH \
       CROSS_COMPILE=$TARGET_KERNEL_PREFIX \
       CONFIG_BCMDHD_DISABLE_WOWLAN=y \
       dhd

  if [ "$PROJECT" = "Amlogic-ng" ]; then
    echo
    echo "building ap6275s"
    make -C  $PKG_BUILD/bcmdhd.100.10.315.x \
         PWD=$PKG_BUILD/bcmdhd.100.10.315.x \
         KDIR=$(kernel_path) \
         ARCH=$TARGET_KERNEL_ARCH \
         CROSS_COMPILE=$TARGET_KERNEL_PREFIX \
         CONFIG_BCMDHD_DISABLE_WOWLAN=y \
         bcmdhd_sdio
  fi
}

makeinstall_target() {
  mkdir -p $INSTALL/$(get_full_module_dir)/$PKG_NAME

  find $PKG_BUILD/ -name \*.ko -not -path '*/\.*' \
    -exec cp {} $INSTALL/$(get_full_module_dir)/$PKG_NAME \;
}

post_install() {
  if [ "$PROJECT" = "Amlogic" ]; then
    rm $INSTALL/usr/lib/modprobe.d/dhd_sdio.conf
    rm $INSTALL/usr/lib/udev/rules.d/80-dhd_sdio.rules
  fi
}

I already wrote PKG_VERSION above.

1 Like

Hello @vpeter

Thanks for your help, but I still have the same problem with this sintaxis

# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2017-2018 Team LibreELEC (https://libreelec.tv)
# Copyright (C) 2018-present Team CoreELEC (https://coreelec.org)

PKG_NAME="ap6xxx-aml"
PKG_VERSION="571850de0e95c3a94c1f4350286d53d484248855"
PKG_SHA256=""
PKG_ARCH="arm aarch64"
PKG_LICENSE="GPL"
PKG_SITE="https://github.com/kevinrivm/ap6xxx-aml"
PKG_URL="https://github.com/kevinrivm/ap6xxx-aml/archive/$PKG_VERSION.tar.gz"
PKG_DEPENDS_TARGET="toolchain linux"
PKG_NEED_UNPACK="$LINUX_DEPENDS"
PKG_LONGDESC="ap6xxx: Linux drivers for AP6xxx WLAN chips used in some devices based on Amlogic SoCs"
PKG_IS_KERNEL_PKG="yes"
PKG_TOOLCHAIN="manual"

pre_make_target() {
  unset LDFLAGS
}

make_target() {
  echo
  echo "building ap6356s and others"
  make -C  $PKG_BUILD/bcmdhd.1.363.59.144.x.cn \
       PWD=$PKG_BUILD/bcmdhd.1.363.59.144.x.cn \
       KDIR=$(kernel_path) \
       ARCH=$TARGET_KERNEL_ARCH \
       CROSS_COMPILE=$TARGET_KERNEL_PREFIX \
       CONFIG_BCMDHD_DISABLE_WOWLAN=y \
       dhd

  if [ "$PROJECT" = "Amlogic-ng" ]; then
    echo
    echo "building ap6275s"
    make -C  $PKG_BUILD/bcmdhd.100.10.315.x \
         PWD=$PKG_BUILD/bcmdhd.100.10.315.x \
         KDIR=$(kernel_path) \
         ARCH=$TARGET_KERNEL_ARCH \
         CROSS_COMPILE=$TARGET_KERNEL_PREFIX \
         CONFIG_BCMDHD_DISABLE_WOWLAN=y \
         bcmdhd_sdio
  fi
}

makeinstall_target() {
  mkdir -p $INSTALL/$(get_full_module_dir)/$PKG_NAME

  find $PKG_BUILD/ -name \*.ko -not -path '*/\.*' \
    -exec cp {} $INSTALL/$(get_full_module_dir)/$PKG_NAME \;
}

post_install() {
  if [ "$PROJECT" = "Amlogic" ]; then
    rm $INSTALL/usr/lib/modprobe.d/dhd_sdio.conf
    rm $INSTALL/usr/lib/udev/rules.d/80-dhd_sdio.rules
  fi
}


Here are the logs

Also, I spent this time trying to comparing the drivers from the stock system with the ones on EmuELEC (or CoreELEC), I notice two things

  1. In dmesg | grep dhd of EmuELEC it loads a different driver in this line
[    6.868034@1] dhd_module_init: in Dongle Host Driver, version 1.363.59.144.10 (r)

Than the

[   10.808428] <4>[   10.808428@1] dhd_module_init: in Dongle Host Driver, version 100.10.545.5 (r826445-20190922-1) (amlogic-20191015-3)

From the stock system, see the complete dmesg logs here
Stock sys
Emuelec

Is it possible that EmuELEC and CE are loading wrong drivers?

  1. In stock system there are a folder in /vendor/etc/bluetooth containing this files

So maybe there is some missing configuration files in EmuELEC that are causing to not loading bluetooth device by default as it happened with the fw_bcm4354a1_ag.bin, nvram_ap6354.txt, config.txt that halogen’s blog said need to be added in /storage/.config/firmware/brcm/

Also, I’ve adb pull the /vendor/etc/ files from stock system in case it helps

Also 2, the

uname -r

Shows

4.9.113

In the stock system, same as EmuELEC, CoreELEC

Hello,

I’m having issues pairing bt controllers in CE 9.2.8 in a TV Box x96Max_plus2_T which include the am7256 wifi/bluetooth chip.

I’ve notice a difference in

dmesg | grep dhd

Logs between android stock system (Android 9) and CoreElec’s

The 4th line shows different driver version

Stock

[ 10.808428] <4>[ 10.808428@1] dhd_module_init: in Dongle Host Driver, version 100.10.545.5

CE

[ 6.868034@1] dhd_module_init: in Dongle Host Driver, version 1.363.59.144.10 (r)

Is that the cause of the bluetooth bad behaviour?

How can I change the project in order to fix it?

Thanks

@kevinrivm please do not open again multiple posts!

You need to patch correct SDIO_DEVICE in the source.
Otherwise you have wrong udev rules and the wrong driver is loaded.
Or you make your own udev rules what do have priority over the implemented.

Take a look here (again):

Sorry if this doesn’t improve the conversation but I have the same box as Kevin. I have no wifi or bluetooth in EmuELEC so really hoping this can be sorted out! Thanks to everybody for their efforts. :slight_smile: