Contribute
Register

Enabling Bluetooth for P8P67 * boards and BT-211

Status
Not open for further replies.
Joined
Apr 21, 2011
Messages
79
Mac
Classic Mac
Mobile Phone
UPDATE Aug 17, 2011: Note that Apple Magic Mouse and Magic Trackpad are NOT WORKING with this fix (they freeze constantly, e.g. trackpad freezes on 4-finger swipe). If they happen to work with your setup, please report in this thread.
On the other hand, some other devices, including wireless keyboard, audio and phones has been reported to work ok. If you own Magic Mouse or Apple Trackpad, just buy Rocketfish Micro Bluetooth USB Adapter (RF-MRBTAD) that is confirmed to work.

UPDATE Jul 21, 2011: Confirmed to work with 10.7 Lion

UPDATE Apr 28, 2011: Firmware extracted from Windows drivers is available (see below in this post).



SYNOPSIS

This is a binary package to enable bluetooth on P8P67 boards and ASUS BT-211 usb dongles (sources are available below in this thread).

INSTALLATION

1) Download
2) Run terminal and change dir to your Downloads directory:

cd ~/Downloads

(No, you can't just click "install" script in Finder -- it requires to be run with sudo. If you click it, it will just exit.)

3) Unpack

tar zxf ath3k-firmware-uploader.tgz

4) Go to unpacked directory

cd ath3k-firmware-uploader

5) Install (will require admin rights)

sudo ./install

6) Shutdown, do power-off, power-on, and enjoy native bluetooth right from the start


This package installs to /Extra/ath3k-firmware-uploader, also it installs launchctl config to /System/Library/LaunchDaemons/local.ath3k-firmware-uploader.plist and registers it with launchctl.

Feedback and testing on other P8P67 modifications (Pro, Deluxe) is welcome. :)

FIRMWARE REVISIONS

The package has 2010-12-13 firmware revision from Linux, if it will ever be updated, it can be found here:
http://git.kernel.org/?p=linux%2Fkernel ... it&s=ath3k
(note that ath3k-2.fw is obsolete).

Also, ajg0r has reported that firmware extracted from Windows drivers (probably more recent) works better for him. You can download his package here:
viewtopic.php?p=118270#p118270
You can install one on top of another, and the last one installed will be used. Please note that you need cold reboot (switch off/on at PSU) in order for new firmware to be uploaded.
 

Attachments

  • ath3k-firmware-uploader.tgz
    184.4 KB · Views: 2,894
Joined
Apr 21, 2011
Messages
79
Mac
Classic Mac
Mobile Phone
Re: Enabling Bluetooth on P8P67

[Original topic head message]

Hi All,

Currently, Atheros 3010 bluetooth chip, which is soldered to one of the P8P67 [Vanilla, Pro, Deluxe, ...] USB ports doesn't work out of the box.

Though, Asus USB-BT211 dongle, which uses the same chipset, known to work well. The difference between the two is that P8P67's chip lacks flash memory where the firmware is stored, so it has to be uploaded by OS bluetooth driver before it can be used. This can be done by booting to another OS first.

So, there are currently the following workarounds:

1) Boot to Windows first, then restart to Mac OS X. This requires installing Bluetooth drivers from your P8P67 disk.

2) The same method works with Linux, but it has Atheros 3010 driver and firmware out-of-the-box (tried with Kubuntu 11.04, but should work with any modern Linux). You may even half-way boot from Ubuntu LiveCD.

3) Install Linux under VMWare Fusion, choose "Connect Atheros USB device" in the right bottom corner. The Linux will upload the firmware, and device will appear as "ASUSTek Bluetooth Host Controller". Then, you can disconnect it from VMWare, run System Preferences -> Bluetooth, and disable/enable "Show Bluetooth status in the menu bar".

After that Bluetooth will work in Mac OS until next power off.

===========

I decided to move the discussion from http://www.tonymacx86.com/viewtopic.php?p=117039#p117039 into separate thread.

