#56 OWFS bug? on TP-Link703 w/ trunk (r35608)

Jeff Engelbrecht

Here's the situation:
ufans@ubuntu-desktop:~$ ssh root@
root@'s password:
| |.-----.-----.-----.| | | |.----.| |

| - || _ | -| || | | ||
|| |
|| |||__||||| |_|
|| W I R E L E S S F R E E D O M
BARRIER BREAKER (Bleeding Edge, r35608)

root@OpenWrt:/home/1wire_admin# owfs -F -u -m /home/1wire/
DEFAULT: ow_usb_msg.c:DS9490_open(276) Opened USB DS9490 bus master at 1:4.
DEFAULT: ow_usb_cycle.c:DS9490_ID_this_master(191) Set DS9490 1:4 unique id to 81 60 66 2A 00 00 00 8F
root@OpenWrt:/home/1wire_admin# ./1wire-print.sh
Reef Temp on 1F.FFD003000000/aux/10.F9C354010800/temperature
Living Room Temp on 1F.58D803000000/aux/10.D52555010800/temperature
Relay Board on /home/1wire/29.91F907000000/sensed.ALL
The 5th 0 [ZERO] should be a 1
Here's the image of the triggered input that caused the relay to trip:
tiny arrow
Not sure where to go with this.. I've diagnosed everything several times. I had all of this working for a couple years on a dedicated server but am now trying to get it all miniaturized onto a TP-link 703 box.
Thoughts? Suggestions?
I've gotten some feedback on other forums that indicate that the cause may be a TP-link hardware problem, but I'm thinking it has more to do with OWFS.

I'm running owfs 2.8p13-1
installed package from: http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/


  • After trying a few things I uncovered this. When the I/O Relays are NOT triggered and I read 'sensed.BYTE' it returns '255'. When the I/O #5 is triggered like above and I read 'sensed.BYTE' it returns '239'. That indicates that the DS2408 is indicating a change in state, but the OWLIB and/or OWFS is not reading it correctly. ?

  • Paul Alfille
    Paul Alfille

    So you are finding that sensed.ALL and sensed.BYTE are inconsistent?

  • correct.

    sensed.BYTE=239(0b11101111) <> sensed.ALL=0,0,0,0,0,0,0,0

  • Paul, any ideas on what code is causing the problem? There are a couple other people using OWFS on OpenWRT (linux for routers) and have trouble with the DS2408 code.

    OWFS(DS2408) works fine for OpenWRT-OWFS distributions compiled for Broadcom 4710 platforms, but doesn't work for OpenWRT-OWFS distributions complied for Atheros AR71xx.

    Atheros AR71xx platforms use Big Endian and Broadcom 47xx platforms use Little Endian. It appears that OWFS works fine for Little Endian platforms, but I've tried two Big Endian platforms and both have failed to read DS2408 sensed.xxx correctly, yet I can get sensed.BYTE values. Could that be the cause?

    ref: https://dev.openwrt.org/wiki/platforms

  • kd0t

    Join to the described problem. Can confirm it on my TP-Link WR703N. Can You please make a patch for big endian devices. And in future versions make a configure option to slove this problem. Many Openwrt-running devices looks good as small network 1-wire masters, but many popular of them are big endian.

  • Here is the code for my work-around. It works great. (Sorry for the formatting)
    # Function to reverse the string and flip binary bits
    function Big2LittleBinFlip {
    for((i=$len-1;i>=0;i--)); do
    case "${copy:$i:1}" in
    1) new="0"
    0) new="1"
    *) new="${copy:$i:1}"
    echo "$rev"

    function Decimal2Bin {
    echo "obase=2;$1" | bc | tr -d '\n'

    function rev {
    for((i=$len-1;i>=0;i--)); do rev="$rev${copy:$i:1}"; done
    echo "$rev"

    if [ $1 -eq 1 ]; then
    ds2408_Sensed_BYTE=$(cat /home/1wire/29.91F907000000/sensed.BYTE)

    #Get convert relay BYTE to binary
    ds2408_Sensed_BIN=$(Decimal2Bin $ds2408_Sensed_BYTE)

    #Reverse and flip bits and add a character spacer for 0 index
    ds2408_Sensed_BIN_LittleE="N$(Big2LittleBinFlip $ds2408_Sensed_BIN)"

    #Put into array
    array_LittleE=($(echo $ds2408_Sensed_BIN_LittleE | sed 's/(.)/\1 /g'))