Re: [LEDE-DEV] [PATCH usbmode] fix indices of messages

2017-05-18 Thread Bastian Bittorf
* Julian Labus  [19.05.2017 07:29]:
> to me it looks like LEDE has its own implementation of usb-modeswitch
> and only uses usb-modeswitch-data from the upstream project or is this
> just a mirror?
> 
> https://git.lede-project.org/?p=project/usbmode.git

You are totally right. I was confused bye the Makefile,
which loads "usb-modeswitch-data"* from draisberghof.de - sorry.

bye, bastian

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] [netifd][PATCH] Remove redundant check for strtoul() return value

2017-05-18 Thread Khem Raj
Fixes
system-linux.c:1998:33: error: comparison of unsigned expression >= 0 is always 
true [-Werror,-Wtautological-compare]

Signed-off-by: Khem Raj 
---
 system-linux.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/system-linux.c b/system-linux.c
index 3e11bdf..ddc31d8 100644
--- a/system-linux.c
+++ b/system-linux.c
@@ -1988,8 +1988,8 @@ bool system_resolve_rt_proto(const char *type, unsigned 
int *id)
FILE *f;
char *e, buf[128];
unsigned int n, proto = 256;
-
-   if ((n = strtoul(type, , 0)) >= 0 && !*e && e != type)
+   n = strtoul(type, , 0);
+   if (!*e && e != type)
proto = n;
else if (!strcmp(type, "unspec"))
proto = RTPROT_UNSPEC;
-- 
2.13.0


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] [PATCH 2/3] brcm47xx: resolve GPIO conflict for WRT54GSv1

2017-05-18 Thread Mirko Parthey
On the Linksys WRT54GSv1, the adm6996 switch driver and the
gpio_button_hotplug module both claim GPIO 6, which is connected to the
Reset button.  When the switch driver's request wins, the Reset button
cannot work. This makes it impossible to enter failsafe mode without a
serial console.

Stop requesting the "adm_rc" GPIO in the switch driver, since it is not
used anywhere.

Fixes FS#792.

Signed-off-by: Mirko Parthey 
---
 target/linux/generic/files/drivers/net/phy/adm6996.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/target/linux/generic/files/drivers/net/phy/adm6996.c 
b/target/linux/generic/files/drivers/net/phy/adm6996.c
index 25776b836651..0a1b303ab1c0 100644
--- a/target/linux/generic/files/drivers/net/phy/adm6996.c
+++ b/target/linux/generic/files/drivers/net/phy/adm6996.c
@@ -1154,12 +1154,13 @@ static int adm6996_gpio_probe(struct platform_device 
*pdev)
ret = devm_gpio_request(>dev, priv->eedi, "adm_eedi");
if (ret)
return ret;
-   ret = devm_gpio_request(>dev, priv->eerc, "adm_eerc");
-   if (ret)
-   return ret;
ret = devm_gpio_request(>dev, priv->eesk, "adm_eesk");
if (ret)
return ret;
+   /*
+* We do not request the "adm_rc" GPIO here. The driver does not use it,
+* and it conflicts with the Reset button GPIO on the Linksys WRT54GSv1.
+*/
 
ret = adm6996_switch_init(priv, dev_name(>dev), NULL);
if (ret < 0)
-- 
2.1.4


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] [PATCH 1/3] brcm47xx: use DMZ LED as status indicator

2017-05-18 Thread Mirko Parthey
On the Linksys WRT54GSv1, the Power LED flickers in the "off" state.
Indicate status using the DMZ LED if available, since it has solid "on" and
"off" states.

This change was tested on the WRT54GSv1, but may also affect other brcm47xx
devices.

Fixes FS#793.

Signed-off-by: Mirko Parthey 
---
 target/linux/brcm47xx/base-files/etc/diag.sh | 22 +++---
 1 file changed, 7 insertions(+), 15 deletions(-)

