Bluetooth + streaming for tahrpup 6.x

How to do things, solutions, recipes, tutorials
Post Reply
Message
Author
tempestuous
Posts: 5464
Joined: Fri 10 Jun 2005, 05:12
Location: Australia

Bluetooth + streaming for tahrpup 6.x

#1 Post by tempestuous »

Here are the "bluez" bluetooth libraries compatible with Ubuntu Trusty Tahr, with some specific added configuration files to support bluetooth A2DP audio streaming.
There's NO GUI - I had trouble satisfying dependencies for the "blueman" front end. But it's not really necessary, just a couple of manual commands are all you need to pair your bluetooth devices. Then at each bootup all you need to do is start the bluetooth daemon, via a neat tray applet, kindly provided by forum member rcrsn51.

INSTRUCTIONS
Install this dotpet -
http://www.smokey01.com/tempestuous/blu ... eaming.pet
When the installation is complete you will see a bluetooth icon in the desktop tray, which is black in colour.

Plug your bluetooth USB dongle into your Puppy computer. Puppy already contains the necessary drivers, which will automatically load. Before going any further, it's a good idea to check that Puppy recognises your bluetooth device, with this command -

Code: Select all

rfkill list
Along with an entry for your wifi device, you should see this for your bluetooth device -

Code: Select all

1: hci0: bluetooth
   Soft blocked: no
   Hard blocked: no
In-built bluetooth devices, in particular, may fail to be recognised. If so, check this site for instructions on how to coax the bluetooth device into life -
http://forums.gentoo.org/viewtopic-p-74 ... ml#7499484

Now get the bluetooth daemon running by simply clicking once on the bluetooth icon. You will see it turn blue to confirm the bluetooth daemon is now running.

Next put your external bluetooth device into "discoverable" bluetooth mode. You may need to check the device's user manual. Bluetooth receivers which are built in to certain hifi systems may achieve this by pressing a particular button-sequence on their remote control unit.
Once the external device is in discoverable mode, run this command in Puppy to find its bluetooth MAC address -

Code: Select all

hcitool scan
The result will be something like "00:17:E3:4B:68:A3"
Now go ahead and pair your external device to Puppy with this command -

Code: Select all

bluez-simple-agent hci0 00:17:E3:4B:68:A3
Obviously use your own bluetooth MAC address, not the value I used as an example.
Your headset might require you to authorise the pairing. If so, type your PIN (0000 or 1234, etc)

UPDATE:
Some bluetooth receivers are properly paired at this point, although it might be necessary to reboot Puppy before audio streaming will work properly
... but some bluetooth receivers may indicate that they have failed to pair, even though your Puppy computer shows a successful connection. Thanks to Philh, here are some extra steps you may require - first run these 2 commands:

Code: Select all

hciconfig hci0 piscan
bluetooth-agent 0000
then power-off / power-on your bluetooth receiver. Hopefully it will now show that it is paired.

Once the pairing is successful, it should happen automatically in the future - whenever you activate Puppy's bluetooth daemon.

These instructions are common for all forms of bluetooth communication. Now we will move on to audio streaming.
Attachments
tray-applet.jpg
(7.35 KiB) Downloaded 9246 times
Last edited by tempestuous on Sun 01 Feb 2015, 06:39, edited 1 time in total.

tempestuous
Posts: 5464
Joined: Fri 10 Jun 2005, 05:12
Location: Australia

#2 Post by tempestuous »

BLUETOOTH A2DP STREAMING VIA ALSA PLUGIN.

Open /etc/asound.conf in Geany, and replace "XX:XX:XX:XX:XX:XX" with the bluetooth MAC address of your bluetooth receiver (or headset), which you determined earlier.
To check that a valid bluetooth ALSA device has been created, run this command -

Code: Select all

aplay -L
You should see "btheadset" listed. If so, great. Success.
Now this ALSA device is available to any audio/video application on your computer.

In DeaDBeeF go to Edit > Preferences
and you can select "BT Headset" in the Output device dropdown menu.

Or in VLC go to Audio > Audio Device
and do the same.
Attachments
DeaDBeeF-output.jpg
(37.27 KiB) Downloaded 9274 times

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

#3 Post by rcrsn51 »

I found that ALSA didn't always detect my BT speaker immediately after setup. A reboot may be required to get it working. Or sometimes a re-pair.

[Edit] Check out the new Bluetooth project here.

---------------------------
Last edited by rcrsn51 on Fri 06 Jan 2017, 13:24, edited 4 times in total.

