2004年10月11日

譬如web browser和bnep蓝牙设备的关系,web browser需不需要关心底层使用的
网络设备,如何通信?如何使用网络设备通信?
一个基本问题:
pand 建立连接后,才生成bnep*网络接口,
才可以配置ip地址,子网掩码,默认网关。
虚拟网桥的介绍:
因为一个nap可以连接7个pan设备,则对应的生成7个bnep*网络接口,
为了方便管理,可以将这7个设备加入同一个网段,由一个虚拟网桥管理。

4.1.bcsp协议的实现看完了,向下串口字符设备的驱动需要看
书,向上socket的实现没有查到,需要查阅linuxforum’s lxr.
4.2.需要看一本关于linux kernel的书,下载understanding
linux kernel第二版。
4.3.需要下载linux kernel network方面的书,了解iptables
的设置,实现。
4.4.web browser与网络接口的关系?是否仅仅与socket有关。
4.5.查找或询问有没有路有器的开发板?最好有三个网络芯片。
4.6.linux kernel细节
4.6.1.tasklet结构是干什么用的?以及与它相关的一些函数。

2004年09月23日

开发板买来后的基本工作:

1.在开发板提供的内核上贴bluez-kernel patch;(注意内核的版本号)

打完补丁后,内核要重新交叉编译;

2.交叉编译bluez-lib以及bluez-util;(主要是调整编译选项,注意安装目录)

应该请教一下别人;

3.阅读使用蓝牙上网的文章

5.网络浏览器

4.可不可以移植gnome or kde的蓝牙子系统到嵌入式平台上去呢?

需要发信询问。

2004年09月12日

1.阅读打印的两篇文章,如有可能,应该考虑演示

2.给老师公司帐号

2004年09月09日

BlueZ 2.3 setup

Maksim and their friends are working too hard, and BlueZ has matured significantely since I last tested it, so it was time to revisit the issue. With version 2.2, the most interesting new feature is of course PAN/BNEP support. With version 2.3, we have the new RfCOMM support which is a big improvement.

So, I did again limited testing with BlueZ 2.2, both with the Brainboxes Pcmcia card and the USB dongle. I also did extensive testing of BlueZ 2.3 with the 3Com 3CREB96 USB dongle. A lot of the tools and procedure have changed with respect to BlueZ 1.2

As opposed to OpenBT, BlueZ use a network abstraction to interface both to drivers and applications. BlueZ need special network driver for serial and USB devices, and BlueTooth devices will be referenced as hciX (most often hci0). Applications talk to the BlueZ stack using sockets (using the AF_BLUETOOTH family).

Common configuration

The BlueZ web site already contains an excellent Howto, so you may want to start by reading that…

To enable BlueZ, you will need to do the following operations :

  1. Get a fairly recent Linux kernel, BlueZ 2.3 is included in kernel 2.4.21-pre3 and later.
  2. Enable BlueZ and related options in your kernel, under the menu Bluetooth support.
  3. Compile and reinstall your kernel.
  4. Download and install the BlueZ library package.
  5. Download and install the BlueZ utilities and BlueZ sdp package. Those will compile only if the library is fully installed.
  6. Optionally, download and install the hcidump package. It’s a good debugging tool and necessary to do proper bug reports.
  7. Download and install the PAN package. This will compile only if both the utils and sdp packages are fully installed.

To get module auto-loading to work, you need to add in /etc/modules.conf the following :

alias net-pf-31 bluez alias bt-proto-0 l2cap alias bt-proto-2 sco alias bt-proto-3 rfcomm alias bt-proto-4 bnep 

BlueZ and the USB dongle

BlueZ has strong support for USB dongles. As opposed to OpenBT, BlueZ doesn’t use the BlueTooth USB to serial converter, but uses its own USB driver (and of course, you can’t have both running at the same time).

First, you need to get the USB stack up and running. This depend on your USB controller (UHCI vs OHCI).

To get you USB dongle working, you then need to do :

> modprobe bluez > modprobe hci_usb > modprobe l2cap > hciconfig hci0 up 

BlueZ and the Brainboxes Pcmcia card

The version 1.6 of BlueZ has changed the way serial devices are initialised. Instead of using hcid, you will need to use hciattach.

My obsolete patchthat adds CSR chip support to hciattach has been included in BlueZ 2.0 (and improved), so it will work out of the box at 460800 bauds. With a few more patches you will be able to do 921600 bauds.

You start the stack like this :

> modprobe bluez > modprobe hci_uart > modprobe l2cap > hciattach /dev/ttyS2 csr 460800 > hciconfig hci0 up 

TCP/IP over PAN/BNEP

PAN and BNEP are the “official” way to do networking with BlueTooth. BNEP is a simple encapsulation of Ethernet frames in a L2CAP session. PAN is the BlueTooth profile using BNEP and defining how to do networking. It includes the definition of the SDP attributes and various node roles.

What are the node roles ? It’s just something to make your life more complex. In a typical Ad-Hoc scenario, the server will have the role GN, and up to 7 clients with role PANU can be connected to it. An Access Point would take a NAP (yeah, boring).

The support of BNEP in BlueZ is quite new and and not yet documented in the Official Howto, but there is an alternate Unofficial Howto.

As usual, I’ll go straight to a very simple example of setting up TCP/IP between two nodes. You can do more complex stuff by reading the Howto above.

First, you need to set up the server. The server will listen for incomming connections. In our example, it’s not an Access Point, so we do :

> modprobe bnep > pand --listen --role GN 

On the client side, we first need to know the address of the server ; the inquiry is currently done like this :

> hcitool inq Inquiring ... 50:C2:00:03:C4:DC clock offset: 0x2454 class: 0x020300 

Now, you just need to connect to the other side :

> modprobe bnep > pand --connect 50:C2:00:03:C4:DC 

Unfortunately, pand can fail silently, so the way to check if this succeed is to see if a new device bnep0 has been created, either using cat /proc/net/dev or ifconfig bnep0. You may notice that the interface is down, that’s perfectly normal at this point. In case of problem, you need to check the logs for details, in my case /var/log/daemon.log.

What’s left ? BNEP is only a Ethernet emulation. We need to configure TCP/IP on the new interface. This is done with :

> ifconfig bnep0 10.10.10.1 broadcast 10.10.10.255 netmask 255.255.255.0 

Just remember that you need to assign an different IP address on each node, otherwise it won’t work. After that, you should be able to ping, telnet and all that jazz.

To terminate your connection on the client, just do :

> ifconfig bnep0 down > pand --kill 50:C2:00:03:C4:DC 

If you want to get more fancy, you can use HotPlug to automatically assign IP addresses to the bnep interfaces, and you can start playing with the SPD to know which node support PAN or not. And, if you want to build an Access Point, you will need to enable bridging. The HOWTO explains that in details.

努力