PDA

Bekijk de volledige versie : Bluetooth support in Oleg's firmware?



MatB
26-04-2006, 08:03
Hi Oleg,
Could you compile bluetooth support directly in your firmware version?
I think bluetooth is a widely requested feature; however, most of the people steer away from it because it's a hard task to implement and the success ratio is low.
What's your opinion on the subject?

Thanks for the precious work so far,

MatB

Ping
28-04-2006, 08:32
I think it would be a great idea to have BT support in Oleg's brilliant firmware. Anybody else shares our interest? Oleg?

Cheers,
Ping

Oleg
28-04-2006, 09:16
I don't have USB stick, as well the only bluetooth device which I'm owning is ipaq which has wi-fi too. So, no interest...

BTW, what do you expect? Access point functionality for sharing internet connection? Just precompiled utilities?

MatB
28-04-2006, 10:02
BTW, what do you expect? Access point functionality for sharing internet connection? Just precompiled utilities?
Internet connection sharing would be very cool, but i think it's also harder to implement; the support for serial port profile (RFCOMM) would be also great.
The problem of bluetooth on the wl500 is that a kernel module (possibly patched) is required; and the skills required by this task are way greater than the knowhow needed to compile user apps.
The idea is that anyone with a bluetooth phone with the java bluetooth API could use the phone as graphic interface for the screenless router.
I'm talking about a GUI to browse and play from one's mp3 collection (bemused client/server) or also a graphic interface for a voip softphone (linphone) or even a remote control for home automation (plug a usb parallel port with relais to switch stuff on and off). Whatever tickles your geek neuron... bt has a wide range of available devices waiting to be hacked.

cooper.zl
04-05-2006, 07:36
BTW, what do you expect? Access point functionality for sharing internet connection? Just precompiled utilities?
For me is good to have ASUS in which I can insert bluetooth module and share internet connection with symbian mobile. I'm using GnuBox (http://gnubox.dnsalias.org/gnubox/) on my phone and there is a how to for linux - using 'DUN' profile. I try to downgrade to old firmware, install Affix, BlueZ, ... with no result. But I don't know anything about linux, I'm a Microsoft man ;o( There are many posts in this forum with bluetooth which is not working.

Gart
23-02-2007, 16:43
Hi!

Perhaps it may be interesting for you all to know, that I managed to compile the rfcomm.o kernel module for Oleg's firmware. I am not a great expert either in Linux or in the Bluetooth technology, so I might have taken the wrong way to do it. But as far as I tested it, this solution works fine. My router is WL-500gx, Bluetooth dongle is Bluetake BT009SX.

Here is how I did it, step by step:

1. Start with Oleg's firmware version 1.9.2.7-7f.
2. Prepare the source code for compilation, as explained on http://oleg.wl500g.info/ .
3. Download a Bluetooth patch for the Kernel 2.4.20 from here http://www.holtmann.org/linux/kernel/ . I used patch-2.4.20-mh4.gz (http://www.holtmann.org/linux/kernel/patch-2.4.20-mh4.gz) as it was described on this page (http://www.teaparty.net/technotes/blue-gprs.html). It runs okay on my router, so I didn't try other patches. Most probably more recent ones will work too.
4. Go to the Broadcom kernel source code directory (broadcom/src/linux) and extract the patch there.
5. Make a copy of the linux directory under the name linux-2.4.20
6. Apply the patch: patch -p0 < patch-2.4.20-mh4. It will say that some files are mismatched, but I didn't have any errors compiling them.
7. Move your old linux directory to some safe location and replace it with the patched source tree instead.
8. Go to the broadcom/src/gateway and run make menuconfig. You will see the RFCOMM option appear. Enable it, enable TTY support, save the configuration and recompile the firmware.

My rfcomm.o module is in the attachment below. You may just put it on the router and use it, or recompile everything from scratch.

gwl
23-02-2007, 19:22
Hello Garth.