pchan
Posts: 130
Joined: Fri 12 Oct 2012, 12:17
Location: Kuala Lumpur, Malaysia

#4 Post by pchan »

rcrsn51 wrote:Some hints:

1. To check your BT setup, run: bluez-test-device list

2. To delete a device, run: bluez-test-device remove xx:xx:xx:xx:xx:xx

3. I found that ALSA didn't always detect my BT speaker immediately after setup. A reboot may be required to get it working.
is

I am going to give this a try.

It is a great thing if it is possible to get Bluetooth working in Puppy Linux Tahr.

When i do a search, I cannot find many threads in the puppy Linux forum discussing on Bluetooth. Some puppy Linux like Fat-dog or those put together by Csipsez, have Bluetooth but it is only for file transferring or the connection of Bluetooth mouse. I could not get proper streaming of sound to a Bluetooth headset.

Therefore, if i want to use my Bluetooth headset. I always have to log in to Linux lite, Lubuntu or windows.

If it is possible to use Bluetooth headset in puppy Linux, then for me, Puppy Linux would become quite complete as an OS for my computing needs.

recently, I was given a Bluetooth headset that has good battery handling and it claims 40 hours music listening. It is such a pity if I don't use it.

I wish that all puppy Linux developers would consider implementing a working Bluetooth just like they would implement a working WiFi, working sound and working graphic modules. Bluetooth can then become a "out-of-the-box" thing.

Bluetooth is still a useful tool to me although I cannot speak for everyone.

Happy to see that Talented contributors like rcrsn51 is involved in helping with this Bluetooth implementation.

Thanks rcrsn51!

pchan
Posts: 130
Joined: Fri 12 Oct 2012, 12:17
Location: Kuala Lumpur, Malaysia

#5 Post by pchan »

tempestuous, rcrsn51,

First attempt -> result : not successful!


# rfkill list
0: phy0: wlan
Soft blocked: no
Hard blocked: no
1: hci0: bluetooth
Soft blocked: no
Hard blocked: no
# hcitool scan
Device is not available: No such device

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

#6 Post by rcrsn51 »

Has the Bluetooth icon in the system tray turned blue?

From the results of your rfkill command, it looks like your local Bluetooth device is part of your internal WiFi card. I don't have one of these - I am only testing with a USB dongle. Tempestuous has posted a link above with some suggestions.

Is the BT device detected by "lsusb"?

What driver is being loaded for your WiFi card? I wonder whether the driver actually has BT enabled?

I'm pretty sure that "Device is not available: No such device" refers to the local device, not the headphones. If the local device was working, you would see a "Scanning..." message.

Run the command "hcitool dev". Does this detect the internal device?

pchan
Posts: 130
Joined: Fri 12 Oct 2012, 12:17
Location: Kuala Lumpur, Malaysia

#7 Post by pchan »

rcrsn51 wrote:Has the Bluetooth icon in the system tray turned blue?
Yes
rcrsn51 wrote: From the results of your rfkill command, it looks like your local Bluetooth device is part of your internal WiFi card.
Yes, it is a built in bluetooth.
rcrsn51 wrote: Is the BT device detected by "lsusb"?
# lsusb
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 006 Device 002: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 004: ID 0bda:0139 Realtek Semiconductor Corp. RTS5139 Card Reader Controller
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 003: ID 1220:0008
Bus 005 Device 002: ID 046d:c52f Logitech, Inc. Unifying Receiver
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
#
rcrsn51 wrote: What driver is being loaded for your WiFi card? I wonder whether the driver actually has BT enabled?
rtl1892ce - a very good driver I received from you.
Anyway, I can live without Bluetooth but I can't without WIFI. But would be really nice if the Bluetooth can work.
rcrsn51 wrote: I'm pretty sure that "Device is not available: No such device" refers to the local device, not the headphones. If the local device was working, you would see a "Scanning..." message.

Run the command "hcitool dev". Does this detect the internal device?
# hcitool dev
Devices:
#

You are right I think. ... interesting.
Unfortunately, it is back to wired ear phones for me I guess until someone can help me to get Bluetooth working. (or maybe, ... find me a Bluetooth dongle :) )

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

#8 Post by rcrsn51 »

pchan wrote:Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
So this is an internal device, even though it's called a "dongle"?

Did you try the suggestion above?

Code: Select all

rmmod btusb
modprobe btusb
I looked at the source for the rtl8192ce driver and it has something called btcoexist that I never included. I will build and post it.

This is for Tahrpup NO-PAE?

pchan
Posts: 130
Joined: Fri 12 Oct 2012, 12:17
Location: Kuala Lumpur, Malaysia

