Showing posts with label a2dp. Show all posts
Showing posts with label a2dp. Show all posts

Friday, August 28, 2009

Using BlueSoleil With Macbook Pro Unibody

In my last post i showed how to use the Toshiba BT stack with the 15" Macbook Pro Unibody (and probably any other BT device you would like). I wasnt too happy with the outcome though - i find the Toshiba BT stack to be quite clunky in the way it integrates with my BT hardware and has a very dated feel to the software. On the plus side it was nice and configurable which i do like. The BIGGER downside though, is that there seems to be no option to license the software on non-Toshiba hardware, rendering it useless after 30 days, unless you crack it. As a software developer myself i try to avoid the latter option and support the industry :)

With that in mind i set my sights back on the other two options - Broadcom and BlueSoleil. My first choice was Broadcom, only because the MBP Unibody uses a Broadcom manufactured module. However Broadcom plainly refuses to install itself on any device that has not paid them royalties for the BT stack, which Apple obviously has little incentive to do at this time. So i turned my attention back to BlueSoleil. This was always my first choice to begin with, since it is intended as an all-purpose stack that you CAN buy a license for if you like it. Well i was successful this time around and i can tell you, the effort was definitely worth it.

Installing BlueSoleil On An Unsupported Device
  1. Download the latest BlueSoleil release from here (version 6.4.275.0 was used for this writeup)
  2. Extract the contents of the zip file and browse to the install directory
  3. Open setup.ini for editing using notepad or similar and replace the contents with the following (simplified for ease of reading). Note that while some of these changes may not strictly be necessary, they streamline some parts of the install process and avoid problems later:

    [bsconfig]
    BluetoothPlaceSite=1
    ShutDownBluetoothHardwarePower=1
    DefaultLocalDeviceClass=1

    [Install]
    CmdLine=""%SetupExeLocation%%PROCESSOR_ARCHITECTURE%\setup.exe"
    [SPDPhoneNumber]
    NumberCount=1
    SPNumber1=#777

  4. Save the file and close it
  5. Run setup.exe as administrator (this is probably not necessary, but its what i did to achieve a successful installation so vary and post your results below)
  6. The installation should succeed with no errors. You should notice the default MS BT stack icon in the system tray has disappeared. Do NOT restart your system when prompted - we want to make a few changes first
  7. Open file explorer and browse to where you installed the BlueSoleil BT stack (default is C:\Program Files\IVT Corporation\BlueSoleil)
  8. Open the bttl.ini file for editing in notepad or similar. Search for the text 8203. The line that is found should be in a section titled [HW356]. If you are using a different version of the drivers then it is unimportant if this title is different. What is important is that you take note of the title. Change the text 8203 to 8213 - what we are doing here is changing the hardware ID specified in this section to match the hardware ID of the BT module. If your hardware ID is slightly different, then simply change the hardware ID here to match yours (and in all subsequent steps). See my previous post on how to locate your hardware ID if you are unsure
  9. At the top of the file, in the [DEFAULT] section, change the setting NUM=363 (number may differ depending on your version of the drivers) to NUM=356
  10. Save the file and close it. Depending on your security settings in Windows 7, you may not be able to save the file directly. Instead - you may have to save the file to your desktop or some other location, close the file and then manually move it back into the directory
  11. Go to the driver\usb subdirectory and open the file btcusb.inf for editing.
  12. Search for the text 8203 and replace all instances (there should be two) with 8213 (again substitute for your hardware ID if it is different from mine)
  13. Save the file (again you may need to indirectly save it using the method explained above) and close it
  14. Restart your computer and once it has restarted, you should see the new BlueSoleil icon in the taskbar. At this point BlueSoleil is installed successfully, but the BT module is not yet setup. We need to do that manually through the device manager
  15. Go to the start menu, type "device manager" and press enter to open the device manager
  16. Browse to the BT module under Bluetooth - it will likely be called Generic Bluetooth Device (if not you may have some other BT software installed that should be removed before any of these steps are performed, but you can probably just install it at this point and proceed)
  17. Right-click the BT device and select Update Driver Software
  18. Select the bottom option Browse my computer for driver software
  19. Select Let me pick from a list of device drivers on my computer and browse to the location of the USB BT driver modified above (default is C:\Program Files\IVT Corporation\BlueSoleil\driver\usb) and click Next
  20. Select the only option in the list, which will be Apple Built-in Bluetooth
  21. A warning will pop up saying the driver is unsigned - click Install this driver anyway
  22. The device should now change its description in Device Manager to Apple Built-in Bluetooth and is successfully installed!
  23. Right-click the BlueSoleil icon in the taskbar and select Turn on bluetooth. You should now successfully be able to pair your bluetooth devices (eg headphones) with your MBP Unibody!