thanks for that.
I tried that on my wl500g (oleg's 1.9.2.7-7f),
but when I loaded the module I just got a bunch of errors:


[admin@wl500g tmp]$ insmod ./rfcomm.o
insmod: unresolved symbol bluez_sock_unlink
insmod: unresolved symbol bluez_accept_enqueue
insmod: unresolved symbol bluez_sock_init
insmod: unresolved symbol bluez_sock_link
insmod: unresolved symbol bluez_accept_dequeue
insmod: unresolved symbol bluez_sock_w4_connect
insmod: unresolved symbol batostr
insmod: unresolved symbol bluez_sock_register
insmod: unresolved symbol bluez_sock_poll
insmod: unresolved symbol bluez_sock_unregister


any ideas?

thanks
:rolleyes:

oleo
24-02-2007, 09:26
ipkg install bluez-utils

Gart
24-02-2007, 09:57
Hello Garth.
thanks for that.
I tried that on my wl500g (oleg's 1.9.2.7-7f),
but when I loaded the module I just got a bunch of errors:
:rolleyes:
You need to load bluez.o first

gwl
24-02-2007, 17:55
You need to load bluez.o first

ipkg install bluez-utils

thank you.
I installed bluez-libs - 3.9-1 and bluez-utils - 3.9-1.
And had bluez.o from bluez-1.9.2.7-6b.zip (I don't remember where I got this)
(this zip includes bluez.o; bnep.o; hci_usb.o; l2cap.o)

Now, after loading bluez.o, and then rfcomm.o, I don't get any errors.
but when I plug in my bt dongle, I get in dmesg:
hub.c: new USB device 00:04.0-1.3, assigned address 15
usb.c: USB device 15 (vend/prod 0xa12/0x1) is not claimed by any active driver.

I'm not sure if it's because of the bluez.o module I used...
but my adapter (Conceptronic CBT200U2 ) should work...
it's reported to work in the nslu2... http://www.nslu2-linux.org/wiki/Peripherals/BluetoothAdapter

could someone please upload bluez.o and other modules that might be needed for bluetooth? thank you.
;)

Gart
24-02-2007, 20:10
thank you.
Now, after loading bluez.o, and then rfcomm.o, I don't get any errors.
but when I plug in my bt dongle, I get in dmesg:
hub.c: new USB device 00:04.0-1.3, assigned address 15
usb.c: USB device 15 (vend/prod 0xa12/0x1) is not claimed by any active driver.

You also need to load hci_usb.o. This is the driver for the USB dongle itself.
Here are the modules which might be needed for Bluetooth:
bluez.o - main functionality
hci_usb.o - USB dongle driver
rfcomm.o - Radio COM-port
bnep.o - Bluetooth network
l2cap.o - L2CAP protocol, might be useful to ping Bluetooth devices
sco.o - for Bluetooth audio
After you load all the needed modules and insert the dongle it should print in the system log

Feb 23 21:39:48 kernel: BlueZ Core ver 2.2 Copyright (C) 2000,2001 Qualcomm Inc
Feb 23 21:39:48 kernel: Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
Feb 23 21:40:03 kernel: BlueZ L2CAP ver 2.1 Copyright (C) 2000,2001 Qualcomm Inc
Feb 23 21:40:03 kernel: Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
Feb 23 21:40:17 kernel: BlueZ SCO ver 0.3 Copyright (C) 2000,2001 Qualcomm Inc
Feb 23 21:40:17 kernel: Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
Feb 23 21:40:32 kernel: BlueZ BNEP ver 1.0
Feb 23 21:40:32 kernel: Copyright (C) 2001,2002 Inventel Systemes
Feb 23 21:40:32 kernel: Written 2001,2002 by Clement Moreau <clement.moreau@inventel.fr>
Feb 23 21:40:32 kernel: Written 2001,2002 by David Libault <david.libault@inventel.fr>
Feb 23 21:40:32 kernel: Copyright (C) 2002 Maxim Krasnyanskiy <maxk@qualcomm.com>
Feb 23 21:40:38 kernel: BlueZ RFCOMM ver 0.4
Feb 23 21:40:38 kernel: Copyright (C) 2002 Maxim Krasnyansky <maxk@qualcomm.com>
Feb 23 21:40:38 kernel: Copyright (C) 2002 Marcel Holtmann <marcel@holtmann.org>
Feb 23 21:40:44 kernel: BlueZ HCI USB driver ver 2.1 Copyright (C) 2000,2001 Qualcomm Inc
Feb 23 21:40:44 kernel: Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
Feb 23 21:40:44 kernel: usb.c: registered new driver hci_usb


To make the router visible to other Bluetooth devices some additional steps may be required depending on your configuration

1. The latest version of hcid daemon from bluez-utils needs to get dbus-daemon running. Its config file /opt/etc/dbus-1/system.conf expects the root user to be named "root" so you may need to change that to <user>admin</user>, and then start dbus-daemon --system

2. Edit the hcid.conf file in /opt/etc/bluetooth . It's rather self-explanatory.

3. Start the hcid daemon. If everything goes fine it should print in the system log

Feb 23 21:41:50 hcid[309]: HCI dev 0 registered
Feb 23 21:41:50 hcid[309]: HCI dev 0 up
Feb 23 21:41:50 hcid[309]: Device hci0 has been added
Feb 23 21:41:50 input[311]: Bluetooth Input daemon
Feb 23 21:41:50 hcid[309]: Starting security manager 0
Feb 23 21:41:50 input[311]: Registered input manager path:/org/bluez/input
Feb 23 21:41:50 hcid[309]: Device hci0 has been activated


4. Type hciconfig hci0 up piscan to activate the dongle, and then hciconfig to check if the USB dongle is running. It should print something like this


hci0: Type: USB
BD Address: 00:02:5B:01:16:5E ACL MTU: 384:8 SCO MTU: 64:8
UP RUNNING PSCAN ISCAN
RX bytes:36390 acl:922 sco:0 events:1358 errors:0
TX bytes:26231 acl:843 sco:0 commands:218 errors:0


5. Start the sdpd daemon and use the sdptool to add local services to the Bluetooth dongle. For example, if you need a Bluetooth serial port on channel 2 type sdptool add --channel 2 SP

6. After all that the router should be visible to other Bluetooth devices. You may use the rfcomm utility to make a serial port connection or dund to set up a PPP connection over Bluetooth.

Any comments and suggestions are welcome.

gwl
25-02-2007, 00:51
thanks Gart. great job. ;)

it's getting closer. :)
now my BT adapter gets listed when I do hciconfig, I do get the MAC listed..
and after I run "sdptool add --channel 2 SP", this adapter can be detected by other devices... (they display the my adapter's mac, and the name "CSR - bc4" (?!)

but what I wanted was to link this BT adapter to a bluetooth GPS...
the problem is that when I do:


[admin@wl blue]$ hcitool scan
Scanning ...
Inquiry failed: Success


no devices are detected... but they're active.. and can be detected by another device...
is there something else I should do, to be able to scan?

thanks,
:rolleyes:


UPDATE:
although I can't detect the mac of the remote device, (by running "hcitool scan" on the router),
I can do: "hcitool name <remote_MAC>", and I get the name of the device..
"hcitool info <remote_MAC>" also works.. :)

but.. how can I search for the devices in the first place?

Gart
25-02-2007, 08:08
I have the same problem with "hcitool scan". I can't figure out why it fails to find anything... possibly it's a bug in the modules. At least you can connect directly to the device if you know its MAC address.

This problem remains open for now. If somebody has any ideas, please help.

3cky
01-07-2007, 10:42
Hello. I was compile bluez modules with recent patches (patch-2.4.20-mh18.gz (http://www.holtmann.org/linux/kernel/patch-2.4.20-mh18.gz)) and problem with error "hcitool scan" seems to be resolved. On my WL-500gP with 1.9.2.7-7g firmware "hcitool scan" now shows correct list of available devices. Modules archive is attached to this post.

poptab
25-07-2007, 21:19
Hello. I was compile bluez modules with recent patches

I have installed your modules and "hcitool scan" works well:

[admin@(none) root]$ hcitool scan
Scanning ...
00:16:41:05:DA:D7 RAKE
00:01:E3:5F:BC:58 CX75


But it fails during making serial port with rfcomm utility:

[admin@(none) root]$ rfcomm -A connect /dev/ttyU0 00:01:E3:5F:BC:58
Can't connect RFCOMM socket: Resource temporarily unavailable


In log I found stange lines after hcid has started:


hcid[16382]: Bluetooth HCI daemon
hcid[16382]: Could not become the primary owner of org.bluez
hcid[16382]: Unable to get on D-Bus


Might the problem caused by pairing? How properly pair devices with BlueZ?

poptab
26-07-2007, 19:18
Moreover I'm getting the following error:


[admin@(none) dbus-1]$ dbus-daemon --system
Unknown username "root" in message bus configuration file

I've changed /opt/etc/dbus-1/system.conf file as described but this doesn't help for me:



<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>

<!-- Our well-known bus type, do not change this -->
<type>system</type>

<!-- Run as special user -->
<user>admin</user>

<!-- Fork into daemon mode -->
<fork/>

<!-- Write a pid file -->
<pidfile>/opt/var/run/dbus/pid</pidfile>

<!-- Only allow socket-credentials-based authentication -->
<auth>EXTERNAL</auth>

<!-- Only listen on a local socket. (abstract=/path/to/socket
means use abstract namespace, don't really create filesystem
file; only Linux supports this. Use path=/whatever on other
systems.) -->
<listen>unix:path=/opt/var/run/dbus/system_bus_socket</listen>

<policy context="default">
<!-- Deny everything then punch holes -->
<deny send_interface="*"/>
<deny receive_interface="*"/>
<deny own="*"/>
<!-- But allow all users to connect -->
<allow user="*"/>
<!-- Allow anyone to talk to the message bus -->
<!-- FIXME I think currently these allow rules are always implicit
even if they aren't in here -->
<allow send_destination="org.freedesktop.DBus"/>
<allow receive_sender="org.freedesktop.DBus"/>
<!-- valid replies are always allowed -->
<allow send_requested_reply="true"/>
<allow receive_requested_reply="true"/>
</policy>

<!-- Config files are placed here that among other things, punch
holes in the above policy for specific services. -->
<includedir>system.d</includedir>

<!-- This is included last so local configuration can override what's
in this standard file -->
<include ignore_missing="yes">system-local.conf</include>

<include if_selinux_enabled="yes" selinux_root_relative="yes">contexts/dbus_contexts</include>

</busconfig>

poptab
26-07-2007, 21:25
After adding user name "root" I managed to start dbus. But I still have a problem with pairing

In this case PIN is not requested at all:

[admin@(none) 00:0B:0D:21:33:61]$ hcitool cc 00:01:E3:5F:BC:58
[admin@(none) 00:0B:0D:21:33:61]$ hcitool auth 00:01:E3:5F:BC:58
HCI authentication request failed: Connection timed out

When trying rfcomm PIN is asked on phone but is not accepted.

[admin@(none) 00:0B:0D:21:33:61]$ rfcomm connect /dev/ttyU0 00:01:E3:5F:BC:58
Can't connect RFCOMM socket: Connection refused

How to solve my problem?

poptab
31-07-2007, 19:59
Moreover I tried to define pin_helper in hcid.conf and got in syslog:

Jul 31 21:20:28 hcid[199]: Bluetooth HCI daemon
Jul 31 21:20:28 hcid[199]: Unknown option 'pin_helper' line 26
Jul 31 21:20:28 hcid[199]: syntax error line 26

Any ideas?

jippie
15-08-2007, 14:05
How's this going I would love to have my mobile connect to the internet via bluetooth.

Jippie

strubbl
14-11-2007, 18:37
Hi folks,

thanks to the hints in this thread I got my dongle working. I can search for other devices and the ASUS is recognized by others.

But as I'm not that familiar with linux I had no idea where to put the module-files. I insmod-ed them from opt-temp. but where to put them correctly?

And how to manage that the bluetooth-device works after a reboot?
do I have to put all that in the postboot?


insmod /opt/tmp/modules/bluez.o #main
insmod /opt/tmp/modules/l2cap.o #for pinging
insmod /opt/tmp/modules/rfcomm/rfcomm.o #virtal serial port
#insmod /opt/tmp/modules/bnep.o #Sound (I don't need that)
insmod /opt/tmp/modules/hci_usb.o #driver

rm /opt/var/run/dbus/pid #if you don't delete it, dbus won't start!
dbus-daemon --system
hcid
hciconfig hci0 up piscan
sdpd
sdptool add --channel 2 SP


hm, I just made a reboot and executed all that commands manually - but it only worked when I unplugged the bt-dongle, replugged it and excecuted the lines again.

-->Isn't there a more comfortable way to enable BT after a reboot?

(My final goal is to have an interface on my mobile for controlling the music the router plays (over JAMSE & a bemused-server). I will open up another thread for that - but now i have to go to the cinema :) )