• 10 dec 2017: forum version update. In case of issues use this topic.
  • 30 nov 2017: pilight moved servers. In case of issues use this topic.
Hello There, Guest! Login Register


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[fixed] bug in protocols requiring gpio-platform parameter
#1
Hi,

Looks like in the 'rewrite' pilight branch there is a config validating bug. If protocol requires
the parameter 'gpio-platform' to be set than validation fails.

I have spotted it in the dth11.c code but I think others are are affected as well.

As far as I can see, this is happening because 'storage_read' functions sends for validation only devises subtree which does not have 'gpio-platform' parameter since it is stored in the 'settings' json subtree. Than everything just fails.

The relevant part of the 'storage_read' function is
Code:
if(((objects & CONFIG_DEVICES) == CONFIG_DEVICES || (objects & CONFIG_ALL) == CONFIG_ALL) &&
                storage->devices_select(ORIGIN_CONFIG, NULL, &json) == 0) {
                json_clone(json, &jdevices_cache);
                if(storage_devices_validate(jdevices_cache) == -1) {
                        return -1;
                }
        }

The minimal config to reproduce it is
Code:
{
        "devices": {
                "humi": {
                        "protocol": [ "dht11" ],
                        "id": [{
                                "gpio": 9
                        }],
                        "humidity": 36.0,
                        "temperature": 22.0,
                        "poll-interval": 10
                }
        },
        "gui": {},
        "rules": {},
        "settings": {
                "log-level": 6,
                "pid-file": "/var/run/pilight.pid",
                "log-file": "/var/log/pilight.log",
                "gpio-platform": "bananapi_m2",
                "webserver-enable": 1,
                "webserver-root": "/usr/local/share/pilight/",
                "webserver-http-port": 5001,
                "webserver-https-port": 5002,
                "webserver-cache": 1,
                "whitelist": ""
        },
        "hardware": {
                "none": {}
        },
        "registry": {}
}

Unfortunately, I am not skilled enough to see how to modify the code without damaging the 'rewrite' branch philosophy.
 
Reply
#2
Should be fixed.
 
Reply
#3
(05-15-2016, 09:32 AM)curlymo Wrote: Should be fixed.
Confirming. It is fixed.
 
Reply
  


Possibly Related Threads...
Thread Author Replies Views Last Post
  [fixed] bug fix for ds18b20.c rewrite branch beaming 1 1,246 05-13-2016, 06:27 AM
Last Post: curlymo
Bug [Solved] no gpio-platform configured koos147 5 7,700 04-20-2016, 08:01 PM
Last Post: ksmedts

Forum Jump:


Browsing: 1 Guest(s)