[OpenWrt-Devel] [PATCH v3] lantiq: make zlib compression on ubifs the default for BTHOMEHUBV2B

2014-06-20 Thread Ben Mulvihill
On Fri, 2014-06-20 at 07:51 +0200, Ben Mulvihill wrote:
 On Thu, 2014-06-19 at 23:09 +0200, Ben Mulvihill wrote:
  Nand flash on the Home Hub 2B is 32M, so it makes sense at
  least for this board to use some sort of compression on
  ubifs. Of course anyone building trunk for themselves can
  choose whatever they want, but with a release coming up,
  I think compression should be the default in pre-built
  images. However, I have a question. Does it make sense
  for compression by default to be enabled/disabled on a
  board by board basis, or should it be the same for all
  lantiq targets, or perhaps all targets full stop?
  
  Thanks,
  
  Ben
  
 
 P.S. Sorry, missed the sign-off from the first one.

P.P.S. I'm not doing very well this time. Trying to do things
in a hurry. v3 is the right one.

Signed-off-by: Ben Mulvihill ben.mulvih...@gmail.com
---

--- a/config/Config-images.in   2014-06-19 22:44:40.962240035 +0200
+++ b/config/Config-images.in   2014-06-19 19:48:15.508299173 +0200
@@ -158,6 +158,7 @@ menu Target Images
 
choice
prompt compression
+   default TARGET_UBIFS_COMPRESSION_ZLIB if 
TARGET_lantiq_xway_BTHOMEHUBV2B
default TARGET_UBIFS_COMPRESSION_NONE
depends on TARGET_ROOTFS_UBIFS
help
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] WRT54GS v1.0 GPIO definitions in r41004

2014-06-20 Thread Rafał Miłecki
On 5 June 2014 19:20, Catalin Patulea c...@vv.carleton.ca wrote:
 Here is dmesg also:
 http://pastebin.com/ZHXdd3PK

 Note:
 [   12.58] gpio-keys gpio-keys.0: unable to claim gpio 6, err=-16
 [   12.66] gpio-keys: probe of gpio-keys.0 failed with error -16
 [   12.90] leds-gpio: probe of leds-gpio failed with error -16

This is because __gpiod_request returned -EBUSY.

Your nvram has following entries:
gpio6=adm_rc
gpio5=adm_eedi
gpio3=adm_eesk
gpio2=adm_eecs

All of the above GPIOs are reserved by adm6996. It means registering
LEDs failed (because GPIOs 2 and 3 were already in use) and
registering buttons failed (because GPIO 6 was already in use).

Could you find out, which GPIO is connected to your reset button?
Simply export all GPIOs that you can and execute
cat /sys/class/gpio/gpio*/value
then press the reset buttong and execute
cat /sys/class/gpio/gpio*/value
again. Look for the GPIO that changed it's value.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] mac filter on attitude_adjustment

2014-06-20 Thread bjzhougong
Dear Sir

I use attitude_adjustment in WR703n, and find macfilter doesn't work.
I get the latest AA from svn, and find there is any action in hostapd.sh
but in my AA version, there is not any function about mac filter.

Would you please tell me there is any patch on AA for mac filter, I want to 
port this feature to my version.
Thanks!



bjzhougong
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] WRT54GS v1.0 GPIO definitions in r41004

2014-06-20 Thread Rafał Miłecki
On 20 June 2014 08:28, Rafał Miłecki zaj...@gmail.com wrote:
 On 5 June 2014 19:20, Catalin Patulea c...@vv.carleton.ca wrote:
 Here is dmesg also:
 http://pastebin.com/ZHXdd3PK

 Note:
 [   12.58] gpio-keys gpio-keys.0: unable to claim gpio 6, err=-16
 [   12.66] gpio-keys: probe of gpio-keys.0 failed with error -16
 [   12.90] leds-gpio: probe of leds-gpio failed with error -16

 This is because __gpiod_request returned -EBUSY.

 Your nvram has following entries:
 gpio6=adm_rc
 gpio5=adm_eedi
 gpio3=adm_eesk
 gpio2=adm_eecs

Hauke: it seems nvram may be wrong there. According to the Catalin,
reset button uses GPIO 6. On the other hand it seems adm6996.c never
really uses eerc.

Any idea about solving this? A device-specific workaround? Commenting
out eerc in adm6996.c?
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH v3] lantiq: make zlib compression on ubifs the default for BTHOMEHUBV2B

2014-06-20 Thread John Crispin


On 20/06/2014 08:26, Ben Mulvihill wrote:
 On Fri, 2014-06-20 at 07:51 +0200, Ben Mulvihill wrote:
 On Thu, 2014-06-19 at 23:09 +0200, Ben Mulvihill wrote:
 Nand flash on the Home Hub 2B is 32M, so it makes sense at 
 least for this board to use some sort of compression on ubifs.
 Of course anyone building trunk for themselves can choose
 whatever they want, but with a release coming up, I think
 compression should be the default in pre-built images. However,
 I have a question. Does it make sense for compression by
 default to be enabled/disabled on a board by board basis, or
 should it be the same for all lantiq targets, or perhaps all
 targets full stop?
 
 Thanks,
 
 Ben
 
 
 P.S. Sorry, missed the sign-off from the first one.