#9 Post by pchan »

This is for Tahrpup NO-PAE?

Yes, I am using Tahrpup no pae. Thanks

I will try it.


will also try these as soon as I log in to puppy again sometimes later. Cos now I am on another partition enjoying my Bluetooth headset.

rmmod btusb
modprobe btusb


Thanks rcrsn51 as always!

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

#10 Post by rcrsn51 »

@pchan: Install this PET. Then run

Code: Select all

modprobe btcoexist
Test your bluetooth.
Attachments
rtl8192ce_btcoexist_tahrpup_nopae-k3.14.20.pet
(71.46 KiB) Downloaded 1076 times

pchan
Posts: 130
Joined: Fri 12 Oct 2012, 12:17
Location: Kuala Lumpur, Malaysia

#11 Post by pchan »

rcrsn51 wrote:@pchan: Install this PET. Then run

Code: Select all

modprobe btcoexist
Test your bluetooth.
Hi rcrsn51,

I ran "modprobe btcoexist"

Received error (see attached txt file)

Thanks for helping.

If you can succeed in getting an inbuilt bluetooth working, it is great!

If it is not successful, don't worry. As i say, in my effort to search the forum, very few discussions on getting bluetooth working on a puppy linux. Don't know why but most have given up maybe. Usually, we cannot live without sound, wifi or proper graphic modules. But for bluetooth headsets .... we can always return to wired headsets although it will not be as convenient as a headset that is wireless and we can temporarily move about from our pc to other parts of house/room.

It will be quite revolutionary if puppy can someday become like ubuntu or other Linux which comes with Bluetooth working "out-of-the-box" for those who are technically challenged like me. Happy if you can be the one to ignite that bluetooth historical revolution. It is one "last" missing component of Puppy Linux. (... But of course, some puppy (puppies) like
Fatdog and those from lupu and saluki days do provide limited bluetooth connections ... as long as it is not headsets ... ). So, until now, it is more common for puppy linux os to come without bluetooth and users will have to find ways to install it themselves if that is what they need.
Attachments
error.txt.zip
(12.33 KiB) Downloaded 715 times

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

#12 Post by rcrsn51 »

I don't understand that. In Tahrpup NO-PAE, I installed the rtl8192ce_tahrpup_nopae-k3.14.20.pet and the rtl8192ce_btcoexist_tahrpup_nopae-k3.14.20.pet.

I ran "modprobe rtl8192ce" and "modprobe btcoexist". I did NOT get that error. You should not need to run the first modprobe command because the module would automatically load on your machine, since it has the device. Maybe a reboot is necessary?

Boot up a Linux where your BT headphones work and run "lsmod". Is btcoexist being loaded?
Bus 006 Device 002: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
I own two external BT dongles with this identical chip. Both work OOTB. Something is blocking your internal device.

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

#13 Post by rcrsn51 »

No reply? I have the feeling that I am the only person who has seen (heard) this work with actual speakers.

If anyone else has been successful, particularly with an internal BT adapter, please provide some feedback.

[Edit] I just picked up this BT receiver

Image

It works seamlessly, but I am using an external USB BT dongle as the transmitter.

Philh
Posts: 150
Joined: Wed 17 May 2006, 13:26
Location: England

#14 Post by Philh »

I havent managed to make it work streaming to an audio amplifier from a plugin usb dongle.
bluez-simple-agent asks for the pin and seems to create the device
but the audio amp is still trying to pair, never connects, then times out.
I found something about using bluez-test-device trusted and bluez-test-input connect but they didnt
make it work

# hcitool scan
Scanning ...
00:1D:DF:86:67:98 CR-H260i
# bluez-simple-agent hci0 00:1D:DF:86:67:98
RequestPinCode (/org/bluez/3232/hci0/dev_00_1D_DF_86_67_98)
Enter PIN Code: 0000
Release
New device (/org/bluez/3232/hci0/dev_00_1D_DF_86_67_98)
# bluez-test-device trusted 00:1D:DF:86:67:98 yes
# bluez-test-input connect 00:1D:DF:86:67:98 yes
Traceback (most recent call last):
File "/usr/bin/bluez-test-input", line 42, in <module>
input.Connect()
File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 70, in __call__
return self._proxy_method(*args, **keywords)
File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 145, in __call__
**keywords)
File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 651, in call_blocking
message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownMethod: Method "Connect" with signature "" on interface "org.bluez.Input" doesn't exist

#


I got bluetooth working in precise using bluetooth-wizard
but if I try bluez-simple-agent then it doesnt connect.

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

