Erstellt vor 7 Jahren

Zuletzt geändert vor 6 Jahren

#1482 new enhancement

Improved Bluetooth networking support

Erstellt von: Z_God Verantwortlicher:
Priorität: normal Meilenstein: freetz-future
Komponente: packages Version: devel
Stichworte: Beobachter:
Product Id: Firmware Version:

Beschreibung (zuletzt geändert von ralf)

Bluetooth support is already available but it could use a few finishing touches to make it all perfect. Here I will put patches I create as I progress to making this work. In the end I want it to be possible to connect a Bluetooth dongle to a Fritzbox and have it automatically bridge it with the existing network.

Right now, it is necessary to enter the following commands through either telnet or ssh to enable Bluetooth:

modprobe -r hci_usb
modprobe hci_usb isoc=0
modprobe bnep
pand --master --listen --role NAP
brctl addif lan bnep0

Then it is possible to access the Fritzbox from another device using a standard pairing code which seems to be 1234.

Attached is the first patch which removes the need for the first two commands.
I already tried automating the rest through modprobe.conf as well using the install directive, but this does not seem to work properly.
hippie2000 recommended me to look into doing this through udev scripts instead. The commands that would still need to be executed are:

modprobe bnep
/usr/bin/pand --master --listen --role NAP --ethernet bnep0
/sbin/brctl addif lan bnep0

It is likely important that bnep0 is replaced with something so multiple Bluetooth dongles could be supported.

Anhänge (2)

hci_usb-modprobe.patch (606 Byte) - hinzugefügt von Z_God vor 7 Jahren.
Patch to fix modprobe.conf to allow the hci_usb module to work on a Fritzbox 7170 (also needed for other models?)
bluetooth-freetz (2.1 KB) - hinzugefügt von Z_God vor 7 Jahren.
step by step instructions (incomplete)

Alle Anhänge herunterladen als: .zip

Änderungshistorie (12)

Geändert vor 7 Jahren durch Z_God

Patch to fix modprobe.conf to allow the hci_usb module to work on a Fritzbox 7170 (also needed for other models?)

comment:1 Geändert vor 7 Jahren durch ralf

What kind of Bluetooth dongle are you using? I have a 0a12:0001 (Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)) that isn't even recognized when I connect it directly to the box. When I connect it through a switch, I get messages like

hub 1-1:1.0: Cannot enable port 1.  Maybe the USB cable is bad?

On a PC Linux the same device works. lsusb also reports some isochronous endpoints, and isochronous transfers are not supported by the USB host in the box.

comment:2 Geändert vor 7 Jahren durch ralf

  • Beschreibung geändert (Diff)

comment:3 Geändert vor 7 Jahren durch Z_God

Thanks for fixing the description! It seems we are using the same dongle. The Bluetooth dongle I'm using is a "Sitecom USB micro adapter" model CN-516 v2. On newer kernel versions it works with the btusb module and on the Fritzbox with the hci_usb module. I bought it this Monday (29th of August) at Paradigit (NL) specifically to try it with my Fritzbox. It is also listed like this by lsusb (on Ubuntu Lucid):
ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)

Maybe it is possible somehow that we have different devices but they report the same ID? What kind of Fritzbox are you using? I have a 7170 and I'm using Freetz 1.1.4 for now. Maybe you could try reloading the hci_usb module? When it is working you should see a hci0 device when you run hciconfig.

comment:4 Geändert vor 7 Jahren durch Z_God

I just got the same error about the bad USB cable after I unplugged from the hub and plugged it back into the same spot. Unplugging it again and plugging it into another spot on the hub allowed the dongle to work correctly again. Before it was also working properly in the original spot. It seems the USB support is a bit sensitive with hubs.

comment:5 Antwort: Geändert vor 7 Jahren durch Z_God

Seems my instructions are not fully correct and this is a bit more complicated than I thought. The bnep0 device is only created once a Bluetooth connection is established. I'm not sure yet how to automatically bridge it after this device has been created. Later versions of pand have a —devup switch that can take care of this, but the version included with Freetz 1.1.4 doesn't have it yet.
I guess every single Bluetooth connection will have it's own device to be bridged when it is connected.

comment:6 Geändert vor 7 Jahren durch ralf

I have a W900V with is very similar to a 7170. I didn't try to load the hci_usb module, because that wouldn't make a difference when the USB layer doesn't detect a device at all, lsusb didn't show anything.

You are right that the USB implementation is quite restricted. When I tried to connect low speed USB devices, I don't get any contact at all when they are direct connected and error messages when I connect them through a hub.

comment:7 Geändert vor 7 Jahren durch M66B

I would like to get this working too, for the simple reason the battery of my Android phone will last longer with a Bluetooth network connection than with a WiFi network connection.