Hi Ben,

i had a look at this problem aswell and i think we should globally
enable compression by default. i will ping felix about this and see
what he has to say.

John


 
 P.P.S. I'm not doing very well this time. Trying to do things in a
 hurry. v3 is the right one.
 
 Signed-off-by: Ben Mulvihill ben.mulvih...@gmail.com ---
 
 --- a/config/Config-images.in 2014-06-19 22:44:40.962240035 +0200 
 +++ b/config/Config-images.in 2014-06-19 19:48:15.508299173 +0200 
 @@ -158,6 +158,7 @@ menu Target Images
 
 choice prompt compression + default
 TARGET_UBIFS_COMPRESSION_ZLIB if TARGET_lantiq_xway_BTHOMEHUBV2B 
 default TARGET_UBIFS_COMPRESSION_NONE depends on
 TARGET_ROOTFS_UBIFS help 
 ___ openwrt-devel
 mailing list openwrt-devel@lists.openwrt.org 
 https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
 
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 5/5] Fix bug of GC in fd and timeout objects for lua binding.

2014-06-20 Thread xfguo
fd and timeout lua object has a __gc method in its metatable. After the object
is freed and the another new object use the same reference in __uloop_cb and
__uloop_fds, the new object will be freed by the old __gc of the old object
when garbag collecting.

Signed-off-by: Xiongfei(Alex) Guo xf...@credosemi.com
---
 lua/uloop.c | 25 ++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/lua/uloop.c b/lua/uloop.c
index 319942c..e806599 100644
--- a/lua/uloop.c
+++ b/lua/uloop.c
@@ -77,8 +77,15 @@ static int ul_timer_set(lua_State *L)
 static int ul_timer_free(lua_State *L)
 {
struct lua_uloop_timeout *tout = lua_touserdata(L, 1);
-
+   
uloop_timeout_cancel(tout-t);
+   
+   /* obj.__index.__gc = nil , make sure executing only once*/
+   lua_getfield(L, -1, __index);
+   lua_pushstring(L, __gc);
+   lua_pushnil(L);
+   lua_settable(L, -3);
+
lua_getglobal(state, __uloop_cb);
luaL_unref(state, -1, tout-r);
 
@@ -150,7 +157,6 @@ static void ul_ufd_cb(struct uloop_fd *fd, unsigned int 
events)
 
/* push events */
lua_pushinteger(state, events);
-
lua_call(state, 2, 0);
 }
 
@@ -175,9 +181,15 @@ static int get_sock_fd(lua_State* L, int idx) {
 static int ul_ufd_delete(lua_State *L)
 {
struct lua_uloop_fd *ufd = lua_touserdata(L, 1);
-
+   
uloop_fd_delete(ufd-fd);
 
+   /* obj.__index.__gc = nil , make sure executing only once*/
+   lua_getfield(L, -1, __index);
+   lua_pushstring(L, __gc);
+   lua_pushnil(L);
+   lua_settable(L, -3);
+
lua_getglobal(state, __uloop_cb);
luaL_unref(state, -1, ufd-r);
lua_remove(state, -1);
@@ -345,12 +357,19 @@ static int ul_run(lua_State *L)
return 1;
 }
 
+static int ul_cancel(lua_State *L)
+{
+   uloop_end();
+   return 1;
+}
+
 static luaL_reg uloop_func[] = {
{init, ul_init},
{run, ul_run},
{timer, ul_timer},
{process, ul_process},
{fd_add, ul_ufd_add},
+   {cancel, ul_cancel},
{NULL, NULL},
 };
 
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 3/5] Support delete a fd event.

2014-06-20 Thread xfguo
When you call the fd_add, it will return an object with `delete` method.
So you can delete that event if you want.

Signed-off-by: Xiongfei(Alex) Guo xf...@credosemi.com
---
 examples/uloop-example.lua | 17 ++---
 lua/uloop.c| 30 ++
 2 files changed, 44 insertions(+), 3 deletions(-)

diff --git a/examples/uloop-example.lua b/examples/uloop-example.lua
index ba34ec5..9b0684e 100755
--- a/examples/uloop-example.lua
+++ b/examples/uloop-example.lua
@@ -46,20 +46,31 @@ uloop.timer(
end, 2000
 )
 