My Experience With BlueSoleil

  • A2DP connectivity is ABSOLUTELY seamless - I made my headphones discoverable - BAM they were connected and appeared as connected on the computer. No redundant password prompt or connection dialog. Music instantly started playing through them. Turn them off and sound changes back to the speakers. Turn them back on they start playing again. Absolutely seamless - i dont even have to stop/start the program using the audio device at the time, which i had to do with the Toshiba drivers
  • Beautiful icon set - the icons used are all vector graphics and fit very nicely with the slick look of Windows 7
  • Minimal set of services - only 3 which is not as good as the MS stack, but way better than the Toshiba drivers which had around half a dozen! They seem to be well designed, making efficient use of resources too which is important - BT should be very transparent to the system in my opinion

As requested, here are the modified INF files (generated from version 6.4.286.0 on 2/12/2009)

Wednesday, August 26, 2009

Bluetooth Stereo Audio (A2DP) Fixed on Macbook Pro Unibody

Well after 3 solid days of searching, downloading and modifying the various Bluetooth (BT) stacks out there, ive finally been successful in getting my Logitech Freepulse Wireless Headphones to work with my MBP 15" Unibody. Its worth it since i spend 1.5 hours each day travelling on the train, so this really comes in handy. Let me walk you through my experiences (so you can see what didnt work) and finally the resolution that did work.

What I have tried
The following list i have tried over the past few days without success:
  • Uninstalled Windows 7 64-bit and reinstalled 32-bit. See my previous post on the main reasons i did this, but it was also to see if the 32-bit drivers were any different from the 64-bit counterparts - they weren't and the same problems were still evident. My next step will be to revert to 64-bit again to reclaim my memory
  • Discovered that the MS BT stack is extensible, though documentation is so far sketchy at best. Contemplate writing an A2DP profile extension that would provide all Windows users with full A2DP support. I havnt completely disregarded this yet but it looks like it will be significant work to fully support all types of encoding, etc. This idea has been shelved pending my future experiences with the BT stack i now have working
  • Tried to use the seemingly excellent BlueSoleil BT stack 6.4.275. This doesnt support my current adapter out of the box, but using similar techniques to what i describe here, i was able to get it to install. Mixed experiences with this one - the first time after installing i managed to get the BT service to start but could not connect. Subsequently i was never able to get the service to start again - it would always freeze - and i mean FREEZE as in the computer was responsive but hung whenever i tried to shut it down or uninstall BlueSoleil. This did not give me a warm, fuzzy feeling at all. They seem to update frequently though and it does officially support Windows 7 now as well as several, older Apple BT modules so i will definitely try it again once they officially support my hardware
  • Tried to use the Broadcomm BT stack 6.3.0.200. Again, my hardware is not officially supported and this was made trickier by the fact that the installer seems to only be a stub that then downloads the components it detects as necessary. I didnt play around with this one too much and i will be revisiting it now that i have had some success
  • Tried to use the Broadcomm BT stack 6.0.1.5300. I found the full package of this version so i decided to give it a go. After tweaking the INF files i had no success in getting the installer to identify my BT module. This is a problem because if the Broadcomm package can not detect your module, it refuses to install at all, preventing further tweaking. I will likely focus on a later release of Broadcomm anyway