The fact that Bluetooth chip works under Linux actually means that we can create a small Linux partition with just kernel and Bluetooth firmware, that will immediately restart into Os X. I'm just not sure how to get Andy Boot loader and grub working together... Well, i guess we can install grub on top of Andy's boot loader, but then there's a problem how to make grub interleave Linux with Mac OS on each other boot...
And, even better way -- grab firmware from Linux and put it into kext.
What people think?

AndyStubbs said:
drcrack said:
And, even better way -- grab firmware from Linux and put it into kext.
What people think? ;)

That would be the best way to do it if possible.

Ok. I ran ioreg with disabled and enabled (with windows boot) bluetooth.

Disabled:
Code:
 VendorSpecificDevice@1d170000  <class IOUSBDevice, id 0x100000259, registered, matched, active, busy 0 (39 ms), retain 6>

Enabled:
Code:
    | |   |   +-o WirelessControllerDevice@1d170000  <class IOUSBDevice, id 0x10000026a, registered, matched, active, busy 0 (9029 ms), retain 9>
    | |   |     +-o AppleUSBBluetoothHCIController  <class AppleUSBBluetoothHCIController, id 0x10000026c, registered, matched, active, busy 0 (8820 ms), r$
    | |   |     | +-o IOBluetoothHCIUserClient  <class IOBluetoothHCIUserClient, id 0x100000274, !registered, !matched, active, busy 0, retain 5>
    | |   |     | +-o IOBluetoothDevice  <class IOBluetoothDevice, id 0x1000002c5, registered, matched, active, busy 0 (8820 ms), retain 10>
    | |   |     | | +-o IOBluetoothL2CAPSignalChannel  <class IOBluetoothL2CAPSignalChannel, id 0x1000002c6, registered, matched, active, busy 0 (1 ms), re$
    | |   |     | | +-o IOBluetoothDeviceUserClient  <class IOBluetoothDeviceUserClient, id 0x1000002ca, !registered, !matched, active, busy 0, retain 5>
    | |   |     | | +-o IOBluetoothL2CAPChannel  <class IOBluetoothL2CAPChannel, id 0x1000002cb, registered, matched, active, busy 0 (8819 ms), retain 6>
    | |   |     | | | +-o BNBMouseDevice  <class BNBMouseDevice, id 0x1000002da, registered, matched, active, busy 0 (5001 ms), retain 7>
...

So, this "magic id" 1d170000 corresponds to bluetooth USB device (it has my Magic Mouse connected). Since it's not recognized by Mac OS, we have a chance to enumerate it from libusb.

Then, I looked at Linux /lib/firmware/ath3k-1.fw, and searched in /usr/share/doc/linux-firmware/README.gz:

Code:
Driver: ath3k - DFU Driver for Atheros bluetooth chipset AR3011

File: ath3k-1.fw
Info: v1.0

Fix EEPROM radio table issue and change PID to 3005

Licence: Redistributable. See LICENCE.atheros_firmware for details

Bingo! it's our P8P67 bluetooth chip.
So we have a firmware.
Then, how to upload it?
Linux kernel has a file ./linux-2.6.39-rc4/drivers/bluetooth/ath3k.c, which uploads firmware:

Code:
static int ath3k_load_firmware(struct usb_device *udev,
                                const struct firmware *firmware)
{
     ...
        while (count) {
                size = min_t(uint, count, BULK_SIZE);
                pipe = usb_sndbulkpipe(udev, 0x02);
                memcpy(send_buf, firmware->data + sent, size);

                err = usb_bulk_msg(udev, pipe, send_buf, size,
                                        &len, 3000);

                if (err || (len != size)) {
                        BT_ERR("Error in firmware loading err = %d,"
                                "len = %d, size = %d", err, len, size);
                        goto error;
                }

                sent  += size;
                count -= size;
        }
        ...
}

The function itself is quite simple.