-uloop.fd_add(udp, function(ufd, events)
+udp_ev = uloop.fd_add(udp, function(ufd, events)
local words, msg_or_ip, port_or_nil = ufd:receivefrom()
print('Recv UDP packet from '..msg_or_ip..':'..port_or_nil..' : 
'..words)
+   if words == Stop! then
+   udp_ev:delete()
+   end
 end, uloop.ULOOP_READ)
 
+udp_count = 0
 udp_send_timer = uloop.timer(
function()
local s = socket.udp()
-   local words = 'Hello!'
+   local words
+   if udp_count  3 then
+   words = Stop!
+   udp_send_timer:cancel()
+   else
+   words = 'Hello!'
+   udp_send_timer:set(1000)
+   end
print('Send UDP packet to 127.0.0.1:8080 :'..words)
s:sendto(words, '127.0.0.1', 8080)
s:close()
 
-   udp_send_timer:set(1000)
+   udp_count = udp_count + 1
end, 3000
 )
 
diff --git a/lua/uloop.c b/lua/uloop.c
index c71d537..df57b8a 100644
--- a/lua/uloop.c
+++ b/lua/uloop.c
@@ -172,6 +172,24 @@ static int get_sock_fd(lua_State* L, int idx) {
return fd;
 }
 
+static int ul_ufd_delete(lua_State *L)
+{
+   struct lua_uloop_fd *ufd = lua_touserdata(L, 1);
+
+   uloop_fd_delete(ufd-fd);
+   lua_getglobal(state, __uloop_cb);
+   luaL_unref(L, -1, ufd-r);
+   lua_getglobal(state, __uloop_fds);
+   luaL_unref(L, -1, ufd-fd_r);
+
+   return 1;
+}
+
+static const luaL_Reg ufd_m[] = {
+   { delete, ul_ufd_delete },
+   { NULL, NULL }
+};
+
 static int ul_ufd_add(lua_State *L)
 {
struct lua_uloop_fd *ufd;
@@ -205,6 +223,18 @@ static int ul_ufd_add(lua_State *L)
lua_pop(L, 1);
 
ufd = lua_newuserdata(L, sizeof(*ufd));
+
+   lua_createtable(L, 0, 2);
+   lua_pushvalue(L, -1);
+   lua_setfield(L, -2, __index);
+   lua_pushcfunction(L, ul_ufd_delete);
+   lua_setfield(L, -2, __gc);
+   lua_pushvalue(L, -1);
+   lua_setmetatable(L, -3);
+   lua_pushvalue(L, -2);
+   luaI_openlib(L, NULL, ufd_m, 1);
+   lua_pushvalue(L, -2);
+
memset(ufd, 0, sizeof(*ufd));
 
ufd-r = ref;
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 2/5] Added fd_add method for uloop lua binding.

2014-06-20 Thread xfguo
Use uloop.fd_add like this:

local socket = require socket

udp = socket.udp()

uloop.fd_add(
udp, -- socket
function( -- callback function
ufd,-- socket object when register the fd
events  -- uloop events. eg. uloop.ULOOP_READ .
)
local words, msg_or_ip, port_or_nil = ufd:receivefrom()
print('Recv UDP packet from '..msg_or_ip..':'..port_or_nil..' : 
'..words)
end,
uloop.ULOOP_READ -- event you want to listen
)

The `examples/uloop-example.lua` show an example of this work.

Signed-off-by: Xiongfei(Alex) Guo xf...@credosemi.com
---
 examples/uloop-example.lua |  23 ++
 lua/uloop.c| 111 +
 2 files changed, 134 insertions(+)

diff --git a/examples/uloop-example.lua b/examples/uloop-example.lua
index 2da6ebd..ba34ec5 100755
--- a/examples/uloop-example.lua
+++ b/examples/uloop-example.lua
@@ -1,8 +1,14 @@
 #!/usr/bin/env lua
 
+local socket = require socket
+
 local uloop = require(uloop)
 uloop.init()
 
+local udp = socket.udp()
+udp:settimeout(0)
+udp:setsockname('*', 8080)
+
 -- timer example 1
 local timer
 function t()
@@ -40,5 +46,22 @@ uloop.timer(
end, 2000
 )
 
+uloop.fd_add(udp, function(ufd, events)
+   local words, msg_or_ip, port_or_nil = ufd:receivefrom()
+   print('Recv UDP packet from '..msg_or_ip..':'..port_or_nil..' : 
'..words)
+end, uloop.ULOOP_READ)
+
+udp_send_timer = uloop.timer(
+   function()
+   local s = socket.udp()
+   local words = 'Hello!'
+   print('Send UDP packet to 127.0.0.1:8080 :'..words)
+   s:sendto(words, '127.0.0.1', 8080)
+   s:close()
+
+   udp_send_timer:set(1000)
+   end, 3000
+)
+
 uloop.run()
 
diff --git a/lua/uloop.c b/lua/uloop.c
index 5922e04..c71d537 100644
--- a/lua/uloop.c
+++ b/lua/uloop.c
@@ -25,6 +25,12 @@
 #include ../uloop.h
 #include ../list.h
 
+struct lua_uloop_fd {
+   struct uloop_fd fd;
+   int r;
+   int fd_r;
+};
+
 struct lua_uloop_timeout {
struct uloop_timeout t;
int r;
@@ -44,7 +50,9 @@ static void ul_timer_cb(struct uloop_timeout *t)
lua_getglobal(state, __uloop_cb);
lua_rawgeti(state, -1, tout-r);
lua_remove(state, -2);
+
lua_call(state, 0, 0);
+
 }
 
 static int ul_timer_set(lua_State *L)
@@ -127,12 +135,95 @@ static int ul_timer(lua_State *L)
return 1;
 }
 
+static void ul_ufd_cb(struct uloop_fd *fd, unsigned int events)
+{
+   struct lua_uloop_fd *ufd = container_of(fd, struct lua_uloop_fd, fd);
+
+   lua_getglobal(state, __uloop_cb);
+   lua_rawgeti(state, -1, ufd-r);
+   lua_remove(state, -2);
+
+   /* push fd object */
+   lua_getglobal(state, __uloop_fds);
+   lua_rawgeti(state, -1, ufd-fd_r);
+   lua_remove(state, -2);
+
+   /* push events */
+   lua_pushinteger(state, events);
+
+   lua_call(state, 2, 0);
+}
+
+
+static int get_sock_fd(lua_State* L, int idx) {
+   int fd;
+   if(lua_isnumber(L, idx)) {
+   fd = lua_tonumber(L, idx);
+   } else {
+   luaL_checktype(L, idx, LUA_TUSERDATA);
+   lua_getfield(L, idx, getfd);
+   if(lua_isnil(L, -1))
+   return luaL_error(L, socket type missing 'getfd' 
method);
+   lua_pushvalue(L, idx - 1);
+   lua_call(L, 1, 1);
+   fd = lua_tointeger(L, -1);
+   lua_pop(L, 1);
+   }
+   return fd;
+}
+
+static int ul_ufd_add(lua_State *L)
+{
+   struct lua_uloop_fd *ufd;
+   int fd = 0;
+   unsigned int flags = 0;
+   int ref;
+   int fd_ref;
+
+   if (lua_isnumber(L, -1)) {
+   flags = lua_tointeger(L, -1);
+   lua_pop(L, 1);
+   }
+
+   if (!lua_isfunction(L, -1)) {
+   lua_pushstring(L, invalid arg list);
+   lua_error(L);
+
+   return 0;
+   }
+
+   fd = get_sock_fd(L, -2);
+
+   lua_getglobal(L, __uloop_cb);
+   lua_pushvalue(L, -2);
+   ref = luaL_ref(L, -2);
+   lua_pop(L, 1);
+
+   lua_getglobal(L, __uloop_fds);
+   lua_pushvalue(L, -3);
+   fd_ref = luaL_ref(L, -2);
+   lua_pop(L, 1);
+
+   ufd = lua_newuserdata(L, sizeof(*ufd));
+   memset(ufd, 0, sizeof(*ufd));
+
+   ufd-r = ref;
+   ufd-fd.fd = fd;
+   ufd-fd_r = fd_ref;
+   ufd-fd.cb = ul_ufd_cb;
+   if (flags)
+   uloop_fd_add(ufd-fd, flags);
+
+   return 1;
+}
+
 static void ul_process_cb(struct uloop_process *p, int ret)
 {
struct lua_uloop_process *proc = container_of(p, struct 
lua_uloop_process, p);
 
lua_getglobal(state, __uloop_cb);
lua_rawgeti(state, -1, proc-r);
+
luaL_unref(state, -2, proc-r);
lua_remove(state, -2);
lua_pushinteger(state, ret  8);
@@ -225,6 +316,7 @@ static luaL_reg 

[OpenWrt-Devel] [PATCH 1/5] Fix stack overflow bug of uloop lua binding.

2014-06-20 Thread xfguo
The static variable `state` in `lua/uloop.c` should be clean after every 
callback.

Signed-off-by: Xiongfei(Alex) Guo xf...@credosemi.com
---
 lua/uloop.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lua/uloop.c b/lua/uloop.c
index 51f53c2..5922e04 100644
--- a/lua/uloop.c
+++ b/lua/uloop.c
@@ -43,6 +43,7 @@ static void ul_timer_cb(struct uloop_timeout *t)
 
lua_getglobal(state, __uloop_cb);
lua_rawgeti(state, -1, tout-r);
+   lua_remove(state, -2);
lua_call(state, 0, 0);
 }
 
@@ -133,6 +134,7 @@ static void ul_process_cb(struct uloop_process *p, int ret)
lua_getglobal(state, __uloop_cb);
lua_rawgeti(state, -1, proc-r);
luaL_unref(state, -2, proc-r);
+   lua_remove(state, -2);
lua_pushinteger(state, ret  8);
lua_call(state, 1, 0);
 }
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 1/5] Fix stack overflow bug of uloop lua binding.

2014-06-20 Thread John Crispin


On 20/06/2014 13:31, xf...@credosemi.com wrote:
 The static variable `state` in `lua/uloop.c` should be clean after
 every callback.
 
 Signed-off-by: Xiongfei(Alex) Guo xf...@credosemi.com ---


Hi,

just had a quick browse over the patches. looks good, the only nipick
i have is this

+static int ul_cancel(lua_State *L)
+{
+   uloop_end();
+   return 1;
+}

can we rename is to ul_end() and then also fix up {cancel,
ul_cancel} to use end instead of cancel. that way the apis have the
same names in lua and c. apart from that thanks for the patches, i
will give them a try later on and then merge them into the git.

John











 lua/uloop.c | 2 ++ 1 file changed, 2 insertions(+)
 
 diff --git a/lua/uloop.c b/lua/uloop.c index 51f53c2..5922e04
 100644 --- a/lua/uloop.c +++ b/lua/uloop.c @@ -43,6 +43,7 @@ static
 void ul_timer_cb(struct uloop_timeout *t)
 
 lua_getglobal(state, __uloop_cb); lua_rawgeti(state, -1,
 tout-r); +   lua_remove(state, -2); lua_call(state, 0, 0); }
 
 @@ -133,6 +134,7 @@ static void ul_process_cb(struct uloop_process
 *p, int ret) lua_getglobal(state, __uloop_cb); lua_rawgeti(state,
 -1, proc-r); luaL_unref(state, -2, proc-r); +   lua_remove(state,
 -2); lua_pushinteger(state, ret  8); lua_call(state, 1, 0); }
 
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] kernel: mtd-partial_eraseblock_erase