#15 Post by rcrsn51 »

Philh wrote:but the audio amp is still trying to pair, never connects, then times out.
New device (/org/bluez/3232/hci0/dev_00_1D_DF_86_67_98)
The above line indicates that pairing was successful. Now update your asound.conf file as per the above instructions.

When I run "bluez-test-input connect", I get the same errors as you. I don't believe that they are of any consequence.

At this point, I would reboot and possibly redo the pairing with "bluez-test-device remove" and "bluez-simple-agent".

Here is a test command:

Code: Select all

aplay -D btheadset /usr/share/audio/2barks.wav

Philh
Posts: 150
Joined: Wed 17 May 2006, 13:26
Location: England

#16 Post by Philh »

Its like the computer thinks its paired but the amp is waiting for some return.
It times out after 2 minutes and says not connected.

But I have found a way of connecting reliably. Just from searching on the net.
Though Im sure there must be a way without turning the amp off and on.
hciconfig hci0 piscan enables iscan to make the computer dongle discoverable.
Then after I run bluetooth-agent I turn the amp off and on.
It goes into pairing, gets authorized and connects

# hcitool scan
Scanning ...
00:1D:DF:86:67:98 CR-H260i
# bluez-simple-agent hci0 00:1D:DF:86:67:98
RequestPinCode (/org/bluez/31303/hci0/dev_00_1D_DF_86_67_98)
Enter PIN Code: 0000
Release
New device (/org/bluez/31303/hci0/dev_00_1D_DF_86_67_98)
# hciconfig hci0 piscan
# bluetooth-agent 0000
Authorizing request for /org/bluez/31303/hci0/dev_00_1D_DF_86_67_98

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

#17 Post by rcrsn51 »

Excellent. This is another piece of the puzzle to using BT in Puppy.

pchan
Posts: 130
Joined: Fri 12 Oct 2012, 12:17
Location: Kuala Lumpur, Malaysia

#18 Post by pchan »

rcrsn51 wrote:I don't understand that. In Tahrpup NO-PAE, I installed the rtl8192ce_tahrpup_nopae-k3.14.20.pet and the rtl8192ce_btcoexist_tahrpup_nopae-k3.14.20.pet.

I ran "modprobe rtl8192ce" and "modprobe btcoexist". I did NOT get that error. You should not need to run the first modprobe command because the module would automatically load on your machine, since it has the device. Maybe a reboot is necessary?

Boot up a Linux where your BT headphones work and run "lsmod". Is btcoexist being loaded?
Bus 006 Device 002: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
I own two external BT dongles with this identical chip. Both work OOTB. Something is blocking your internal device.
Sorry, I didn't notice that you suggested to run "lsmod" ...

I have been spending my time with LinuxLite instead of puppy these days because i wanted to enjoy my Bluetooth headset.

Anyway, attached is my lsmod of Linux Lite v2.2 (Ubuntu based distro).

It is good to hear that bluetooth dongles do work at least. it gives me hope that i can use puppy and bluetooth headset if I can turn off my in built bluetooth and buy a bluetooth dongle. These dongles are not so expensive these days I think. But, will try whatever possible first to see if the inbuilt bluetooth can be used. In other linux distro it is quite easy to set up the bluetooth headsets, I wonder why it is not so in puppy linux.

I wonder if i am doing something wrong. I noticed that there is a bluetooth Tahr.sfs around somewhere. Should I also load this before installing the bt coexist pet???
Attachments
lsmod.zip
(1.14 KiB) Downloaded 502 times

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

#19 Post by rcrsn51 »

Your LinuxLite is not using btcoexist, so that's not the issue.

Are you also running Tahrpup in Vbox? It's hard to track down hardware problems in that environment.

All you need to test this is a clean install of Tahrpup and the bluez-streaming PET by tempestuous.

pchan
Posts: 130
Joined: Fri 12 Oct 2012, 12:17
Location: Kuala Lumpur, Malaysia

#20 Post by pchan »

rcrsn51 wrote:Your LinuxLite is not using btcoexist, so that's not the issue.

Are you also running Tahrpup in Vbox? It's hard to track down hardware problems in that environment.

All you need to test this is a clean install of Tahrpup and the bluez-streaming PET by tempestuous.
No, i am not running tahrpup in a vbox. I think i will give bluez-streaming from tempestuous a good try tomorrow. it did give a positive result when I ran "rfkill" indicating that bluetooth was detected and not blocked. Only problem is no scanning for MAC of headset. What could I have done wrong? Load bluetooth Tahr.sfs together perhaps?

Thanks

Post Reply