OpenWrt Forum Archive

Topic: Bluez and OpenWRT experimental [success]

The content of this topic has been archived between 5 Apr 2018 and 27 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hello all,

just wanted to inform you on successful building bluez for openwrt.

Packages created are:
bluez-utils, bluez-libs, kmod-bluetooth

Currently available at:
http://www.comnets.uni-bremen.de/~mab/openwrt/packages/

Hope someone is interested in this.....

Bye,
Markus

(Last edited by markushx on 17 Jun 2005, 07:20)

Good job, I was looking for this for a while.

Do you also have compiled the rfcomm module, without it there is less fun with bluetooth.

I'm using it to transfer files to my phone using OBEX.


My config: Asus WL-500gx and USB Belkin bluetooth module.

Hi,

I just forgot to copy the respective object file. rfcomm.o should be in the updated packages at the same location now, but I haven't tested it yet.

Regards,
Markus

markusx,

The rfcomm module loads fine:

Jun  9 15:56:35 (none) kern.info kernel: BlueZ Core ver 2.4 Copyright (C) 2000,2001 Qualcomm Inc
Jun  9 15:56:35 (none) kern.info kernel: Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
Jun  9 15:56:46 (none) kern.info kernel: BlueZ L2CAP ver 2.3 Copyright (C) 2000,2001 Qualcomm Inc
Jun  9 15:56:46 (none) kern.info kernel: Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
Jun  9 15:57:17 (none) kern.info kernel: BlueZ RFCOMM ver 1.1
Jun  9 15:57:17 (none) kern.info kernel: Copyright (C) 2002 Maxim Krasnyansky <maxk@qualcomm.com>
Jun  9 15:57:17 (none) kern.info kernel: Copyright (C) 2002 Marcel Holtmann <marcel@holtmann.org>
Jun  9 15:57:42 (none) kern.info kernel: BlueZ HCI USB driver ver 2.7 Copyright (C) 2000,2001 Qualcomm Inc
Jun  9 15:57:42 (none) kern.info kernel: Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
Jun  9 15:57:42 (none) kern.info kernel: usb.c: registered new driver hci_usb


But if you run rfcomm at the prompt it's exiting with the following error:

root@Yarfid:/lib/modules/2.4.30# rfcomm
Can't get device list: Operation not supported


So I guess it's not working sad

I guess you're right. I forgot to enable BT_RFCOMM_TTY, which is needed. I am currently working on it, but unfortunately the images with tty enabled can't be booted (WL-500g not pingable). It seems like I broke my build environment and now I am going to start with a new build environment and integrate my changes into it....

I'll post more information next week (hopefully ;-) )

Bye,
Markus

OK,

I enabled BT_RFCOMM_TTY and restarted with a new build environment and voila it works.

A very short HowTo(WorksForMeTM):

##add to /etc/ipkg.conf:
#src mab http://www.comnets.uni-bremen.de/~mab/openwrt/packages

ipkg update

#install bluetooth and usb packages
ipkg install kmod-bluetooth
ipkg install bluez-libs
ipkg install bluez-utils
ipkg install kmod-usb-core
ipkg install kmod-usb-ohci
ipkg install kmod-usb2
ipkg install libusb
ipkg install lsusb

#insert bluetooth and usb modules
insmod usbcore
insmod usb-ohci
insmod bluez
insmod hci_usb
insmod hci_uart
insmod sco
insmod l2cap
insmod rfcomm

#modify /etc/bluetooth/hcid.conf
#pin_helper /etc/bluetooth/givepin;

#create /etc/bluetooth/givepin:
#echo "PIN:1234"
chmod +x /etc/bluetooth/givepin

#start hcid (otherwise 'hcitool dev' does not find devices)
hcid

#mount usbdevfs for debugging
mount -t usbdevfs none /proc/bus/usb

#find the bluetooth dongle
hcitool dev

#find bluetooth devices
hcitool scan

#might not be necessary, see posts below
(#create /dev/rfcomm0
makedevs /dev/rfcomm c 216 0 0 0)

#connect
rfcomm -i hci0 connect /dev/rfcomm0 <remote_bluetooth_address> 1

Have fun with your mobile.....
Markus

(Last edited by markushx on 4 Jul 2005, 09:43)

Markus,

Works perfectly!

Thanks for your time and effort.

regards,
yarfid

Good work, thanks Markus!

I was looking for bluetooth on openwrt for half an year.

After destroing a half year old openwrt version by installing bluez kmod ipkgs and solving some problems with whiterussian stability (switching to gcc 3.4.3, can you use 3.4.4??) I finally got the bluetooth working.

I managed to connect SonyEricsson P900 phone (an mRouter beast) to the Internet directly by wl500g and i-tec BT USB dongle (Cambridge radio). openwrt BT is now much more stable than P900's one.

Markus, please, fix the URL of your ipkg repository in HowTo.
You can also left out
       makedevs /dev/rfcomm c 216 0 0 0
as desired device is in /dev/bluetooth/rfcomm/0... and you better use
      rfcomm connect 1 <remote_bluetooth_address> 1
I wasted time recompiling busybox to get makedevs before I figured this out.

Now I'm looking for obex.
Yarfid, did you make an openobex ipkg? Do you have some patches?

Another goal is an IAX based Voip connection to bluetooth handsfree. I hope that everythink is in the asterisk and the only work needed is to port the bluetooth channel. Somebody cares?

Tom

(Last edited by samot on 25 Jun 2005, 07:19)

Samot,

I have a debian sarge rootfs installed on an external HD connected with the router so I use the debian compiled openobex applications and libs.

