cubieplayer / Cubian

Debian for Cubieboard
http://cubian.org
270 stars 49 forks source link

Cubian X bluetooth can not enable. #369

Open nocolour opened 9 years ago

nocolour commented 9 years ago

I fail to enable the bluetooth. I install the bluez apps from apt-get. bluetooth manaager (blueman) search function not working. I believe the bluetooth module not work. I refer to cubietruck lubuntu bluetooth setup guide, it not working on cubian X. "brcm_patchram_plus" can not find in cubian X. Any easy way to make bluetooth working? Thanks..

michalliu commented 9 years ago

Here is a tutorial https://github.com/cubieplayer/Cubian/issues/314 This should be the builtin feature. Damn, I forgot it.

michalliu commented 9 years ago

You can update your kernel through apt, and follow #314, You will get bluetooth work on cubietruck tested by myself.

nocolour commented 9 years ago

I try follow the tutorial in #314 Bluetooth still not working can not detect any bluetooth device. I tested with aRuntu v1.001 (lubuntu) it's working by using brcm_patchram_plus. I think have to format the sd and try again. Hope the new version of Cubian X can solve this bug. Thanks a lot!

nocolour commented 9 years ago

My current kernel is 3.4.79 cubian x1 desktop... any latest version for cubian cubietruck? Cubieez and aRUNTU latest version is 3.4.103 and 3.4.94 ++. cubian-update it is suitable for cubietruck? I just need the stable kernel and all hardware function working well only.

michalliu commented 9 years ago

I can make sure it's working. You need to upgrade your kernel through apt, the preinstalled kernel is missing hci_uart . You need install latest kernel linux-3.4.79-sun7i 4cubian. Then follow the tutorial. Anyway, I will provide a simple script the enable bluetooth soon.

nocolour commented 9 years ago

I upgrade the kernel to 3.4.79-sun7i 4cubian, than try follow the tutorial #314 and http://www.mdrose.de/Links_Cubie.htm#load-BT-Firmware. But still not working. see bellow for detail:

sudo apt-get update sudo apt-get install libbluetooth3 libbluetooth-dev bluez sudo apt-get upgrade linux-image-3.4.79-sun7i (4cubian)

root@Cubian:/usr/local/bin# uname -a Linux Cubian 3.4.79-sun7i #19 SMP PREEMPT Fri Oct 10 03:20:03 CST 2014 armv7l GNU/Linux

root@Cubian:/home/cubie# dmesg | grep _16550 [ 1.579105] sunxi-uart.0: ttyS0 at MMIO 0x1c28000 (irq = 33) is a U6_16550A [ 1.612736] sunxi-uart.2: ttyS1 at MMIO 0x1c28800 (irq = 35) is a U6_16550A

root@Cubian:/usr/local/bin# lsmod Module Size Used by disp_ump 854 0 mali_drm 2638 1 drm 213882 2 mali_drm cpufreq_fantasy 3855 0 cpufreq_conservative 5720 0 cpufreq_powersave 1242 0 cpufreq_userspace 3532 0 nfsd 223745 2 exportfs 3615 1 nfsd hidp 17640 0 hci_uart 24892 0 bnep 14422 2 rfcomm 58826 0 bluetooth 265030 12 bnep,hidp,hci_uart,rfcomm bcmdhd 540934 0 sunxi_cedar_mod 10524 0 mali 113927 0 ump 57103 4 mali,disp_ump gpio_sunxi 9258 2

root@Cubian:/usr/local/bin# brcm_patchram_plus -d --patchram /lib/firmware/ap6210/bcm20710a1.hcd --enable_hci --bd_addr 11:22:33:44:55:66 --no2bytes --tosleep 1000 /dev/ttyS1 any option patchram with arg /lib/firmware/ap6210/bcm20710a1.hcd option enable_hci option bd_addr with arg 11:22:33:44:55:66 option no2bytes option tosleep with arg 1000 /dev/ttyS1 writing 01 03 0c 00 writing 01 03 0c 00 writing 01 03 0c 00 \ keep continue writing 01 03 0c 00

root@Cubian:/home/cubie# hcitool dev Devices: root@Cubian:/home/cubie#

device show nothing!

root@Cubian:/etc/init.d# service brcm40183-patch start [FAIL] Start pushing firmware to device and waiting max. 60sec to complete...failed.

