josar
Posts: 41
Joined: Sun Jan 19, 2014 1:29 am

OWFS and w1 not working after upgrade

Thu Feb 05, 2015 3:17 pm

With the new firmware and Device Tree for hardware configuration I am not able to make owserver (OWFS) work with w1 kernel module. Prior to upgrade everything worked like charm.

I have added

Code: Select all

dtoverlay=w1-gpio,gpiopin=4
to /boot/config.txt and rebooted. The w1_therm and w1-gpio modules are loaded and I can access temperature reading of the DS18B20 1-wire sensors via

Code: Select all

cat /sys/bus/w1/devices/28-00000559012c/w1_slave
I start the owserver with

Code: Select all

owserver --w1
It starts correctly but I am not able to read the data via owread neither list the sensors via owdir. The commands just "freeze" unless terminated with Ctrl-C.

I am using default Raspbian image, OWFS version is 2.8p15 (the newest version is 3.0p0 but I have not tested it yet).

Any hints on this?

josar
Posts: 41
Joined: Sun Jan 19, 2014 1:29 am

Re: OWFS and w1 not working after upgrade

Fri Feb 06, 2015 7:11 am

Update: upgrading OWFS to 3.0p0 did not help, still the same... :(


josar
Posts: 41
Joined: Sun Jan 19, 2014 1:29 am

Re: OWFS and w1 not working after upgrade

Sun Feb 08, 2015 10:49 pm

Thanks for the reply, but I have already studied the proposed post. As I have stated, I am able to read the temperatures via /sys/bus/w1/devices/28-00000559012c/w1_slave but I am not able to read them via OWFS (owserver), which is the problem I am trying to solve.

KevinJStricklin
Posts: 1
Joined: Wed Feb 18, 2015 5:39 pm

Re: OWFS and w1 not working after upgrade

Wed Feb 18, 2015 5:45 pm

I'm having the exact same problem. Getting data from /sys/bus/w1/devices/* works, but when I attempt to read from /mnt/1wire, my session hangs for 15 to 30 seconds. (i.e. when I enter "ls /mnt/1wire", a few blank lines appear and then approximately 30 seconds pass before my prompt returns.)

Is anyone else having this problem? Or better yet, has anyone solved this problem?

josar
Posts: 41
Joined: Sun Jan 19, 2014 1:29 am

Re: OWFS and w1 not working after upgrade

Sun Feb 22, 2015 11:02 pm

After apt-get upgrade I am able to read the temperature with

Code: Select all

owread /28.1228EF040000/temperature12
Nevertheless, the owdir command runs for a minute and lists no sensors. That's strange. Here is the output of owserver running in debug mode while processing the owdir command (hope somebody can read something useful from it):

Code: Select all

DEBUG MODE
libow version:
        2.8p15
NLMSGHDR: len=48 type=3 (NLMSG_DONE) flags=5 seq=0|1 pid=4681
CN_MSG: idx/val=3/1 (CN_W1_IDX) seq=0|1 ack=1 len=12 flags=0
W1_NETLINK_MSG: type=6 (W1_LIST_MASTERS) len=0 id=0
W1_NETLINK_CMD: NULL w1c field
NULL data
NLMSGHDR: len=52 type=3 (NLMSG_DONE) flags=0 seq=0|1 pid=0
CN_MSG: idx/val=3/1 (CN_W1_IDX) seq=0|1 ack=2 len=16 flags=25460
W1_NETLINK_MSG: type=6 (W1_LIST_MASTERS) len=4 id=1852793646
W1_NETLINK_CMD: NULL w1c field
Byte buffer Data, length=4
--000: 01 00 00 00
   <....>
NLMSGHDR: len=52 type=3 (NLMSG_DONE) flags=5 seq=1|1 pid=4681
CN_MSG: idx/val=3/1 (CN_W1_IDX) seq=1|1 ack=65537 len=16 flags=0
W1_NETLINK_MSG: type=4 (W1_MASTER_CMD) len=4 id=1
W1_NETLINK_CMD: cmd=2 (W1_CMD_SEARCH) len=0
NULL data
NLMSGHDR: len=60 type=3 (NLMSG_DONE) flags=0 seq=1|1 pid=0
CN_MSG: idx/val=3/1 (CN_W1_IDX) seq=1|1 ack=65538 len=24 flags=0
W1_NETLINK_MSG: type=4 (W1_MASTER_CMD) len=12 id=1
W1_NETLINK_CMD: cmd=2 (W1_CMD_SEARCH) len=8
Byte buffer Data, length=8
--000: 28 12 28 EF 04 00 00 A0
   <(.(.....>
NLMSGHDR: len=60 type=3 (NLMSG_DONE) flags=0 seq=1|1 pid=0
CN_MSG: idx/val=3/1 (CN_W1_IDX) seq=1|1 ack=65538 len=24 flags=0
W1_NETLINK_MSG: type=4 (W1_MASTER_CMD) len=12 id=1
W1_NETLINK_CMD: cmd=2 (W1_CMD_SEARCH) len=8
Byte buffer Data, length=8
--000: 28 12 28 EF 04 00 00 A0
   <(.(.....>
NLMSGHDR: len=52 type=3 (NLMSG_DONE) flags=0 seq=1|1 pid=0
CN_MSG: idx/val=3/1 (CN_W1_IDX) seq=1|1 ack=65537 len=16 flags=0
W1_NETLINK_MSG: type=4 (W1_MASTER_CMD) len=4 id=1
W1_NETLINK_CMD: cmd=2 (W1_CMD_SEARCH) len=0
NULL data
NLMSGHDR: len=52 type=3 (NLMSG_DONE) flags=0 seq=1|1 pid=0
CN_MSG: idx/val=3/1 (CN_W1_IDX) seq=1|1 ack=65537 len=16 flags=0
W1_NETLINK_MSG: type=4 (W1_MASTER_CMD) len=4 id=1
W1_NETLINK_CMD: cmd=2 (W1_CMD_SEARCH) len=0
NULL data

mrpetrov
Posts: 19
Joined: Sun Mar 08, 2015 3:44 pm

Re: OWFS and w1 not working after upgrade

Mon Mar 09, 2015 8:09 pm

I'm currently experiencing just that - delay, huge delay, and on top of that - one sensor missing.

My setup: I have Raspberry Pi 2 with 4 waterproof DS18B20 sensors (the ones in a metal can on a flying lead) connected to the Pi like shown here link.

Yesterday I was able to make a Python script that reads all 4 of the sensors in just 3 or 4 seconds, and now that I am trying to make it work with owfs - I get it to read just 3 of the sensors, and like KevinJStricklin said - something like 30 seconds for a simple "ls /mnt/1wire"...

Ideas?

marcin1j
Posts: 1
Joined: Sun Jun 28, 2015 9:12 pm

Re: OWFS and w1 not working after upgrade

Sun Jun 28, 2015 11:26 pm

Owserver hangs because underlying library (owlib) incorrectly interacts with userspace-kernel connector (netlink socket). In fact, if there weren't an alarm signal after 30 second of inactivity, it would hang forever.

The code responsible for this endless loop is located in file module/owlib/src/c/ow_w1_parse.c (lines 257-259):

Code: Select all

253                 if ( nlp.cn->ack != 0 ) {
254                         if ( nlp.w1m->type == W1_LIST_MASTERS ) {
255                                 continue ; // look for more data
256                         }
257                         if ( nlp.w1c && (nlp.w1c->cmd==W1_CMD_SEARCH || nlp.w1c->cmd==W1_CMD_ALARM_SEARCH) ) {
258                                 continue ; // look for more data
259                         }
260                 }
I experienced this bug in owfs versions 2.8 and 2.9 and I'm pretty sure it's still present in recent version. After recent kernel kernel w1 subsystem rewrite there's inconsistency between kernel and libow code. The official documentation still states that the last message from kernel should have ack=0. However, commit 8a0427d changed the documented behavior and the last message is no longer marked in such a way.

You can test a patch I've created for a custom OpenWRT package (actually a router, not RaspPi). The version of owfs you're using (2.8, 2.9. 3.0. 31) is not particularly important, it should apply cleanly as the w1-related code seems to be unmaintained.

Edit: I suggest to use this revorked patch which avoids potential segfault (it never happened to me, though). You may also be interested in the patch fixing npe in bus reset routine.

Thomas38
Posts: 1
Joined: Tue Jun 30, 2015 4:50 pm

Re: OWFS and w1 not working after upgrade

Tue Jun 30, 2015 5:05 pm

Thanks for the patch !
After month of trouble with owfs it works now like a charm !

Thomas

josar
Posts: 41
Joined: Sun Jan 19, 2014 1:29 am

Re: OWFS and w1 not working after upgrade

Sun Jul 05, 2015 1:28 am

You are my hero! Thanks a lot!

aliasxneo
Posts: 12
Joined: Thu Sep 25, 2014 2:46 am

Re: OWFS and w1 not working after upgrade

Sun Nov 29, 2015 10:31 am

Hello,

Sorry to raise this topic from the dead, but it's the top search result when searching for this issue on Google.

Can someone explain to a beginner how to apply the aforementioned patch to a Raspberry Pi 2? I'm a novice to linux but this is the only solution to get my sensor talking with OWFS.

jgalak
Posts: 5
Joined: Sun Sep 20, 2015 3:47 pm

Re: OWFS and w1 not working after upgrade

Mon Nov 30, 2015 8:41 pm

I, too, would like to know how to apply the patch. I'm in the same boat as alieasxneo.

I tried what I thought was the correct procedure to download sources, change the code, and build the package, but it didn't work - no noticeable change in behavoir.

josar
Posts: 41
Joined: Sun Jan 19, 2014 1:29 am

Re: OWFS and w1 not working after upgrade

Fri Dec 04, 2015 11:32 am

I just tested the whole procedure on Raspbian Wheezy and I can confirm that the patch no longer works :(

Any idea? Anyone?

jgalak
Posts: 5
Joined: Sun Sep 20, 2015 3:47 pm

Re: OWFS and w1 not working after upgrade

Fri Dec 04, 2015 2:01 pm

Yeah, after beating my head against the patch for hours, I finally got it built. And it did not work.

Janka
Posts: 11
Joined: Mon Apr 21, 2014 9:12 pm

Re: OWFS and w1 not working after upgrade

Sun Dec 06, 2015 8:08 pm

Please just ask these things on our OWFS mailing list. We are communicative, but we honestly can't check all the places where people meet who are using our software.

Jan

Return to “Interfacing (DSI, CSI, I2C, etc.)”