2014-06-20 Thread Maciej Skrzypek
mtd: allow partial block erase
This fixes error erasing partial mtd partition which does not start on
eraseblock boundary and allows using fconfig to configure redboot on
devices such as the Gateworks Cambria.

Maciej Skrzypek
Flytronic

Index:
target/linux/generic/patches-3.3/479-mtd-partial_eraseblock_erase.patch
===
---
target/linux/generic/patches-3.3/479-mtd-partial_eraseblock_erase.patch
(revision 0)
+++

target/linux/generic/patches-3.3/479-mtd-partial_eraseblock_erase.patch
(working copy)
@@ -0,0 +1,10 @@
+--- a/drivers/mtd/mtdpart.c
 b/drivers/mtd/mtdpart.c
+@@ -274,6 +274,7 @@ static int part_erase(struct mtd_info *m
+   part-master-erasesize,
+   readlen, instr-erase_buf);
+
++  instr-len += instr-erase_buf_ofs;
+   instr-partial_start = true;
+   } else {
+   mtd_ofs = part-offset + part-mtd.size
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] SysupgradeNAND: include rootfs-type in image name

2014-06-20 Thread Daniel Golle
so we can have images for different rootfs types, e.g.
*-ubifs-sysupgrage.tar as well as *-squashfs-sysupgrade.tar.