So basically we need to port that code that uses <linux/usb.h> from linux kernel to whatever Mac OS uses to communicate with usb devices, or I guess we can even use user-level libusb which AFAIK is ported to Mac OS (that's how madwimax drivers work I guess).

I have no experience with USB programming neither with Mac OS low level programming, so I'd be glad if someone actually implemented this idea into real app (or kext)
:)
 
Joined
Apr 21, 2011
Messages
79
Mac
Classic Mac
Mobile Phone
Re: Enabling Bluetooth on P8P67

Checked it with Linux under VMWare Fusion: it still can upload the firmware from the VM! This gives a hope for user-level port of Linux kernel driver using libusb.
However, I don't know how to avoid re-ticking "Show Bluetooth status in the menu bar" checkbox in System Preferences -> Bluetooth if this method worked.
 
Joined
Mar 11, 2011
Messages
15
Motherboard
asus p5 16gb ram
CPU
intel i7
Graphics
nvidia gtx 580
Mac
Classic Mac
Mobile Phone
Re: Enabling Bluetooth on P8P67

drcrack said:
Checked it with Linux under VMWare Fusion: it still can upload the firmware from the VM! This gives a hope for user-level port of Linux kernel driver using libusb.
However, I don't know how to avoid re-ticking "Show Bluetooth status in the menu bar" checkbox in System Preferences -> Bluetooth if this method worked.

You are into something really interesting here! i have posted another possible workaround. take a look at that. Unfortunately i can´t do it myself i don´t have the knowledge.

viewtopic.php?f=19&t=15487

There is a link to another forum and it seems that maybe its possible to edit the bluetooth kext in osx

//regards samuel
 
Joined
Apr 21, 2011
Messages
79
Mac
Classic Mac
Mobile Phone
Re: Enabling Bluetooth on P8P67 * boards

Good news, gentlemen -- I've just ported firmware uploader from Linux kernel to Mac OS (user space application that uses libusb)! It's analogous to method with VMWare, except it doesn't require VMWare :)
The application and sources coming shortly.
I just need someone's help rewriting it as a kext, so we won't have to do click-click in System Preferences -> Bluetooth to refresh menu bar.
Or can we run a console application at some point before user logs in?
 
Joined
Jan 6, 2011
Messages
288
Motherboard
MSI MEG Unify Z490i
CPU
i9-10850k
Graphics
HD 630
Mac
  1. MacBook Pro
  2. Mac mini
  3. Mac Pro
Mobile Phone
  1. iOS
Re: Enabling Bluetooth on P8P67 * boards

Worst case, you could have it be an launch at startup Automator Action.
 
Joined
Apr 21, 2011
Messages
79
Mac
Classic Mac
Mobile Phone
Re: Enabling Bluetooth on P8P67 * boards

Here is the source code + firmware. Do not download for now, unless you're a developer an can install libusb-1.0 and build this.
Works ok under 10.6.7.

How to compile libusb statically into a binary? -Wl,-Bstatic -lusb-1.0 -Wl,-Bdynamic doesn't work in Mac Os (linker doesn't recognize -Bstatic). I don't want to put a libusb shared lib into a distributon.

Can someone do a "nice user-friendly package", please? I'm a Linux guy, don't know how to do that :)

And what is the proper way to make that run at system boot?
 

Attachments

  • p8p67-bluetooth-enabler-src.tgz
    163.8 KB · Views: 672
Joined
Apr 21, 2011
Messages
79
Mac
Classic Mac
Mobile Phone
Re: Enabling Bluetooth on P8P67

samuel77 said:
You are into something really interesting here! i have posted another possible workaround. take a look at that. Unfortunately i can´t do it myself i don´t have the knowledge.

viewtopic.php?f=19&t=15487

There is a link to another forum and it seems that maybe its possible to edit the bluetooth kext in osx

I've looked at these kexts, and I don't think it may work for P8P67: in that thread they patch kexts to support more vendors and models, while our model is already supported, it just lacks proper firmware. Now we have a way to upload it :)
 
Status
Not open for further replies.
Top