Did you have problems connecting your phone to the router? I guess your using dund.
In the beginning I had some strange loss of connection and I only managed to get it work again by disconnecting the trust bt-1800tp and connecting it again. I had the same problem with the Belkin F8T001 (uses also a broadcom chipset)
Later I found a solution by decreasing the packets in "hciconfigure hci0 aclmtu xxx:packets", now it works superstable.

Good luck with your IAX based voip.

regards,
Yarfid

I think for voice/handsfree you need snd-bt-sco which itself requires alsa, which probably is hard to compile for openwrt.

But it would definitely be worth a try.....

Sry may poor english.

bluez working correctly as above , big thanks smile

can connect from asus as above and using pand,
can connect to asus using there pand --listen ... NAP without --master and client also pand --connect,
can NOT connect to asus using pand --listen ... without/with --master from windows,
can NOT connect to asus if hcid.conf contains accept, master;
can NOT pair from other devices (windows, palm tungsten), bluetooth is working correctly on them as i use zipslack10.0 computer in paralel.

Can anybody help, please smile

Hi, very good and appreciated work! smile

For Iax I successfully compiled the miax ( http://miax.sf.net ) for Openwrt and it is working with the bluez packages, the only problem is that I have not any idea on how to make an ipkg, if someone has time to do it please let me know, it could be nice to share the work...

waouw, this is great!
I'm new to openwrt, but have seen ipkg howtos on the web. seems not complicated.
still have to install asterisk on a pc first, then I'll try in openwrt with your miax.

kvborg wrote:

Sry may poor english.

bluez working correctly as above , big thanks smile

can connect from asus as above and using pand,
can connect to asus using there pand --listen ... NAP without --master and client also pand --connect,
can NOT connect to asus using pand --listen ... without/with --master from windows,
can NOT connect to asus if hcid.conf contains accept, master;
can NOT pair from other devices (windows, palm tungsten), bluetooth is working correctly on them as i use zipslack10.0 computer in paralel.

Can anybody help, please smile

From http://www.jeremythompson.uklinux.net/R … zhowto.pdf :
For using the role switch function you will need hardware that supports this feature.

ubaldo wrote:

Hi, very good and appreciated work! smile

For Iax I successfully compiled the miax ( http://miax.sf.net ) for Openwrt and it is working with the bluez packages, the only problem is that I have not any idea on how to make an ipkg, if someone has time to do it please let me know, it could be nice to share the work...

Have a look at his thread:
http://forum.openwrt.org/viewtopic.php?id=1864

Thanx Sophana, Markus already did it and sent me a precompiled miax, so now it is clear how it works.

I hope to have the new miax ready for this weekend.

Another question, Markus when is bluez going to be part of the experimental on openwrt site?

Another question, Markus when is bluez going to be part of the experimental on openwrt site?

It is part of CVS HEAD at the moment.

Ubaldo,
I have now also an asterisk running and miax is connected and authenticated to it. How can I tell asterisk to connect
t610 <-bt-> asus <-miax-> asterisk <-sip-> sipprovider
so that i can call from landline to the mobile using voip? Do you have examples for sip.conf, iax.conf, extensions.conf?

Markus

(Last edited by markushx on 18 Aug 2005, 13:28)

I don't know whom to contact for this. But before it can be released, there should be some kind of start script for the hcid and the ipkg should automatically insert the modules in /etc/modules. Nevertheless I contacted Nico to insert my repository into his tracker.

The usb modules are not that packaged. we still have to add lines into /etc/modules.
it seems quite easy to add packages in cvs, i've looked into it a little bit.
Maybe you should propose a patch to have it included in cvs.

sophana wrote:

Maybe you should propose a patch to have it included in cvs.

To whom?

markushx wrote:
sophana wrote:

Maybe you should propose a patch to have it included in cvs.

To whom?

For example to me, nbd, mbm or Kaloz.

It is nothing for whiterussian, but I would integrate it to HEAD, if you send me a fine patch.
(mail me wbx@thinknow.de)

wbx wrote:

For example to me, nbd, mbm or Kaloz.

It is nothing for whiterussian, but I would integrate it to HEAD, if you send me a fine patch.
(mail me wbx@thinknow.de)

OK, wbx checked it into CVS HEAD.
Thanks.

I had problems with connecting bluetooth handsfree to usb bt dongle in my router. Sound was sometimes chopped, sometimes just a noise in both playing and recording. It also caused GP faults and even system crashes.

Firstly I suspected asterisk and chan_bluetooth, however hstest from blues-utils was doing almost the same. After a week of bug hunting I discovered mad (probably DMA) writes to isoc buffers. SCO in hci_usb.c uses 17 bytes chunks to transfer. And those beginning at odd address got written sometimes from buf[-1], some had unwritten second dword and some had an extra byte after the end of a buffer.

Aligning buffers word boundary magically resolved all problems. Asterisk now works great and I can make and answer voip call with PC switched off.

There is the base of a patch (which I send it to wbx):

--- linux-2.4.30/drivers/bluetooth/hci_usb.c    2004-08-08 01:26:04.000000000 +0200
+++ linux-2.4.30/drivers/bluetooth/hci_usb.c    2005-07-25 20:12:11.000000000 +0200
@@ -259,6 +259,9 @@
        void *buf;

        mtu  = husb->isoc_in_ep->wMaxPacketSize;
+#ifdef CONFIG_BCM4710
+       mtu = (mtu + 1) & ~1;           /* brcm: isoc buffers must be aligned on word boundary */
+#endif
         size = mtu * HCI_MAX_ISOC_FRAMES;

        buf = kmalloc(size, GFP_ATOMIC);

I'm not sure what brcm chips have that bug. I have ASUS WL-500G, hardware_version=WL500-02-02-01-00, boardtype=bcm94710dev, clkfreq=125.
Powered by OpenWRT from cvs HEAD.
I'm using BT dongles iTec, CSR chip ver 2.72 and BlueTrek G2 HF.