Also added quotes around pathnames.

Signed-off-by: Daniel Golle dan...@makrotopia.org
---
 include/image.mk   | 12 ++--
 target/linux/ar71xx/image/Makefile |  2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/include/image.mk b/include/image.mk
index 66ac497..ab953eb 100644
--- a/include/image.mk
+++ b/include/image.mk
@@ -134,12 +134,12 @@ endif
 # $(3): rootfs image
 ifneq ($(CONFIG_NAND_SUPPORT),)
define Image/Build/SysupgradeNAND
-   mkdir -p $(KDIR_TMP)/sysupgrade-$(1)/
-   echo BOARD=$(1)  $(KDIR_TMP)/sysupgrade-$(1)/CONTROL
-   [ -z $(2) ] || $(CP) $(2) $(KDIR_TMP)/sysupgrade-$(1)/kernel
-   [ -z $(3) ] || $(CP) $(3) $(KDIR_TMP)/sysupgrade-$(1)/root
-   (cd $(KDIR_TMP); $(TAR) cvf \
-   $(BIN_DIR)/$(IMG_PREFIX)-$(1)-ubi-sysupgrade.tar 
sysupgrade-$(1))
+   mkdir -p $(KDIR_TMP)/sysupgrade-$(1)/
+   echo BOARD=$(1)  $(KDIR_TMP)/sysupgrade-$(1)/CONTROL
+   [ -z $(2) ] || $(CP) $(KDIR)/root.$(2) 
$(KDIR_TMP)/sysupgrade-$(1)/root
+   [ -z $(3) ] || $(CP) $(3) $(KDIR_TMP)/sysupgrade-$(1)/kernel
+   (cd $(KDIR_TMP); $(TAR) cvf \
+   $(BIN_DIR)/$(IMG_PREFIX)-$(1)-$(2)-sysupgrade.tar 
sysupgrade-$(1))
endef
 endif
 
diff --git a/target/linux/ar71xx/image/Makefile 
b/target/linux/ar71xx/image/Makefile
index d0ee363..3c68fa3 100644
--- a/target/linux/ar71xx/image/Makefile
+++ b/target/linux/ar71xx/image/Makefile
@@ -878,7 +878,7 @@ define Image/Build/NetgearNAND
-i $(imageraw) \
-o $(call imgname,ubi,$(2))-factory.img
 
-   $(call 
Image/Build/SysupgradeNAND,$(2),$(KDIR_TMP)/vmlinux-$(2).uImage,$(KDIR_TMP)/root.squashfs)
+   $(call 
Image/Build/SysupgradeNAND,$(2),squashfs,$(KDIR_TMP)/vmlinux-$(2).uImage)
 endef
 
 
-- 
1.9.3
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v2 1/2] SysupgradeNAND: include rootfs-type in image name

2014-06-20 Thread Daniel Golle
also add quotes to paths

Signed-off-by: Daniel Golle dan...@makrotopia.org
---
v2: also change comment explaining parameters

 include/image.mk   | 16 
 target/linux/ar71xx/image/Makefile |  2 +-
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/include/image.mk b/include/image.mk
index 66ac497..31c6184 100644
--- a/include/image.mk
+++ b/include/image.mk
@@ -130,16 +130,16 @@ ifneq ($(CONFIG_TARGET_ROOTFS_SQUASHFS),)
 endif
 
 # $(1): board name
-# $(2): kernel image
-# $(3): rootfs image
+# $(2): rootfs type
+# $(3): kernel image
 ifneq ($(CONFIG_NAND_SUPPORT),)