I used the standard WebIf (Freetz 1.2, 7270v2) to setup things as outlined in the example and I could pair my phone, but after that I get a lot of times a dump (see below). I am also using the CN-516 through a USB-hub.

Maybe it is an idea to document what have to be done to get this working in the wiki here (config, commands, etc).

Question: what is against updating bluez from version 2.25 to the most recent version 4.96?

There seems to patch for version 3.36: ticket #602

Output of 'lsusb' on the box (relevant part):

BUS=001
DEV=010
VID=0a12
PID=0001
CLS=224
SCL=01
SPEED='full'
VER='2.0'
ISOC=1
INUM=2
ICLS1=224
ISCL1=01
ICLS2=224
ISCL2=01

Output of 'lsmod | grep bluetooth':

bluetooth              52487  3 rfcomm,l2cap,hci_usb

The dump:

Sep  2 08:16:46 fritz user.err kernel: WARN_ON: warning at net/core/skbuff.c:425/__kfree_skb()
Sep  2 08:16:46 fritz user.err kernel: Call Trace:
Sep  2 08:16:46 fritz user.err kernel: [<9400d914>] dump_stack+0x8/0x34
Sep  2 08:16:46 fritz user.err kernel: [<941797f0>] __kfree_skb+0x68/0x174
Sep  2 08:16:46 fritz user.err kernel: [<c061a708>] hci_usb_tx_complete+0x5c/0xffffc954 [hci_usb]
Sep  2 08:16:46 fritz user.err kernel: [<c0215ffc>] usb_hcd_giveback_urb+0xd4/0xffe6d0d8 [usbcore]
Sep  2 08:16:46 fritz user.err kernel: [<c01975d4>] musb_giveback+0x190/0xfff77bbc [musb_hdrc]
Sep  2 08:16:46 fritz user.err kernel: [<c0197f14>] musb_advance_schedule+0x4c/0xfff77138 [musb_hdrc]
Sep  2 08:16:46 fritz user.err kernel: [<c0198a74>] musb_h_ep0_irq+0x320/0xfff768ac [musb_hdrc]
Sep  2 08:16:46 fritz user.err kernel: [<c019580c>] musb_interrupt+0x280/0xfff79a74 [musb_hdrc]
Sep  2 08:16:46 fritz user.err kernel: [<c0196c94>] ur8musb_interrupt+0xa8/0xfff78414 [musb_hdrc]
Sep  2 08:16:46 fritz user.err kernel: [<94048aa8>] handle_IRQ_event+0x48/0xa0
Sep  2 08:16:46 fritz user.err kernel: [<94048bac>] __do_IRQ+0xac/0x130
Sep  2 08:16:46 fritz user.err kernel: [<94008954>] do_IRQ+0x1c/0x34
Sep  2 08:16:46 fritz user.err kernel: [<94007160>] ret_from_irq+0x0/0x8
Sep  2 08:16:46 fritz user.err kernel: [<940594a4>] unmap_vmas+0x5cc/0x608
Sep  2 08:16:46 fritz user.err kernel: [<9405edf0>] exit_mmap+0x70/0x128
Sep  2 08:16:46 fritz user.err kernel: [<940262bc>] mmput+0x44/0xd4
Sep  2 08:16:46 fritz user.err kernel: [<9402b37c>] do_exit+0x214/0x890
Sep  2 08:16:46 fritz user.err kernel: [<9402ba30>] do_group_exit+0x0/0xb0
Zuletzt geändert vor 7 Jahren von M66B (vorher) (Diff)

comment:8 als Antwort auf: ↑ 5 Geändert vor 7 Jahren durch MaxMuster

Replying to Z_God:

The bnep0 device is only created once a Bluetooth connection is established. I'm not sure yet how to automatically bridge it after this device has been created.

You should be able to let multid do this for you ;-) Try adding the device to the "brinterfaces" section in ar7.cfg (like it could be done with tap0 for openvpn).

comment:9 Geändert vor 7 Jahren durch Z_God

Perfect, it seems it's all coming together now. I found it is also possible to launch pand before plugging in a Bluetooth adapter and having them work together. This means there is no need to trigger anything based on the insertion of the Bluetooth adapter.

I saw the new Freetz version will already contain a proper start-up script for pand. I created a full set of instructions using those scripts here which I attached. There are still a few issues though.

The PIN doesn't change (from 1234). The script is not made executable.

Geändert vor 7 Jahren durch Z_God

step by step instructions (incomplete)

comment:10 Geändert vor 6 Jahren durch cuma

  • Meilenstein von freetz-1.3 nach freetz-future geändert
Hinweis: Hilfe zur Verwendung von Tickets finden Sie in TracTickets.