Re: IPSP sample with KW41Z-BLE controller gives error: No route to host (on Linux kernel 4.4.0-98)


Luiz Augusto von Dentz
 

Hi Priyanka,

On Mon, Nov 20, 2017 at 4:25 PM, Priyanka Rawat <priyanka.rawat@nxp.com> wrote:
Hi Luiz

Luiz: Does bluetoothctl or anything else works? Can you connect to the device directly with bluetoothctl> connect <bdaddr>?

Yes bluetoothctl works. I can connect <bdaddr>. Even hcitool lescan works though not always.

# hcitool dev
Devices:
hci0 00:04:9F:00:00:15

$ bluetoothctl
[NEW] Controller 00:04:9F:00:00:15 nxaXXXXX [default]
[NEW] Device 00:04:9F:00:00:15 Test IPSP node
How come your controller has the exact same address as the device you
are trying to connect?

[bluetooth]# scan on
Discovery started
[CHG] Controller 00:04:9F:00:00:15 Discovering: yes
[bluetooth]# power on
Changing power on succeeded
[bluetooth]# scan on
Failed to start discovery: org.bluez.Error.InProgress
[bluetooth]# scan on
Failed to start discovery: org.bluez.Error.InProgress
[bluetooth]# power on
Changing power on succeeded
[bluetooth]# scan on
Failed to start discovery: org.bluez.Error.InProgress
[bluetooth]# connect 00:04:9F:00:00:15
Attempting to connect to 00:04:9F:00:00:15
Connection successful
[Test IPSP node]#

hcitool lecc also works.

$ sudo hcitool lecc 00:04:9F:00:00:15
Connection handle 128

and I can see [Test IPSP node]#

In fact I can connect to the device in the first attempt, but it seems the connection drops right after that.
Afterwards, if I re-attach (hciattach) the hardware board (ble controller), it works again.

hcitool lescan also works and can discover IPSP node. Though it doesn't work all the time.

$ sudo hcitool lescan
LE Scan ...
00:04:9F:00:00:15 (unknown)
00:04:9F:00:00:15 Test IPSP node
2B:D0:07:2A:CC:15 (unknown)
45:18:78:BC:DD:6D (unknown)
59:D2:17:CF:8F:31 (unknown)
71:B0:7B:59:BC:29 (unknown)

What does not work is the following and hence, no bt interface is up.

# echo "connect 00:04:9f:00:00:15 1" > /sys/kernel/debug/bluetooth/6lowpan_control
bash: echo: write error: No route to host

On the zephyr side, it doesn't give any error.

$ hciconfig -a
hci0: Type: BR/EDR Bus: UART
BD Address: 00:04:9F:00:00:15 ACL MTU: 500:20 SCO MTU: 0:0
UP RUNNING
RX bytes:5576 acl:8 sco:0 events:380 errors:0
TX bytes:2337 acl:8 sco:0 commands:263 errors:0
Features: 0x00 0x00 0x00 0x00 0x60 0x00 0x00 0x00
Packet type: DM1 DH1 HV1
Link policy:
Link mode: SLAVE ACCEPT
Can't read local name on hci0: Input/output error (5)

Any suggestion on how to resolve this issue? Can't figure out if this is just a networking issue / firewall issue or Kernel issue.
Are you sure the address type is correct? Is it really

Thanks
Priyanka


-----Original Message-----
From: Luiz Augusto von Dentz [mailto:luiz.dentz@gmail.com]
Sent: Monday, November 20, 2017 1:56 PM
To: Priyanka Rawat <priyanka.rawat@nxp.com>
Cc: zephyr-users@lists.zephyrproject.org
Subject: Re: [Zephyr-users] IPSP sample with KW41Z-BLE controller gives error: No route to host (on Linux kernel 4.4.0-98)

Hi Priyanka,

On Mon, Nov 20, 2017 at 1:37 PM, Priyanka Rawat <priyanka.rawat@nxp.com> wrote:
Hi Luiz


I tried bluetoothctl> power on
However, this did not resolve the issue. I still get
bash: echo: write error: No route to host

I am on Linux Kernel version
Kernel 4.4.0-98 ( Ubuntu 16.04)
Anything before 4.12 is probably broken...

I wonder if I should upgrade my Linux kernel version ( / change to
another Linux distribution)?

Here is my strace, it shows coreutils.mo, libc.mo missing.
If you have any suggestion based on strace.

$strace echo "connect 00:04:9f:00:00:15 1" >
/sys/kernel/debug/bluetooth/6lowpan_control