define Image/Build/SysupgradeNAND
-   mkdir -p $(KDIR_TMP)/sysupgrade-$(1)/
-   echo BOARD=$(1)  $(KDIR_TMP)/sysupgrade-$(1)/CONTROL
-   [ -z $(2) ] || $(CP) $(2) $(KDIR_TMP)/sysupgrade-$(1)/kernel
-   [ -z $(3) ] || $(CP) $(3) $(KDIR_TMP)/sysupgrade-$(1)/root
-   (cd $(KDIR_TMP); $(TAR) cvf \
-   $(BIN_DIR)/$(IMG_PREFIX)-$(1)-ubi-sysupgrade.tar 
sysupgrade-$(1))
+   mkdir -p $(KDIR_TMP)/sysupgrade-$(1)/
+   echo BOARD=$(1)  $(KDIR_TMP)/sysupgrade-$(1)/CONTROL
+   [ -z $(2) ] || $(CP) $(KDIR)/root.$(2) 
$(KDIR_TMP)/sysupgrade-$(1)/root
+   [ -z $(3) ] || $(CP) $(3) $(KDIR_TMP)/sysupgrade-$(1)/kernel
+   (cd $(KDIR_TMP); $(TAR) cvf \
+   $(BIN_DIR)/$(IMG_PREFIX)-$(1)-$(2)-sysupgrade.tar 
sysupgrade-$(1))
endef
 endif
 
diff --git a/target/linux/ar71xx/image/Makefile 
b/target/linux/ar71xx/image/Makefile
index d0ee363..3c68fa3 100644
--- a/target/linux/ar71xx/image/Makefile
+++ b/target/linux/ar71xx/image/Makefile
@@ -878,7 +878,7 @@ define Image/Build/NetgearNAND
-i $(imageraw) \
-o $(call imgname,ubi,$(2))-factory.img
 
-   $(call 
Image/Build/SysupgradeNAND,$(2),$(KDIR_TMP)/vmlinux-$(2).uImage,$(KDIR_TMP)/root.squashfs)
+   $(call 
Image/Build/SysupgradeNAND,$(2),squashfs,$(KDIR_TMP)/vmlinux-$(2).uImage)
 endef
 
 
-- 
1.9.3
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 2/2] procd: fix nand.sh kernel_length typo

2014-06-20 Thread Daniel Golle
sysupgrade otherwise skips kernel part on devices which got
kernel in ubi due to kern_length being undefined, kernel_length
is being used instead.

Signed-off-by: Daniel Golle dan...@makrotopia.org
---
 package/system/procd/files/nand.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/package/system/procd/files/nand.sh 
b/package/system/procd/files/nand.sh
index 09cc091..78ac206 100644
--- a/package/system/procd/files/nand.sh
+++ b/package/system/procd/files/nand.sh
@@ -4,7 +4,7 @@
 
 . /lib/functions.sh
 
-# 'data' partition on NAND contains UBI
+# 'ubi' partition on NAND contains UBI
 CI_UBIPART=ubi
 
 nand_find_volume() {
@@ -242,7 +242,7 @@ nand_upgrade_tar() {
[ $has_kernel = 1 ]  {
local kern_ubivol=$(nand_find_volume $ubidev kernel)
tar xf $tar_file sysupgrade-$board_name/kernel -O | \
-   ubiupdatevol /dev/$kern_ubivol -s $kern_length -
+   ubiupdatevol /dev/$kern_ubivol -s $kernel_length -
}
 
local root_ubivol=$(nand_find_volume $ubidev rootfs)
-- 
1.9.3
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 1/5] Fix stack overflow bug of uloop lua binding.

2014-06-20 Thread Xiongfei(Alex) GUO
Well, I agree with you about the api name.

And, since we have done this, the fd:cancel should be renamed to
fd:delete too.

The code is:

static const luaL_Reg ufd_m[] = {
{ cancel, ul_ufd_delete },
{ NULL, NULL }
};




On Fri, Jun 20, 2014 at 7:40 PM, John Crispin j...@phrozen.org wrote:



 On 20/06/2014 13:31, xf...@credosemi.com wrote:
  The static variable `state` in `lua/uloop.c` should be clean after
  every callback.
 
  Signed-off-by: Xiongfei(Alex) Guo xf...@credosemi.com ---


 Hi,

 just had a quick browse over the patches. looks good, the only nipick
 i have is this

 +static int ul_cancel(lua_State *L)
 +{
 +   uloop_end();
 +   return 1;
 +}

 can we rename is to ul_end() and then also fix up {cancel,
 ul_cancel} to use end instead of cancel. that way the apis have the
 same names in lua and c. apart from that thanks for the patches, i
 will give them a try later on and then merge them into the git.

 John











  lua/uloop.c | 2 ++ 1 file changed, 2 insertions(+)
 
  diff --git a/lua/uloop.c b/lua/uloop.c index 51f53c2..5922e04
  100644 --- a/lua/uloop.c +++ b/lua/uloop.c @@ -43,6 +43,7 @@ static
  void ul_timer_cb(struct uloop_timeout *t)
 
  lua_getglobal(state, __uloop_cb); lua_rawgeti(state, -1,
  tout-r); +   lua_remove(state, -2); lua_call(state, 0, 0); }
 
  @@ -133,6 +134,7 @@ static void ul_process_cb(struct uloop_process
  *p, int ret) lua_getglobal(state, __uloop_cb); lua_rawgeti(state,
  -1, proc-r); luaL_unref(state, -2, proc-r); +   lua_remove(state,
  -2); lua_pushinteger(state, ret  8); lua_call(state, 1, 0); }
 
 ___
 openwrt-devel mailing list
 openwrt-devel@lists.openwrt.org
 https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] WRT54GS v1.0 GPIO definitions in r41004

