[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [mihini-dev] Lua Remote Application / Mihini GPIO
|
Hello Laurent,
I have managed to build the devicetree
gpio library and it is now loading fine. Thanks Guilhem for helping on
that.
Now, it seems I got some issues with
the devicetree library. I am running my app via ssh ( "Run As"
in LDT ), but I do not see the blinking LED.
My code is as follows:
local
log
= require "log"
local
sched
= require "sched"
local
gpio
= require "gpio"
local
dt
= require "devicetree"
local
function
main()
log("GENERAL",
"INFO",
"Starting...")
result, error
= dt.init()
print(result)
i = 1
--
local val = gpio.configure(18, {direction="out", edge="none",
activelow="0"})
dt.set("system.gpio.settings.18.direction",
"out")
dt.set("system.gpio.settings.18.edge",
"none")
dt.set("system.gpio.settings.18.activelow",
"0")
while
(true)
do
log("GENERAL",
"INFO",
"My first Mihini app
is alive :) oxoxo ".. i)
i = i
+ 1
--gpio.write(18,
1)
dt.set("system.gpio.18",
1)
sched.wait(0.1)
--
gpio.write(18, 0)
dt.set("system.gpio.18",
0)
sched.wait(0.1)
end
end
sched.run(main)
sched.loop()
I am running this as root and no blinking
LED can be seen. If I change it to use the gpio library (the commented
out code), it works fine. So, the pin id (18 in my case) should not be
the cause of the problem.
Any ideas?
Thanks,
Marcelo Nery dos Santos
Research Software Engineer
Phone:
55-21-2132-3663
E-mail:
mnerys@xxxxxxxxxx
| Av.
Pasteur 146 & 138
Rio de Janeiro, RJ
22290-240 - Brazil |
From:
mnerys@xxxxxxxxxx
To:
Mihini project developer
discussions <mihini-dev@xxxxxxxxxxx>
Date:
08/02/2013 02:52 PM
Subject:
Re: [mihini-dev]
Lua Remote Application / Mihini GPIO
Sent by:
mihini-dev-bounces@xxxxxxxxxxx
Hello Laurent,
Thanks for letting me know about these different behaviours regarding "Export"
and "Run As". I've indeed seen some ssh configuration under the
"Remote System Explorer", but I thought that for using "Run
As > Lua Remote Application", the Mihini agent should have to be
started first, which is not actually the case, since ssh is being used
instead. I could verify that here using "Run As" after doing
a "sudo
killall
agent appmon_daemon".
Regarding the ssh root launch, I changed the root password of my Raspberry
Pi logging in with the regular "pi" user and doing a "sudo
-i". After becoming root, I did a regular passwd to change the password
to something I know and could enter in Koneki. With that, the "Run
As" worked fine and I could use the GPIO library successfully with
the "Run As / Debug As". So, the issue is solved. \o/
I haven't tried the devicetree approach yet, but I'll have a look on it.
Thanks,
Marcelo Nery dos Santos
Research Software Engineer
Phone:
55-21-2132-3663
E-mail: mnerys@xxxxxxxxxx
| Av.
Pasteur 146 & 138
Rio de Janeiro, RJ
22290-240 - Brazil |
From: Laurent
Barthelemy <lbarthelemy@xxxxxxxxxxxxxxxxxx>
To: Mihini
project developer discussions <mihini-dev@xxxxxxxxxxx>
Date: 08/01/2013
11:40 AM
Subject: Re:
[mihini-dev] Lua Remote Application / Mihini GPIO
Sent by: mihini-dev-bounces@xxxxxxxxxxx
Hi,
Thank you for this feedback!
I’m glad to see the GPIO lib worked well on your Raspberry Pi.
Regarding your remarks:
GPIO mappings:
I understand your comment, and I agree we should help the user understanding
this GPIO mapping thing.
However I would rather keep the API doc ( http://download.eclipse.org/mihini/api/lua/gpio.htm
) generic, and add another document, something more like a “tutorial”.
I’m still unsure which form this will take, but we’ll definitively keep
the idea!
GPIO and "run as > Lua Remote Application"
I think the issue comes from user right problems.
When Koneki install the application using “Lua Application package”,
the application will be installed and start by Mihini Agent, using the
parameters you gave to the executable “appmon_daemon”.
It’s a little bit different when you start it as “Lua Remote Application":
Koneki copies and start the application using the SSH connection parameters.
It’s very likely you set up the Remote System Explorer with SSH parameter
for user pi, so the the application will be started with user pi when using
“Lua Remote Application".
There are several possibilities to change that.
One being, you can edit your Remote System Explorer config to use root
(but I think you can’t login/ssh to root by default on raspbian, so you
may need to search a way to change that).
Another thing, you can setuid on lua executable in mihini/bin that is used
to start Lua application…
I don’t really like much any of those for security concerns…
But, as I would say running as “Lua Remote Application” is more
for testing purpose, maybe It’s no big deal.
You can also change the way you use GPIOs:
- run Mihini Agent as root and keep application
run as pi
- let Mihini Agent acts on the GPIO using
devicetree GPIO lib
o you need to activate
it doing: “make agent_treemgr_gpio”
- change your application to use devicetree
API to access GPIO
o device tree API
http://download.eclipse.org/mihini/api/lua/devicetree.html
o GPIO device tree
variables doc : at the beginning of the source file: http://git.eclipse.org/c/mihini/org.eclipse.mihini.git/tree/agent/agent/treemgr/handlers/gpio.lua
Regards,
Laurent
De : mihini-dev-bounces@xxxxxxxxxxx [mailto:mihini-dev-bounces@xxxxxxxxxxx]
De la part de mnerys@xxxxxxxxxx
Envoyé : mardi 30 juillet 2013 19:43
À : Mihini project developer discussions
Objet : [mihini-dev] Lua Remote Application / Mihini GPIO
Hello All,
I was really glad to see the new Lua GPIO package being available in Mihini.
I am already able to make a blinking LED with the Raspberry Pi. \o/
I used the info here:
http://download.eclipse.org/mihini/api/lua/gpio.html
However, at first, it was quite hard to understand how to map the "id"
in a call "gpio.write(id, value)" to some actual pin on the device.
After some googling, I could find:
http://elinux.org/Rpi_Low-level_peripherals
which made me able to somehow identify the pins and their corresponding
ids. So, maybe the page http://download.eclipse.org/mihini/api/lua/gpio.html
could be improved to make it easier for newcomers to get their Pi and start
playing directly with Mihini GPIO library.
==
Next, in order to see the blinking LED, I am starting Mihini with the following
command (note the "-u root -g root" instead of the usual "-u
pi -p pi"):
cd ~/mihini
sudo ./bin/appmon_daemon -a
/home/pi/mihini/start.sh
-w
/home/pi/mihini -u root -g root -n 5 2>&1
With this, when I use Koneki to export a Lua Application package and the
app starts to run, I can see the blinking LED. I can also see the log of
my application being written to the shell I executed the command above.
So, now it comes my question regarding Koneki's ability to remotely run
and/or debug a Lua Application. After using Koneki to stop the recently
exported application, the log stops along with the blinking LED, as expected.
The LED keeps is now in a fixed state (either on/off depending on when
the stop occured)).
Going to the Lua perspective in Koneki; right-clicking the main.lua file;
and using "run as > Lua Remote Application", I can see the
log being written to Koneki's Console view, but the LED does not start
flashing.
If I stop the application (by clicking on the "stop" icon close
to the "Console view" header and I use the Remote System Explorer
perspective to start the app, then everything works again (I can see the
log on my shell window and I see the blinking LED).
Any ideas why running the main.lua as a Lua Remote Application is not being
able to make the LED blink while still showing the logs and starting the
remote process?
My main.lua file looks like this:
--
local log
= require "log"
local sched
= require "sched"
local gpio
= require "gpio"
local function
main()
i = 1
local
val
= gpio.configure(18,
{direction="out",
edge="none",
activelow="0"})
while
(true)
do
log("GENERAL",
"INFO",
"My first Mihini app
is alive :) oxoxoxo ".. i)
i = i + 1
gpio.write(18,
1)
sched.wait(0.1)
gpio.write(18,
0)
sched.wait(0.1)
end
end
sched.run(main)
sched.loop()
--
Thanks,
Marcelo Nery dos Santos
Research Software Engineer
Phone:
55-21-2132-3663
E-mail: mnerys@xxxxxxxxxx
| Av.
Pasteur 146 & 138
Rio de Janeiro, RJ
22290-240 - Brazil |
_______________________________________________
mihini-dev mailing list
mihini-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/mihini-dev
_______________________________________________
mihini-dev mailing list
mihini-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/mihini-dev