execve("/bin/echo", ["echo", "connect 00:04:9f:00:00:15 1"], [/* 31
vars
*/]) = 0
brk(NULL) = 0x942000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or
directory)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) =
0x7fb0823b6000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or
directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 fstat(3,
{st_mode=S_IFREG|0644, st_size=129266, ...}) = 0 mmap(NULL, 129266,
PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fb082396000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or
directory)
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3,
"\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\t\2\0\0\0\0\0"...,
832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1868984, ...}) = 0 mmap(NULL,
3971488, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) =
0x7fb081dc9000
mprotect(0x7fb081f89000, 2097152, PROT_NONE) = 0 mmap(0x7fb082189000,
24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3,
0x1c0000) = 0x7fb082189000 mmap(0x7fb08218f000, 14752,
PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) =
0x7fb08218f000
close(3) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) =
0x7fb082395000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) =
0x7fb082394000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) =
0x7fb082393000
arch_prctl(ARCH_SET_FS, 0x7fb082394700) = 0 mprotect(0x7fb082189000,
16384, PROT_READ) = 0
mprotect(0x606000, 4096, PROT_READ) = 0
mprotect(0x7fb0823b8000, 4096, PROT_READ) = 0
munmap(0x7fb082396000, 129266) = 0
brk(NULL) = 0x942000
brk(0x963000) = 0x963000
open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=2985536, ...}) = 0 mmap(NULL,
2985536, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fb081af0000
close(3) = 0
fstat(1, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0 write(1, "connect
00:04:9f:00:00:15 1\n", 28) = -1 EHOSTUNREACH (No route to
host)
close(1) = 0
open("/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 1
fstat(1, {st_mode=S_IFREG|0644, st_size=2995, ...}) = 0 read(1, "#
Locale name alias data base.\n#"..., 4096) = 2995
read(1, "", 4096) = 0
close(1) = 0
open("/usr/share/locale/en_US/LC_MESSAGES/coreutils.mo", O_RDONLY) =
-1 ENOENT (No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1
ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en_US/LC_MESSAGES/coreutils.mo",
O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en/LC_MESSAGES/coreutils.mo",
O_RDONLY) = 1 fstat(1, {st_mode=S_IFREG|0644, st_size=619, ...}) = 0
mmap(NULL, 619, PROT_READ, MAP_PRIVATE, 1, 0) = 0x7fb0823b5000
close(1) = 0
write(2, "echo: ", 6echo: ) = 6
write(2, "write error", 11write error) = 11
open("/usr/share/locale/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1
ENOENT (No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT
(No such file or directory)
open("/usr/share/locale-langpack/en_US/LC_MESSAGES/libc.mo", O_RDONLY)
= -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en/LC_MESSAGES/libc.mo", O_RDONLY) =
-1 ENOENT (No such file or directory)
write(2, ": No route to host", 18: No route to host) = 18
write(2, "\n", 1
) = 1
exit_group(1) = ?
+++ exited with 1 +++

Thanks
Priyanka

________________________________
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Sent: Wednesday, November 15, 2017 1:03 PM
To: Priyanka Rawat
Cc: zephyr-users@lists.zephyrproject.org
Subject: Re: [Zephyr-users] IPSP sample with KW41Z-BLE controller
gives
error: No route to host (on Linux kernel 4.4.0-98)

Hi Priyanka,

On Tue, Nov 14, 2017 at 2:47 PM, Priyanka Rawat
<priyanka.rawat@nxp.com>
wrote:
Hello


I test KW41Z-BLE controller with Zepyhr sample IPSP running in QEMU
on Linux Kernel 4.4.0-98


I load 6lowpan module and enable bluetooth_6lowpan module


# modprobe bluetooth_6lowpan
# modprobe 6lowpan

# echo 1 > /sys/kernel/debug/bluetooth/6lowpan_enable


However, while connecting the device it gives error "no route to host"


# echo "connect 00:60:37:00:00:16 1" >
/sys/kernel/debug/bluetooth/6lowpan_control
bash: echo: write error: No route to host
I guess your adapter is not powered, try bluetoothctl> power on

Any idea what is missing here?


$ sudo hcitool -i hci1 lecc 00:60:37:00:00:16 Connection handle 32

Whereas this works fine when I test zephyr IPSP sample (BLE host)
with virtual BLE controller connected to QEMU serial line.


ifconfig shows bt0 up after connecting the virtual device


# echo "connect 00:aa:01:00:00:23 1" >
/sys/kernel/debug/bluetooth/6lowpan_control


# cat /sys/kernel/debug/bluetooth/6lowpan_enable
1

# cat /sys/kernel/debug/bluetooth/6lowpan_control
00:aa:01:00:00:23 (type 1)
Note, this is all being deprecated by:

https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww
.spinics.net%2Flists%2Flinux-bluetooth%2Fmsg72592.html&data=02%7C01%7C
priyanka.rawat%40nxp.com%7Cc6284a89d516418ff50808d52c20e7d2%7C686ea1d3
bc2b4c6fa92cd99c5c301635%7C0%7C0%7C636463442197027844&sdata=4jvlLU5JX%
2Fwon6epshV2B3EbkFTXMtLac4qzfU6abCA%3D&reserved=0

--
Luiz Augusto von Dentz


--
Luiz Augusto von Dentz


--
Luiz Augusto von Dentz

Join users@lists.zephyrproject.org to automatically receive all group messages.