diff --git a/target/linux/brcm47xx/base-files/etc/diag.sh 
b/target/linux/brcm47xx/base-files/etc/diag.sh
index 67453e6fd4e8..91cf4bdf4b63 100644
--- a/target/linux/brcm47xx/base-files/etc/diag.sh
+++ b/target/linux/brcm47xx/base-files/etc/diag.sh
@@ -4,21 +4,13 @@
 . /lib/functions/leds.sh
 
 get_status_led() {
-   status_led_file=$(find /sys/class/leds/ -name "*power*" |head -n1)
-   if [ ! -f $status_led_file ]; then
-   status_led=$(basename $status_led_file)
-   return
-   fi;
-   status_led_file=$(find /sys/class/leds/ -name "*diag*" |head -n1)
-   if [ ! -f $status_led_file ]; then
-   status_led=$(basename $status_led_file)
-   return
-   fi;
-   status_led_file=$(find /sys/class/leds/ -name "*wps*" |head -n1)
-   if [ ! -f $status_led_file ]; then
-   status_led=$(basename $status_led_file)
-   return
-   fi;
+   for led in dmz power diag wps; do
+   status_led_file=$(find /sys/class/leds/ -name "*${led}*" | head 
-n1)
+   if [ ! -f $status_led_file ]; then
+   status_led=$(basename $status_led_file)
+   return
+   fi;
+   done
 }
 
 set_state() {
-- 
2.1.4


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [PATCH] imx6: add gw560x support

2017-05-18 Thread Tim Harvey
On Sat, May 6, 2017 at 1:07 AM, Mathias Kresin  wrote:
> 05.05.2017 22:15, Tim Harvey:
>>
>> Signed-off-by: Tim Harvey 
>
>
> Hey Tim,
>
> would you please include a short description about the hardware and how to
> install LEDE on the board in your commit message! Have a look at the recent
> board additions for some examples.
>
> I prefer to have backports (even for device tree files) as patches in
> patches-*. But I've no strong opinion on this. But please mention in the
> commit message in case something is a backport.

Mathias,

Yes, I prefer backports to be patches as well. I will re-submit as a
patch. The upstream kernel patch [1] has the hardware description but
I will re-iterate this in the LEDE patch submission as well for
clarity. As for how to install LEDE on the board, the GW560x is part
of the Gateworks Ventana product family.

Thanks for the review!

Tim

[1] 
https://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux.git/commit/?h=imx/dt=87b2b5861f5a1f3eb762d8d8d6e9770dc5d837e8

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [PATCH usbmode] fix indices of messages

2017-05-18 Thread Piotr Dymacz

Hello Julian, Bastian,

On 18.05.2017 21:02, Julian Labus wrote:

Hi Bastian,

to me it looks like LEDE has its own implementation of usb-modeswitch
and only uses usb-modeswitch-data from the upstream project or is this
just a mirror?


Yes, that is correct.

I was going to send something similar (Mathias did a quick hack-fix 
here: [1]) as the current version of the conversion script doesn't work 
correctly with updated usb-modeswitch-data (I have already locally 
merged this PR: [2]).


[1] https://gist.github.com/mkresin/c89882289a0f8569f99829224ffc96fe
[2] https://github.com/lede-project/source/pull/1067

--
Cheers,
Piotr



https://git.lede-project.org/?p=project/usbmode.git

Regards,
Julian

On 05/18/2017 08:21 PM, Bastian Bittorf wrote:

* Julian Labus  [18.05.2017 20:16]:

the way how the script checked if a key already exists in a hash
leads to wrong indices for %messages.

Signed-off-by: Julian Labus 
---
 convert-modeswitch.pl | 9 +


thanks for your patch.
it seems you must send your patch upstream:
http://www.draisberghof.de/usb_modeswitch

lede does only use this package.

bye, bastian


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev




___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [PATCH usbmode] fix indices of messages

2017-05-18 Thread Bastian Bittorf
* Julian Labus  [18.05.2017 20:16]:
> the way how the script checked if a key already exists in a hash
> leads to wrong indices for %messages.
> 
> Signed-off-by: Julian Labus 
> ---
>  convert-modeswitch.pl | 9 +

thanks for your patch.
it seems you must send your patch upstream:
http://www.draisberghof.de/usb_modeswitch

lede does only use this package.

bye, bastian

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [PATCH v5] dnsmasq: also write /tmp/resolv.conf when UCI dhcp.dnsmasq.noresolv is '1'

2017-05-18 Thread Hans Dedecker
On Sun, May 14, 2017 at 8:22 PM, Paul Oranje  wrote:
>
> fixes FS#785
>
Hi,

Thanks for the patch but be more verbose in the comment description
what problem you're trying to solve; the commit subject should be
limited to 50 characters.
See also https://lede-project.org/submitting-patches
>
> Signed-off-by: Paul Oranje 
> ---
>  package/network/services/dnsmasq/files/dnsmasq.init | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/package/network/services/dnsmasq/files/dnsmasq.init 
> b/package/network/services/dnsmasq/files/dnsmasq.init
> index 30fec7a4ee..197aae9de1 100644
> --- a/package/network/services/dnsmasq/files/dnsmasq.init
> +++ b/package/network/services/dnsmasq/files/dnsmasq.init
> @@ -947,7 +947,7 @@ dnsmasq_start()
> echo >> $CONFIGFILE_TMP
> mv -f $CONFIGFILE_TMP $CONFIGFILE
>
> -   [ "$resolvfile" = "/tmp/resolv.conf.auto" ] && {
> +   [ "$noresolv" = "1" -o "$resolvfile" = "/tmp/resolv.conf.auto" ] && {
> rm -f /tmp/resolv.conf
> [ $ADD_LOCAL_DOMAIN -eq 1 ] && [ -n "$DOMAIN" ] && {
> echo "search $DOMAIN" >> /tmp/resolv.conf
> @@ -982,7 +982,7 @@ dnsmasq_stop()
> config_get resolvfile "$cfg" "resolvfile"
>
> #relink /tmp/resolve.conf only for main instance
> -   [ "$resolvfile" = "/tmp/resolv.conf.auto" ] && {
> +   [ "$noresolv" = "1" -o "$resolvfile" = "/tmp/resolv.conf.auto" ] && {
noresolv needs to be read from the config which is not the case
> [ -f /tmp/resolv.conf ] && {
> rm -f /tmp/resolv.conf
> ln -s "$resolvfile" /tmp/resolv.conf
this will generate an error now if resolvfile is empty
> --
> 2.12.2
>
>
> ___
> Lede-dev mailing list
> Lede-dev@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/lede-dev

Hans

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] [PATCH usbmode] fix indices of messages

2017-05-18 Thread Julian Labus
the way how the script checked if a key already exists in a hash
leads to wrong indices for %messages.

Signed-off-by: Julian Labus 
---
 convert-modeswitch.pl | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/convert-modeswitch.pl b/convert-modeswitch.pl
index 7b2323b..6e7bb86 100755
--- a/convert-modeswitch.pl
+++ b/convert-modeswitch.pl
@@ -7,12 +7,13 @@ my %devices;
 
 sub add_message {
my $msg = shift;
-   my $val = $messages{$msg};
-
-   $val or do {
+   my $val;
+   if (exists $messages{$msg}) {
+   $val = $messages{$msg};
+   } else {
$val = $msg_ctr++;
$messages{$msg} = $val;
-   };
+   }
 
return $val;
 }
-- 
2.11.0


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [PATCH V2] Support specifying instance name in JSON file

2017-05-18 Thread John Crispin



On 12/05/17 11:08, Rafał Miłecki wrote:

From: Rafał Miłecki 

So far we were using host label as the instance name for every service.
This change allows specifying it manually and fallbacks to the label for
backward compatibility.

Signed-off-by: Rafał Miłecki 

Acked-by: John Crispin 

---
V2: Rebased on top of recent changes. This should work fine now thanks
 to the commits:
 26ce7dca8085d ("Allow filtering with instance name in service_reply")
 49fdb9f7a5454 ("Support PTR queries for a specific service")
---
  service.c | 10 --
  1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/service.c b/service.c
index 67e8f40..0a9e25d 100644
--- a/service.c
+++ b/service.c
@@ -34,6 +34,7 @@
  #include "announce.h"
  
  enum {

+   SERVICE_INSTANCE,
SERVICE_SERVICE,
SERVICE_PORT,
SERVICE_TXT,
@@ -55,6 +56,7 @@ struct service {
  };
  
  static const struct blobmsg_policy service_policy[__SERVICE_MAX] = {

+   [SERVICE_INSTANCE] = { .name = "instance", .type = BLOBMSG_TYPE_STRING 
},
[SERVICE_SERVICE] = { .name = "service", .type = BLOBMSG_TYPE_STRING },
[SERVICE_PORT] = { .name = "port", .type = BLOBMSG_TYPE_INT32 },
[SERVICE_TXT] = { .name = "txt", .type = BLOBMSG_TYPE_ARRAY },
@@ -210,7 +212,7 @@ service_load_blob(struct blob_attr *b)
  {
struct blob_attr *txt, *_tb[__SERVICE_MAX];
struct service *s;
-   char *d_service, *d_id;
+   char *d_instance, *d_service, *d_id;
uint8_t *d_txt;
int rem2;
int txt_len = 0;
@@ -226,6 +228,7 @@ service_load_blob(struct blob_attr *b)
  
  	s = calloc_a(sizeof(*s),

_id, strlen(blobmsg_name(b)) + 1,
+   _instance, _tb[SERVICE_INSTANCE] ? 
strlen(blobmsg_get_string(_tb[SERVICE_INSTANCE])) + 1 : 0,
_service, strlen(blobmsg_get_string(_tb[SERVICE_SERVICE])) + 
1,
_txt, txt_len);
if (!s)
@@ -233,7 +236,10 @@ service_load_blob(struct blob_attr *b)
  
  	s->port = blobmsg_get_u32(_tb[SERVICE_PORT]);

s->id = strcpy(d_id, blobmsg_name(b));
-   s->instance = umdns_host_label;
+   if (_tb[SERVICE_INSTANCE])
+   s->instance = strcpy(d_instance, 
blobmsg_get_string(_tb[SERVICE_INSTANCE]));
+   else
+   s->instance = umdns_host_label;
s->service = strcpy(d_service, 
blobmsg_get_string(_tb[SERVICE_SERVICE]));
s->active = 1;
s->t = 0;



___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [PATCH v2 2/3] base-files: put board_name into separate file

2017-05-18 Thread Roman Yeryomin
On 18 May 2017 at 01:05, Mathias Kresin  wrote:
> 17.05.2017 21:08, Roman Yeryomin:
>>
>> On 17 May 2017 at 21:39, Roman Yeryomin  wrote:
>>>
>>> On 17 May 2017 at 16:19, Mathias Kresin  wrote:

 Hey Roman.,

 independent of the work done by you, I worked on exactly the same
 topic. But I've pushed it a bit further by switching all targets to
 the generic boardname function and a few targets to the generic board
 detection in basefiles/preinit.

 Furthermore I've converted some targets to get the boardname from the
 device tree compatible string as suggested by John. Till now I wasn't
 comfortable to push it somewhere, but with my latest changes it should
 work in theory. You can find the changes at

 https://git.lede-project.org/?p=lede/mkresin/staging.git;a=shortlog;h=refs/heads/boarddetection.
 What is missing: testing!
>>
>>
>> Some of your changes would be ok to me if:
>> - board.sh would be used instead of functions.sh (which I would like
>> to split into several files anyway) for $(board_name)
>
>
> I guess we all got your point. But I'm sorry to say, that isn't subject of
> my changes.

I just wanted to say that the way you did it doesn't make sense to me
and IMO does more harm than good.

>> - related changes would be squashed into one commit, otherwise it's
>> hard to perceive/track the changes, IMO more commits is not always
>> better
>
>
> The commits will be most likely squashed before I commit them. But at least
> during review I prefer smaller changes instead of a single patch with >100
> lines.
>
>>
>> also this one is a fail:
>>
>> https://git.lede-project.org/?p=lede/mkresin/staging.git;a=commitdiff;h=af3ef20591e6e9e4ee2cf1b1fc58012df68445ba
>
>
> Hopefully someone beats me with a stick if I every reply during a review
> with "fail" and without any explanation what is wrong. This isn't helpful in
> any kind and just a waste of your and my time.

Sorry, didn't mean to be rude.
But, again, the way you did it doesn't make sense to me. You replaced
one platform specific code with other, it's not unifying anything,
like you wrote in commit message.
Instead here is what I propose: https://patchwork.ozlabs.org/patch/759976/

> But I can give you a quick summary why the commit is required:
>
> No target_board_name() => target_board_detect() isn't called =>
> /tmp/sysinfo/board_name isn't populated => board_name() has nothing to
> return.
>
> And as the commit message states, it is also meant to unify the way the
> board detection is done between targets (to not fool more people like I was
> fooled because of these target specifics).
>
> Mathias

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [PATCH libubox] json_script: enable custom expr handler callback

2017-05-18 Thread Denis Osvald
On 2017-05-18 09:39, Denis Osvald wrote:
> This wires in custom expression handler functionality, which was
> present in json script since the original version, but never used.

To add a bit of context:

Experimenting with procd service triggers, it was noticed that when
adding triggers for a network interface, trigger is activated too often.
I saw discussions related to both netifd (as sender of network interface
trigger events) and procd side of the problem a few times during past
months on the list, e.g.:

http://lists.infradead.org/pipermail/lede-dev/2017-April/007065.html
http://lists.infradead.org/pipermail/lede-dev/2017-April/007162.html
http://lists.infradead.org/pipermail/lede-dev/2017-March/006927.html

Quote from the last link:
> be nice if [...] there were ways to be better refine the interface 
> triggers to only a true interface reconfiguration

As one way of solving the problem, I wanted to make a trigger-handling
json_script which itself would check the trigger details, and decide
whether the event was relevant enough to warrant a reload. I tried this
via a patch to procd:

http://public.inteno.se/?p=iopsys.git;a=commitdiff;h=3cdd8f80433e21eacfb593e69361e8f217aba30c

However, json_script turned out not to support custom expression
handlers, hence this patch.

Regards,

Denis

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] [PATCH libubox] json_script: enable custom expr handler callback

2017-05-18 Thread Denis Osvald
This wires in custom expression handler functionality, which was present
in json script since the original version, but never used.

Signed-off-by: Denis Osvald 
---
 json_script.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/json_script.c b/json_script.c
index 463aac8..8894901 100644
--- a/json_script.c
+++ b/json_script.c
@@ -415,8 +415,10 @@ static int json_process_expr(struct json_call *call, 
struct blob_attr *cur)
}
 
ret = __json_process_type(call, cur, expr, ARRAY_SIZE(expr), );
-   if (!found)
-   ctx->handle_error(ctx, "Unknown expression type", cur);
+   if (!found) {
+   const char *name = blobmsg_data(blobmsg_data(cur));
+   ctx->handle_expr(ctx, name, cur, call->vars);
+   }
 
return ret;
 }
-- 
2.12.0


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev