Method:Openwrt lua with serial port communication

Yes,as the caption show,I want to study how to find a way to make DB120's serial port communication with web page.Openwrt  choose the luci web page as the default.So lua language is the first gap to breakthrough.A simple i.e given as below:

#!/usr/bin/lua

io.output("/dev/ttyS0")

io.write(os.getenv("QUERY_STRING"))

openwrt route:

root@OpenWrt:~# cd /www/
root@OpenWrt:/www# ls
cgi-bin index.html luci-static resources
root@OpenWrt:/www# cat index.html
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="refresh" content="0; URL=/cgi-bin/luci" />
</head>
<body style="background-color: black">
<a style="color: white; text-decoration: none" href="/cgi-bin/luci">LuCI - Lua Configuration Interface</a>
</body>
</html>

posted on 2013-02-06 00:40  jnuyao  阅读(553)  评论(0编辑  收藏  举报