2014-06-20 Thread Catalin Patulea
On Fri, Jun 20, 2014 at 6:20 AM, Rafał Miłecki zaj...@gmail.com wrote:
 Your nvram has following entries:
 gpio6=adm_rc
 gpio5=adm_eedi
 gpio3=adm_eesk
 gpio2=adm_eecs

 Hauke: it seems nvram may be wrong there. According to the Catalin,
 reset button uses GPIO 6. On the other hand it seems adm6996.c never
 really uses eerc.
I modified adm6996.c to allow GPIO export and started controlling
gpio6 manually, toggling every 1 second. I used a voltmeter to look at
the ADM6996 RC (reset) pin - it was *not* toggling. So I also think
NVRAM is wrong.

I tried to look for other GPIOs that control adm6996 RC but I couldn't
find one. Indeed eerc is unused in adm6996, but it would be nice to
find a signal to perform a hardware reset.

I think it's still possible there is some connection between gpio6 and
RC but the circuit may be more complicated. For example the POWER LED
is controlled somehow by both gpio0 and wifi state. Maybe there is
some multiplexing happening on gpio6 too, perhaps controlled by some
other signal? I'm not sure if this is likely, I don't have much
experience with what is typical for these boards.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] AA on brcm47xx: Unhandled kernel unaligned access

2014-06-20 Thread Nikolai Zhubr

Hello people,

I have asus wl-500W router (http://wiki.openwrt.org/toh/asus/wl500w). It 
is also very similar to wl-500gp.
Some few months ago I updated to 12.09. I can't recall now if it was 
backfire or kamikaze before, but I noticed 2 things immediately:


1. Maximum practically achievable download speed increased somewhat.
(From ~30Mbit to ~34mbit approx)

2. After reaching (and keeping) this max download speed, the device will 
always reboot soon. (Absolutely reproducible)


For some time I was thinking that's just hardware, like bad electrolytic 
capacitors and/or weak power supply. Finally I opened the router, 
replaced all 3 capacitors (2 of 3 appeared somewhat damaged indeed), 
attached a voltmeter to check for undervoltage. Still nothing: power 
supply is OK, reboots still happen.


So I had to turn to the software side, and found 2 new things again:

1. While uplink load goes up approaching 34Mbit, softirqs eat up more 
and more CPU, approaching 100% CPU.


2. At some point I get (on a serial link):
[  368.948000] sched: RT throttling activated
[  382.688000] Unhandled kernel unaligned access[#1]:
trim
[  382.932000] Kernel panic - not syncing: Fatal exception in interrupt
[  382.94] Rebooting in 3 seconds..
(Trimmed all in between because there is no debugging info for now)

I suppose this is something that should not normally happen, and I'd 
like to have it fixed somehow. I haven't tried trunk yet, but I will, if 
it could make some difference. I can provide serial logs, compile trunk, 
apply patches, redo testing etc. (As time permits)

Any hints appreciated.

Thank you,
Nikolai
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] AA on brcm47xx: Unhandled kernel unaligned access

2014-06-20 Thread Rafał Miłecki
On 20 June 2014 22:12, Nikolai Zhubr n-a-zh...@yandex.ru wrote:
 2. At some point I get (on a serial link):
 [  368.948000] sched: RT throttling activated
 [  382.688000] Unhandled kernel unaligned access[#1]:
 trim
 [  382.932000] Kernel panic - not syncing: Fatal exception in interrupt
 [  382.94] Rebooting in 3 seconds..
 (Trimmed all in between because there is no debugging info for now)

Debugging info would be really wanted.


 I suppose this is something that should not normally happen, and I'd like to
 have it fixed somehow. I haven't tried trunk yet, but I will, if it could
 make some difference.

There are tons of updates in trunk, this bug can be fixed for a long
time already ;)
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] WRT54GS v1.0 GPIO definitions in r41004

2014-06-20 Thread Catalin Patulea
On Fri, Jun 20, 2014 at 3:20 PM, Catalin Patulea c...@vv.carleton.ca wrote:
 Hauke: it seems nvram may be wrong there. According to the Catalin,
 reset button uses GPIO 6. On the other hand it seems adm6996.c never
 really uses eerc.
 I modified adm6996.c to allow GPIO export and started controlling
 gpio6 manually, toggling every 1 second. I used a voltmeter to look at
 the ADM6996 RC (reset) pin - it was *not* toggling. So I also think
 NVRAM is wrong.
Actually, I re-read my notes, and I have a more detailed mapping:

gpio2 = EECS = ADM6996 pin 80
gpio3 = EESK = pin 81
gpio4 = EDO = pin 84
gpio5 = EDI = pin 79

All of the above are connected through a cluster of resistors (RP3).

I could not find a GPIO that controls RC (ADM6996 pin 112), but there
is a long trace leading somewhere else, and a pulldown resistor
(RG11).
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] ar71xx: add support for the EnGenius ESR900