What worked
I ended up having success with the Toshiba BT stack 6.40.02. You can download the latest 32-bit and 64-bit versions from here. Again, the current version of the driver does not support my hardware out of the box, so use the following steps to get it to install:
  1. Extract the contents of the downloaded zip, which will result in another self-extracting executable called v64002T_20090623_x32.exe

  2. Extract the contents of this executable using a suitable program (my persontal favourite is Winrar, but 7-zip should also do it)

  3. Run the silent_install.bat batch file - this will perform a silent installation of the BT stack, so you wont see much on screen except probably a UAC confirmation (if you have it turned on) to confirm the operation. Doing this is better than running the installer normally, since if you do that, it tries to install the BT module as part of the installation. However that will fail because the INF file does not support the current hardware yet

  4. After the silent install has completed, browse to C:\Program File\Toshiba\Bluetooth Toshiba Stack\Drivers\tosrfusb and open the tosrfusb.inf file for editing

  5. Search for [Standard] to go directly to this section. You will see a bunch of entries with the following format:

    %DisplayName%=Section, HardwareID

    We need to add another entry for the BT module in our MBP. Add a new line at the top of the list that looks like this:

    %Apple.DeviceDesc%=TosrfUsb_Device, USB\VID_05AC&PID_8213

    If your Hardware ID for your BT module is different, simply subsititute it for the above. The process to find your hardware ID is outlined below.

  6. You now need to add a description of your BT module to the INF file. Go right to the bottom of the file and you will see a bunch of declarations with the following format:

    Key = "Description"

    We need to add another entry for the BT module in our MBP. Add a new line at the bottom of the list that looks like this:

    Apple.DeviceDesc = "Apple Built-in Bluetooth Module"

    You can actually make the text inside the quotes whatever you want - this is what will appear in the Device Manager for the device

  7. Save the INF file - under Windows 7, depending on your security settings you may be unable to save the file directly since this is a protected location. The easiest way around this is to either edit the file as administrator or save the file to the desktop, then move it back to the folder overwriting the old file

  8. Press the Windows key to open the start menu and type 'Bluetooth Settings' then press enter to start the Toshiba BT manager. This will trigger the Toshiba BT manager to go and discover the BT module in your MBP. With the settings added to the INF above, it should install the necessary drivers, set up the required service as well as shut down the standard MS stack for you. You may be required to restart your computer after this step.

  9. At this point the Toshiba BT stack is installed and ready to use. You can now right click the new BT icon in the system tray and pair with your BT devices


  10. I have discovered a small glitch with my Logitech Freepulse Wireless Headphones when using the Toshiba BT stack. Everytime i pair the headphones it prompts me for the password (0000). If i connect this way (ie headphones initiated the connection) i find the sound does not work at all! However if i initiate the connection from the computer, it pairs without asking for the password and the sound works flawlessly.

  11. By default stereo headphones are set to use low quality with the Toshiba BT stack. To change this, right click the heaphones icon in the Toshiba BT manager and select Detail. Change the Sound Quality setting to High Quality and click OK. Note you will have to reconnect your headphones for this setting to take effect if they are already connected

The only downside to using the Toshiba BT stack is that because this is a non Toshiba piece of hardware, the BT stack only runs for 30 days. I dont believe there is an option to purchase this stack either, unlike the BlueSoleil option. I will leave that limitation as an exercise for you to overcome. I will just say that there are options out there to overcome it.

Works On My Machine!
Please note that this should work on every single MBP 15" Unibody, since they are all the same hardware! However there is always a chance Apple will start using a different BT module in the near future. My machine identifier is MacbookPro5,4 (which can be found using the System Information tool that comes with Windows under the System Model field). The details of my BT module are as follows:

Manufacturer: Broadcom
Firmware Version: 162 (251)
Hardware ID: USB\VID_05AC&PID_8213
HCI Version: 2.1 ($4)
HCI Revision: 251 ($FB)
LMP Version: 2.1 ($4)
LMP Revision: 8610 ($21A2)
Composite Class of Device: 3670284 ($38010C)
Device Class (Major): 1 ($1)
Device Class (Minor): 3 ($3)
Service Class: 448 ($1C0)

Finding Your BT Module Hardware ID
The hardware ID is what is used inside the INF file to uniquely identify a particular configuration of hardware. To find your hardware ID, use the following steps. If it is not the same as mine above then substitute it at the appropriate points in the above steps and it should work. Please post your experiences in the comments!
  1. Go to the start menu and type "Device Manager" then hit enter to open the device manager.

  2. Browse to the Bluetooth section and expand it

  3. Double-click the Generic bluetooth device to open the properties (the name may be different if you have already installed a BT stack - eg Apple Built-in Bluetooth Module if you followed the above steps already)

  4. Go to the details tab

  5. Change the Property list to Hardware Ids

  6. The ID you are after will have the format USB\VID_xxxx&PID_yyyy

Troubleshooting
If it doesnt work, i would suggest looking at the following:
  • Uninstall any other BT stacks you have installed - this includes Widcomm, Broadcom, Toshiba and BlueSoleil. The standard MS stack will always be there but all the other packages seem to now handle it fine and perform the necessary steps to disable it as required
  • Try preventing the MS stack from detecting and installing its drivers by removing the bth.inf and bth.pnf files from C:\Windows\inf (back them up of course). This really shouldnt be necessary though and i have never had to do it with Windows 7
  • Try stopping the Bluetooth Discovery Service
  • Usual stuff like restarting, checking your device ID, etc
  • Pray to the BT gods ...
Final Words
I really, really wish MS would just include the A2DP profile in their built-in MS stack. To be honest i much prefer the built in stack over all the other implementations - it is much simpler, has better icons, integrates better into the various features of Windows 7 and seems to have a lot less services and processes needing to be run. It would be a simple DLL addition to provide the support and is something that OSX now provides out of the box since 10.5. I really cant believe in this day and age they are going to release Windows 7 without it, but this seems to be a reality that we have to work around.