tag -1 +moreinfo

On Tue, 2017-01-24 at 13:39 +0100, Michaël Marchegay wrote:
> Package: qcontrol
> Version: 0.5.5-2
> 
> After a fresh install of stretch, qcontrold won't start on TS-410.
> 
> I had to apply the following patch in order to make it working :
> 
> root@qnap:/etc/qcontrol# diff -u ts41x.lua.orig ts41x.lua
> --- ts41x.lua.orig 2017-01-24 13:28:27.532867707 +0100
> +++ ts41x.lua 2017-01-24 13:18:19.346032258 +0100
> @@ -117,7 +117,7 @@
>   return evalfn(results[3])
>   end
> 
> - local v=gpio:read("*n")
> + local v=gpio.read("*n")

I'm not sure what is wrong with your system but I am pretty sure the
above is not the fix since it is not a valid operation on a Lua file
descriptor object (i.e. something returned by io.open() which gpio is
here).

For example on my TS-419 after running:
    # echo -n 42 > /sys/class/gpio/export

Then from a Lua repl I get:
    # lua5.1 
    Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio
    > path=string.format("/sys/class/gpio/gpio%d/value", 42)
    > =path
    /sys/class/gpio/gpio42/value
    > gpio=io.open(path)
    > =gpio
    file (0x80d10bb0)
    > v = gpio.read("*n")
    stdin:1: bad argument #1 to 'read' (FILE* expected, got string)
    stack traceback:
            [C]: in function 'read'
            stdin:1: in main chunk
            [C]: ?
    > v = gpio:read("*n")
    > =v
    1

This is exactly what I would expect since the gpio.read function
expects gpio itself as the first argument -- which is what the
gpio:read syntax does:
    gpio:read(args)
is equivalent to:
    gpio.read(gpio, args)

I'm not sure how the change you made fixed things, perhaps by throwing
the exception it skipped all the rest.

Please could you provide more info about the failure you are seeing
with your ts41x.lua unmodified, i.e. logs etc.

Ian.

Reply via email to