cubieplayer / Cubian

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

Enable Bluetooth on Cubietruck #314

Open kdeenkhoorn opened 10 years ago

kdeenkhoorn commented 10 years ago

Cubieplayer, Please add the module hci_uart to your kernel because it is needed for Bluetooth to run.

The following is tested: If the module is there add it with some others to /etc/module:

    # Bluetooth
    rfcomm
    bnep
    hci_uart
    bluetooth
    hidp

Then restart the cubietruck.

    shutdown -r now

Then do:

    apt-get install bluez

Then download from https://code.google.com/p/broadcom-bluetooth/ the sources of 'brcm_patchram_plus.c' and change the code and remove the wait loop:

    if (enable_hci) {
            proc_enable_hci();

            while (1) {
                    sleep(UINT_MAX);
            }
    }

so whats left will be:

    if (enable_hci) {
           proc_enable_hci();
    }

Don't know why the wait is there but i have asked a question at google code about it. Now you can wait for the answer on my question what's the impact of this hack or compile the program using make like i did. If you are missing some bluetooth libraries during compile do 'apt-get install libbluetooth3 libbluetooth-dev' in advance.

Then after compilation execute the following commands once after every reboot as root in this order:

    echo -n "" > /dev/ttyS1

This initial echo has to be done to open the ttyS1 line, else the first run of brcm_patchram_plus will fail.

    ./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
    hciattach /dev/ttyS1 any
    hcitool dev
    hciconfig -a
    hcitool scan

And now you're good to go.

Also look at: http://linux-sunxi.org/Cubietruck/Bluetooth and: http://archlinuxarm.org/forum/viewtopic.php?t=7253&p=39808#p39885

Probably the scripting mentioned in the last archlinuxarm.org link will work for cubian also but i have not tested that yet ... time is up for tonight. ;-)

kdeenkhoorn commented 10 years ago

Finally worked out a working script for enabling Bluetooth at boot time on the cubietruck. Sources and installation instructions can be found at: https://github.com/kdeenkhoorn/cubietruck-scripts/tree/master/bluetooth

cubieplayer commented 10 years ago

Thank you for sharing, I'ved added to my TODO list, act ASAP.

h0jeZvgoxFepBQ2C commented 10 years ago

Any eta when this will be available?

joetruck commented 9 years ago

Hello, http://linux-sunxi.org/Cubietruck/AP6210 Did someone tried already to implement this drivers in the kernel for Cubian? Iam not good enough in Linux to compile a KERNEL with patches yet. Would be a great help to get a ready patched 3.4.79 suni7 or a tutorial for newbies with a HOWTO. :-) Rds Joe