Modules all loaded! Any command can show the bluetooth is working or not?

Anything wrong? any debian command or tools to test the bluetooth, tested with android no problem. hardware should be fine!

Thanks!

michalliu commented 9 years ago

Did you do echo -n "" > /dev/ttyS1?

nocolour commented 9 years ago

Finally my Bluetooth working ready! Bellow is my sharing, hope can help others. michalliu Thanks for your help and respond. I love Cubian!

Bellow step I try more than 3 time and confirm working for Cubian X1 Desktop and lubuntu. FOR CUBIETRUCK ONLY!

1.)Upgrade the kernel to latest version with hci_uart support.

sudo apt-get update sudo apt-get upgrade linux-image-3.4.79-sun7i **Make sure is linux-image-3.4.79-sun7i 3.4.79-4cubian or above.

2.)Install requirement app.

sudo apt-get install libbluetooth3 libbluetooth-dev sudo apt-get install bluez blueman sudo apt-get install git-core

3.)Adding the related modules to /etc/modules.

bluetooth

rfcomm bnep hci_uart bluetooth hidp

4)Reboot with totally power off. let's the kernel and added modules working.

sudo shutdown -h now \ remove the power source for 10 second and reconnect power!

5.)Check your kernel & modules status

sudo uname -a

You should see this: Linux Cubian 3.4.79-sun7i #19 SMP PREEMPT Fri Oct 10 03:20:03 CST 2014 armv7l GNU/Linux

sudo lsmod

you must see this, to make sure the module are loaded:

Module Size Used by hidp 17640 0 hci_uart 24892 1 bnep 14422 2 rfcomm 58826 14 bluetooth 265030 25 bnep,hidp,hci_uart,rfcomm

6.)Download the bluetooth script (brcm_patchram_plus and brcm40183-patch).

cd /home/cubie git clone https://github.com/kdeenkhoorn/cubietruck-scripts.git ./bt cp /home/cubie/bt/bluetooth/usr/local/bin/brcm_patchram_plus /usr/local/bin chmod 755 /usr/local/bin/brcm_patchram_plus cp /home/cubie/bt/bluetooth/etc/init.d/brcm40183-patch /etc/init.d chmod 755 /etc/init.d/brcm40183-patch cp /home/cubie/bt/bluetooth/etc/default/brcm40183 /etc/default chmod 755 /etc/default/brcm40183 update-rc.d -f brcm40183-patch defaults

7.)reboot

8.)Verify your bluetooth status & troubleshooting!!

sudo hcitool dev

**make sure you see "hci0 xx:xx:xx:xx:xx:xx" like bellow.

Devices: hci0 43:29:B1:55:01:01

DNS issue and kernel issue can cause the brcm_patchram_plus and brcm40183-patch not work!

9.) /etc/init.d/brcm40183-patch start

[ ok ] brcm40183 device allready initialized...done. Devices: hci0 43:29:B1:55:01:01

This two command will let's u know the bluetooth working or fail.

sudo hcitool dev /etc/init.d/brcm40183-patch start

Try your bluetooth Manager (blueman) Menu > system > preferences > Bluetooth Manager

**If your bluetooth working, you must able to click the search button!

Thanks! for : michalliu kdeenkhoorn http://www.mdrose.de/Links_Cubie.htm#load-BT-Firmware

it-slav commented 9 years ago

Thanks for the very good tutorial. I followed the steps above and it seems to work at the begining.

I try to connect my bluetooth keyboard but still have some problems: run the Menu > system > preferences > Bluetooth Manager and I search for my keyboard. It finds it. I push setup Choose input device And then it crashes

Reboot and starting blueman-manager from command line it throw tons of messages but at the end: Generate (/usr/lib/python2.7/dist-packages/blueman/gui/manager/ManagerDeviceMenu.py:230) Bluetooth 3.0 Macro Keyboard monitor_power_levels (/usr/lib/python2.7/dist-packages/blueman/gui/DeviceList.py:214) starting monitor * glibc detected * /usr/bin/python: free(): invalid next size (fast): 0x017a2dc0 *** Aborted

When trying again it complains about "Connection to BlueZ failed"

I have used the keyboard to several laptops and Android devices so I think it works.

Regards Peter