2014-06-20 Thread Forest Crossman
Signed-off-by: Forest Crossman cyro...@gmail.com
---
 package/base-files/files/lib/functions/system.sh   |   1 +
 target/linux/ar71xx/base-files/etc/diag.sh |   3 +
 .../ar71xx/base-files/etc/uci-defaults/01_leds |   5 +
 .../ar71xx/base-files/etc/uci-defaults/02_network  |  11 +
 target/linux/ar71xx/base-files/lib/ar71xx.sh   |   3 +
 target/linux/ar71xx/config-3.10|   1 +
 .../ar71xx/files/arch/mips/ath79/mach-esr900.c | 232 +
 target/linux/ar71xx/files/arch/mips/ath79/nvram.c  |  16 ++
 target/linux/ar71xx/generic/profiles/engenius.mk   |  16 ++
 target/linux/ar71xx/image/Makefile |   2 +
 .../610-MIPS-ath79-openwrt-machines.patch  |  18 +-
 11 files changed, 305 insertions(+), 3 deletions(-)
 create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-esr900.c
 create mode 100644 target/linux/ar71xx/generic/profiles/engenius.mk

diff --git a/package/base-files/files/lib/functions/system.sh
b/package/base-files/files/lib/functions/system.sh
index a4c0f26..8d75a5a 100644
--- a/package/base-files/files/lib/functions/system.sh
+++ b/package/base-files/files/lib/functions/system.sh
@@ -82,6 +82,7 @@ macaddr_canonicalize()
  local mac=$1
  local canon=

+ mac=$(echo -n $mac | tr -d \)
  [ ${#mac} -gt 17 ]  return
  [ -n ${mac//[a-fA-F0-9\.: -]/} ]  return

diff --git a/target/linux/ar71xx/base-files/etc/diag.sh
b/target/linux/ar71xx/base-files/etc/diag.sh
index d5063de..81e4eff 100755
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -238,6 +238,9 @@ get_status_led() {
  wlr8100)
  status_led=sitecom:amber:status
  ;;
+ esr900)
+ status_led=engenius:amber:power
+ ;;
  esac
 }

diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
index fe5ff93..8265b00 100755
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
@@ -103,6 +103,11 @@ dir-825-c1)
  ucidef_set_led_wlan wlan2g WLAN 2.4 GHz d-link:blue:wlan2g phy0tpt
  ;;

+esr900)
+ ucidef_set_led_wlan wlan2g WLAN 2.4 GHz engenius:blue:wlan-2g phy0tpt
+ ucidef_set_led_wlan wlan5g WLAN 5 GHz engenius:blue:wlan-5g phy1tpt
+ ;;
+
 hiwifi-hc6361)
  ucidef_set_led_default inet INET hiwifi:blue:internet 0
  ucidef_set_led_wlan wlan WLAN hiwifi:blue:wlan-2p4 phy0tpt
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
index a2b2762..08bd1c8 100755
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
@@ -378,6 +378,17 @@ wndr3700)
  uci set network.@switch_port[-1].led='2'
  ;;

+esr900)
+ local wan_mac
+ local lan_mac
+ ucidef_set_interfaces_lan_wan eth0.1 eth0.2
+ ucidef_add_switch switch0 1 1
+ ucidef_add_switch_vlan switch0 1 0t 1 2 3 4
+ ucidef_add_switch_vlan switch0 2 0t 5
+ wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr)
+ [ -n $wan_mac ]  ucidef_set_interface_macaddr wan $wan_mac
+ ;;
+
 *)
  ucidef_set_interfaces_lan_wan eth0 eth1
  ;;
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh
b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 6dd5e62..e346f97 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -676,6 +676,9 @@ ar71xx_board_detect() {
  *HiWiFi HC6361)
  name=hiwifi-hc6361
  ;;
+ *EnGenius ESR900)
+ name=esr900
+ ;;
  esac

  case $machine in
diff --git a/target/linux/ar71xx/config-3.10 b/target/linux/ar71xx/config-3.10
index c294cd8..78d5359 100644
--- a/target/linux/ar71xx/config-3.10
+++ b/target/linux/ar71xx/config-3.10
@@ -47,6 +47,7 @@ CONFIG_ATH79_MACH_DIR_825_B1=y
 CONFIG_ATH79_MACH_DIR_825_C1=y
 CONFIG_ATH79_MACH_DRAGINO2=y
 CONFIG_ATH79_MACH_EAP7660D=y
+CONFIG_ATH79_MACH_ESR900=y
 CONFIG_ATH79_MACH_EW_DORIN=y
 CONFIG_ATH79_MACH_GS_OOLITE=y
 CONFIG_ATH79_MACH_HORNET_UB=y
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-esr900.c
b/target/linux/ar71xx/files/arch/mips/ath79/mach-esr900.c
new file mode 100644
index 000..64e590a
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-esr900.c
@@ -0,0 +1,232 @@
+/*
+ * EnGenius ESR900 board support
+ *
+ * Based on the Qualcomm Atheros AP135/AP136 reference board support code
+ * Copyright (c) 2012 Qualcomm Atheros
+ * Copyright (c) 2012-2013 Gabor Juhos juh...@openwrt.org
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL