Re: [OpenWrt-Devel] Getting in touch with Felix

2016-05-04 Thread Vittorio G (VittGam)

Hi,

Even jow@openwrt and blogic@openwrt do not exist anymore as of now.


Recipient address rejected: User unknown in virtual mailbox table


While for example juhosg@openwrt still exists.

I just hope this will not become another "ffmpeg vs libav"...

Cheers,
Vittorio

On 05/05/2016 02:00:29 CEST, Daniel Dickinson wrote:

Hi,

How does one get in touch with Felix these days?  n...@openwrt.org
bounces for me.

Regards,

Daniel
___
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] [PATCH v2] firewall3: Fix multicast ICMPv6 replies not being sent by default anymore.

2016-05-02 Thread Vittorio G (VittGam)

Hi,

On 02/05/2016 21:54:06 CEST, Baptiste Jonglez wrote:

On Mon, May 02, 2016 at 09:37:07PM +0200, Baptiste Jonglez wrote:

On Mon, May 02, 2016 at 08:17:48PM +0200, Vittorio Gambaletta (VittGam) wrote:
> Since drop_invalid has been turned on by default, ICMPv6 echo requests
> to well-known multicast addresses, such as ff02::1, are not replied to
> by the router anymore, because conntrack considers those outgoing reply
> packets to be invalid.
>
> Fix this by not having the INVALID rule in the OUTPUT chain match IPv6
> packets destined to link-local addresses (fe80::/10).

I'm not sure I understand: the multicast ICMP packets you mention have a
destination address of ff02::1, which is not in fe80::/10.  Did you intend
to allow all of ff00::/8 as destination (which is probably much too
permissive), or did I miss something?


I *did* miss something: this rule is added to the output path, not the
input path.  Sorry for the noise.


Yeah, exactly that. Multicast packets going to ffx2::/16 should always
be sent from link-local addresses, so the replies are always sent to
link-local addresses, and from link-local addresses too.
It's just that conntrack is missing support for tracking those replies.
So, in order to keep things simple, let's just avoid dropping outgoing traffic
marked as invalid by conntrack, that's not being forwarded, and that's destined
to a link-local address.


I wonder if it's the only legimitate kind of traffic that gets dropped by
the INVALID rule, though.


I don't know, I'm only aware of this. If there are other kinds of traffic,
maybe it'd more appropriate to create a new chain with RETURNs for every
exception and then ending the chain with a DROP, to avoid having to use
an explicit ACCEPT; so that the packets could still be dropped after
that rule by the user if needed.

Cheers,
Vittorio


> Signed-off-by: Vittorio Gambaletta 
> ---
>
> diff --git a/defaults.c b/defaults.c
> index 3d210f9..ea905e0 100644
> --- a/defaults.c
> +++ b/defaults.c
> @@ -180,6 +180,14 @@ fw3_print_default_head_rules(struct fw3_ipt_handle 
*handle,
>"FORWARD", "forwarding",
>};
>
> +  struct fw3_address mcdst = {
> +  .set = true,
> +  .invert = true,
> +  .family = FW3_FAMILY_V6,
> +  .address.v6.s6_addr = { 0xfe, 0x80 },
> +  .mask.v6.s6_addr = { 0xff, 0xc0 },
> +  };
> +
>switch (handle->table)
>{
>case FW3_TABLE_FILTER:
> @@ -215,6 +223,8 @@ fw3_print_default_head_rules(struct fw3_ipt_handle 
*handle,
>if (defs->drop_invalid)
>{
>r = fw3_ipt_rule_new(handle);
> +  if (i == 2 && handle->family == FW3_FAMILY_V6)
> +  fw3_ipt_rule_src_dest(r, NULL, &mcdst);
>fw3_ipt_rule_extra(r, "-m conntrack --ctstate 
INVALID");
>fw3_ipt_rule_target(r, "DROP");
>fw3_ipt_rule_append(r, chains[i]);
> ___
> 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 mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] Chaos Calmer - ramips: Fix IPv6 neighbor discovery on RT5350

2016-05-02 Thread Vittorio G (VittGam)

On 02/05/2016 10:06:49 CEST, John Crispin wrote:

On 02/05/2016 09:55, Vittorio G (VittGam) wrote:

Actually there's a problem with this patch: the tabs have been converted
to spaces by your mailer, so it does not apply directly...

The patch on GitHub is fine by the way.

Cheers,
Vittorio


you seem to have sent the same patch which does not look whitespace
broken. i'll use that one instead.


My patch is not for CC... it's for trunk which uses the newer rt305x driver.

Cheers,
Vittorio



John



On 01/05/2016 23:59:27 CEST, Vittorio G (VittGam) wrote:

On 01/05/2016 23:36:05 CEST, Saverio Proto wrote:

This patch is also available here:
https://github.com/zioproto/openwrt15051-batman/commit/0281382bcaa139f0d1d3b589797af4c434747f3e


commit 0281382bcaa139f0d1d3b589797af4c434747f3e
Author: Saverio Proto 
Date:   Sun May 1 23:14:19 2016 +0200

ramips: Fix IPv6 neighbor discovery on RT5350

IPv6 neighbor discovery needs working IPv6 multicast. The
register FCT2
should be set to 0x2500C to let through "unknown IPv6 multicast" to
all ports. This is based on datasheet information:
https://cdn.sparkfun.com/datasheets/Wireless/WiFi/RT5350.pdf

Signed-off-by: Saverio Proto 


Reviewed-by: Vittorio Gambaletta 



diff --git
a/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
b/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
index ef13d23..d09eaf3 100644
--- a/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
+++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
@@ -1360,7 +1360,7 @@ static const struct switch_dev_ops esw_ops = {
 static struct rt305x_esw_platform_data rt3050_esw_data = {
/* All ports are LAN ports. */
.vlan_config= RT305X_ESW_VLAN_CONFIG_NONE,
-   .reg_initval_fct2   = 0x00d6500c,
+   .reg_initval_fct2   = 0x0002500c,
/*
 * ext phy base addr 31, enable port 5 polling, rx/tx clock
skew 1,
 * turbo mii off, rgmi 3.3v off
___
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 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 mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] Chaos Calmer - ramips: Fix IPv6 neighbor discovery on RT5350

2016-05-02 Thread Vittorio G (VittGam)

Actually there's a problem with this patch: the tabs have been converted
to spaces by your mailer, so it does not apply directly...

The patch on GitHub is fine by the way.

Cheers,
Vittorio

On 01/05/2016 23:59:27 CEST, Vittorio G (VittGam) wrote:

On 01/05/2016 23:36:05 CEST, Saverio Proto wrote:

This patch is also available here:
https://github.com/zioproto/openwrt15051-batman/commit/0281382bcaa139f0d1d3b589797af4c434747f3e

commit 0281382bcaa139f0d1d3b589797af4c434747f3e
Author: Saverio Proto 
Date:   Sun May 1 23:14:19 2016 +0200

ramips: Fix IPv6 neighbor discovery on RT5350

IPv6 neighbor discovery needs working IPv6 multicast. The register FCT2
should be set to 0x2500C to let through "unknown IPv6 multicast" to
all ports. This is based on datasheet information:
https://cdn.sparkfun.com/datasheets/Wireless/WiFi/RT5350.pdf

Signed-off-by: Saverio Proto 


Reviewed-by: Vittorio Gambaletta 



diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
b/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
index ef13d23..d09eaf3 100644
--- a/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
+++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
@@ -1360,7 +1360,7 @@ static const struct switch_dev_ops esw_ops = {
 static struct rt305x_esw_platform_data rt3050_esw_data = {
/* All ports are LAN ports. */
.vlan_config= RT305X_ESW_VLAN_CONFIG_NONE,
-   .reg_initval_fct2   = 0x00d6500c,
+   .reg_initval_fct2   = 0x0002500c,
/*
 * ext phy base addr 31, enable port 5 polling, rx/tx clock skew 1,
 * turbo mii off, rgmi 3.3v off
___
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 mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] Chaos Calmer - ramips: Fix IPv6 neighbor discovery on RT5350

2016-05-01 Thread Vittorio G (VittGam)

On 01/05/2016 23:36:05 CEST, Saverio Proto wrote:

This patch is also available here:
https://github.com/zioproto/openwrt15051-batman/commit/0281382bcaa139f0d1d3b589797af4c434747f3e

commit 0281382bcaa139f0d1d3b589797af4c434747f3e
Author: Saverio Proto 
Date:   Sun May 1 23:14:19 2016 +0200

ramips: Fix IPv6 neighbor discovery on RT5350

IPv6 neighbor discovery needs working IPv6 multicast. The register FCT2
should be set to 0x2500C to let through "unknown IPv6 multicast" to
all ports. This is based on datasheet information:
https://cdn.sparkfun.com/datasheets/Wireless/WiFi/RT5350.pdf

Signed-off-by: Saverio Proto 


Reviewed-by: Vittorio Gambaletta 



diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
b/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
index ef13d23..d09eaf3 100644
--- a/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
+++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
@@ -1360,7 +1360,7 @@ static const struct switch_dev_ops esw_ops = {
 static struct rt305x_esw_platform_data rt3050_esw_data = {
/* All ports are LAN ports. */
.vlan_config= RT305X_ESW_VLAN_CONFIG_NONE,
-   .reg_initval_fct2   = 0x00d6500c,
+   .reg_initval_fct2   = 0x0002500c,
/*
 * ext phy base addr 31, enable port 5 polling, rx/tx clock skew 1,
 * turbo mii off, rgmi 3.3v off
___
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] [PATCH 2/2] lantiq: Fix status LED on TDW89X0 after boot is completed.

2016-04-25 Thread Vittorio G (VittGam)

On 25/04/2016 23:10:22 CEST, Martin Blumenstingl wrote:

maybe you could document this in the wiki: [0]
Most people check the wiki when they are looking for configuration
hints like this


Done: https://wiki.openwrt.org/toh/tp-link/td-w8970#leds

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


[OpenWrt-Devel] Buildbot not building all images for Lantiq XRX200

2016-04-25 Thread Vittorio G (VittGam)

Hello,

I've seen that Lantiq XRX200 trunk images are only being built for the VG3503J.

Is this intended, or a mistake?

Thank you.

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


Re: [OpenWrt-Devel] [PATCH 2/2] lantiq: Fix status LED on TDW89X0 after boot is completed.

2016-04-25 Thread Vittorio G (VittGam)

On 25/04/2016 15:14:31 CEST, John Crispin wrote:

i understand the problem, but the WPS led is for WPS and should be left
free for the WPS feature eventually. so nack on this one i am afraid.


Ok, thank you anyway.

For the record, if anyone wants the old behaviour they just need to put
this in /etc/config/system:

config led 'led_system'
option name 'System'
option sysfs 'tdw89x0:green:wps'
option default '1'

And the LED will default to on after a successful boot.

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


Re: [OpenWrt-Devel] [PATCH 2/2] lantiq: Fix status LED on TDW89X0 after boot is completed.

2016-04-22 Thread Vittorio G (VittGam)

On 22/04/2016 08:34:41 CEST, Mathias Kresin wrote:

Am 21.04.2016 um 23:43 schrieb Vittorio Gambaletta (VittGam):

After recent patches, the status LED on this router would stay
switched off after boot is completed. A switched off status LED
often indicates a boot failure (eg. kernel panic), so fix this and
get back to the previous behaviour.


NAK

This change was intentional. Personally, I don't like the idea of using the WPS 
led as permanent (running) status led. I've never tried it, but I may be 
possible to use WPS with hostapd and show the status of the WPS action using 
the WPS led. I like to prevent such a double use of leds.


Well, personally I think that the WPS LED on this router should be used as a "permanent" 
system status LED, since the power LED is hardwired to the power supply, and there is no other 
status LED to be used. Since the WPS LED is unused by default on OpenWrt, I think it's better to 
use it as full system status LED, to avoid "dying" visually on first boot when no DSL or 
Wi-Fi is configured. This is the same behaviour we have on the TP-LINK MR3020 for example: the 
System LED in OpenWrt (which stays on after boot) corresponds to the WPS LED as it was used in the 
original firmware.

Also, if things haven't changed, you need to write custom scripts to use the WPS LED to indicate 
WPS status. And if you do customize your OpenWrt install with such scripts, and you want the LED to 
default to off instead of on when WPS is not being used, you can just add a section for the WPS LED 
in /etc/config/system with "option trigger 'none'" and "option default '0'" to 
have it switch off after boot is finished.


The basic idea was to let the WPS led blink as long as the device boots and 
switch it off at the time the boot has finished. Which means an unsuccessful 
boot is indicated by a still blinking WPS led.


Nope. If there is a kernel panic, all the GPIO LEDs will stop blinking and get 
switched off. At least when it happened to me it was like this, but it was some 
years ago so I might not remember well (or maybe things have changed and the 
kernel does not stop hardware-assisted LED blinking on panic anymore, or it was 
just some other coincidence...).


Mathias



Signed-off-by: Vittorio Gambaletta 
---

--- a/target/linux/lantiq/dts/TDW89X0.dtsi
+++ b/target/linux/lantiq/dts/TDW89X0.dtsi
@@ -8,6 +8,7 @@
/* the power led can't be controlled, use the wps led 
instead */
boot = &wps;
failsafe = &wps;
+   running = &wps;

dsl = &dsl;
internet = &internet;
___
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 mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] [v3] ar71xx: Support for Ubiquiti UniFi AP AC LITE

2016-02-11 Thread Vittorio G (VittGam)

Hi P.Wassi,

The code itself does not seem to be broken.
But the whitespace on the beginning of every line is missing.
It is possible that your email client has mangled it.
So the patch cannot be applied with the "patch" tool, since that
whitespace is essential in diff files.

Also, on your site you don't escape the < and > (less than and
greater than) signs in the patch inside the "pre" tags, so the
code inbetween is parsed as HTML tags (at least here with Firefox).
Try using a combination of "pre" and "code" tags to avoid that.

Cheers,
Vittorio

On 11/02/2016 10:44:33 CET, p.wa...@gmx.at wrote:

Hi Vittorio,

sorry, what is broken with the patch?
Which things should be changed?

P.Wassi


Hello,

It seems that whitespace is broken in this patch.

Can you resend it, please?

Thank you,
Vittorio G


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


Re: [OpenWrt-Devel] [PATCH] [v3] ar71xx: Support for Ubiquiti UniFi AP AC LITE

2016-02-10 Thread Vittorio G (VittGam)

Hello,

It seems that whitespace is broken in this patch.

Can you resend it, please?

Thank you,
Vittorio G

On 20/01/2016 10:05:20 CET, p.wa...@gmx.at wrote:

From: P.Wassi 

Add support for the Ubiquiti UniFi AP AC LITE
Signed-off-by: P.Wassi 
---
This patch adds:
* New machine type
* Code for device setup
* Proper image configuration
* New target for the build system
* Network setup as LAN-only
* Diagnostic LED
* Sysupgrade Support
* ath10k firmware extraction
* Board detection

 base-files/etc/board.d/02_network   |1
 base-files/etc/diag.sh  |3
 base-files/etc/hotplug.d/firmware/11-ath10k-caldata |3
 base-files/lib/ar71xx.sh|3
 base-files/lib/upgrade/platform.sh  |1
 config-4.1  |1
 files/arch/mips/ath79/Kconfig.openwrt   |   10 +
 files/arch/mips/ath79/Makefile  |1
 files/arch/mips/ath79/mach-ubnt-unifiac.c   |  109 
 files/arch/mips/ath79/machtypes.h   |1
 generic/profiles/ubnt.mk|   11 ++
 image/Makefile  |   11 +-
 mikrotik/config-default |1
 nand/config-default |1
 14 files changed, 155 insertions(+), 2 deletions(-)

diff -rupN a/target/linux/ar71xx/base-files/etc/board.d/02_network 
b/target/linux/ar71xx/base-files/etc/board.d/02_network
--- a/target/linux/ar71xx/base-files/etc/board.d/02_network
+++ b/target/linux/ar71xx/base-files/etc/board.d/02_network
@@ -359,6 +359,7 @@ tl-wa901nd-v2 |\
tl-wa901nd-v3 |\
tl-wr703n |\
tube2h |\
+unifiac |\
wndap360 |\
mynet-rext |\
wp543)
diff -rupN a/target/linux/ar71xx/base-files/etc/diag.sh 
b/target/linux/ar71xx/base-files/etc/diag.sh
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -339,7 +339,8 @@ get_status_led() {
unifi)
status_led="ubnt:green:dome"
;;
- uap-pro)
+ uap-pro | \
+ unifiac)
status_led="ubnt:white:dome"
;;
unifi-outdoor-plus)
diff -rupN 
a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata 
b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
--- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -75,6 +75,9 @@ case "$FIRMWARE" in
ath10kcal_extract "ART" 20480 2116
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +16)
;;
+ unifiac)
+ ath10kcal_extract "EEPROM" 20480 2116
+ ;;
esac
;;
"ath10k/cal-pci-:01:00.0.bin")
diff -rupN a/target/linux/ar71xx/base-files/lib/ar71xx.sh 
b/target/linux/ar71xx/base-files/lib/ar71xx.sh
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -905,6 +905,9 @@ ar71xx_board_detect() {
*UniFi)
name="unifi"
;;
+ *"UniFi-AC")
+ name="unifiac"
+ ;;
*"UniFi AP Pro")
name="uap-pro"
;;
diff -rupN a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh 
b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -262,6 +262,7 @@ platform_check_image() {
wlae-ag300n | \
nbg460n_550n_550nh | \
unifi | \
+ unifiac | \
unifi-outdoor | \
carambola2 | \
weio )
diff -rupN a/target/linux/ar71xx/config-4.1 b/target/linux/ar71xx/config-4.1
--- a/target/linux/ar71xx/config-4.1
+++ b/target/linux/ar71xx/config-4.1
CONFIG_ATH79_MACH_TUBE2H=y
CONFIG_ATH79_MACH_UBNT=y
CONFIG_ATH79_MACH_UBNT_XM=y
+CONFIG_ATH79_MACH_UBNT_UNIFIAC=y
CONFIG_ATH79_MACH_WEIO=y
CONFIG_ATH79_MACH_WHR_HP_G300N=y
CONFIG_ATH79_MACH_WLAE_AG300N=y
diff -rupN a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt 
b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
--- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
@@ -1349,6 +1349,16 @@ config ATH79_MACH_UBNT
select ATH79_DEV_M25P80
select ATH79_DEV_USB

+config ATH79_MACH_UBNT_UNIFIAC
+ bool "Ubiquiti UniFi AC (LITE) support"
+ select SOC_QCA956X
+ select ATH79_DEV_AP9X_PCI if PCI
+ select ATH79_DEV_ETH
+ select ATH79_DEV_GPIO_BUTTONS
+ select ATH79_DEV_LEDS_GPIO
+ select ATH79_DEV_M25P80
+ select ATH79_DEV_WMAC
+
config ATH79_MACH_WEIO
bool "WeIO board"
select SOC_AR933X
diff -rupN a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h 
b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
--- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
+++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
@@ -209,6 +209,7 @@ enum ath79_mach_type {
ATH79_MACH_UBNT_RS, /* Ubiquiti RouterStation */
ATH79_MACH_UBNT_UAP_PRO, /* Ubiquiti UniFi AP Pro */
ATH79_MACH_UBNT_UNIFI, /* Ubiquiti Unifi */
+ ATH79_MACH_UBNT_UNIFIAC, /* Ubiquiti Unifi AC */
ATH79_MACH_UBNT_UNIFI_OUTDOOR

[OpenWrt-Devel] [PATCH v4 1/4] [CC] [RESEND] ramips: Fix whitespace in the rt3052 switch driver.

2016-01-03 Thread Vittorio G (VittGam)
Signed-off-by: Vittorio Gambaletta 
---

--- a/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
+++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
@@ -1417,19 +1417,19 @@ static int esw_probe(struct platform_device *pdev)
}
 
port_map = of_get_property(np, "ralink,portmap", NULL);
-if (port_map)
+   if (port_map)
esw->port_map = be32_to_cpu(*port_map);
 
reg_init = of_get_property(np, "ralink,fct2", NULL);
-if (reg_init)
+   if (reg_init)
esw->reg_initval_fct2 = be32_to_cpu(*reg_init);
 
reg_init = of_get_property(np, "ralink,fpa2", NULL);
-if (reg_init)
+   if (reg_init)
esw->reg_initval_fpa2 = be32_to_cpu(*reg_init);
 
reg_init = of_get_property(np, "ralink,led_polarity", NULL);
-if (reg_init)
+   if (reg_init)
esw->reg_led_polarity = be32_to_cpu(*reg_init);
 
swdev = &esw->swdev;
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH v4 1/4] [CC] ramips: Fix whitespace in the rt3052 switch driver.

2016-01-03 Thread Vittorio G (VittGam)

On 03/01/2016 18:37:03 CET, John Crispin wrote:

blogic@debian:/openwrt/CC$ patchwork 561992
Applying: ramips: Fix whitespace in the rt3052 switch driver.
fatal: corrupt patch at line 6
Patch failed at 0001 ramips: Fix whitespace in the rt3052 switch driver.
When you have resolved this problem run "git am --resolved".
If you would prefer to skip this patch, instead run "git am --skip".
To restore the original branch and stop patching run "git am --abort".


In fact that is stricter, patch doesn't fail...

By the way, is `patchwork` a shell alias? It seems interesting. ;)


if you look at line 6 and 22 of the patch you will see that the leading
space is missing. how did you generate these patches ?


Ehm. This particular patch has a long history, I can't remember anymore.
And in fact this v4-cc-1 is the only one that's bad.

For the more recent patches I used quilt.

Cheers,
Vittorio



On 03/01/2016 18:30, Vittorio G (VittGam) wrote:

Hi John,

It does here...

openwrt@asd:~$ git clone https://github.com/openwrt/openwrt openwrt-cc
Cloning into 'openwrt-cc'...
remote: Counting objects: 338616, done.
remote: Compressing objects: 100% (130/130), done.
remote: Total 338616 (delta 61), reused 0 (delta 0), pack-reused 338484
Receiving objects: 100% (338616/338616), 120.31 MiB | 26.38 MiB/s, done.
Resolving deltas: 100% (229507/229507), done.
openwrt@asd:~$ cd openwrt-cc/
openwrt@asd:~/openwrt-cc$ git checkout chaos_calmer
Branch chaos_calmer set up to track remote branch chaos_calmer from origin.
Switched to a new branch 'chaos_calmer'
openwrt@asd:~/openwrt-cc$ patch -p1 < ../v4-cc-1.patch
patching file
target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
openwrt@asd:~/openwrt-cc$ patch -p1 < ../v4-cc-2.patch
patching file
target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
openwrt@asd:~/openwrt-cc$ patch -p1 < ../v4-cc-3.patch
patching file
target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
openwrt@asd:~/openwrt-cc$ patch -p1 < ../v4-cc-4.patch
patching file target/linux/ramips/dts/HT-TM02.dts
openwrt@asd:~/openwrt-cc$

Cheers,
Vittorio

On 03/01/2016 15:53:56 CET, John Crispin wrote:

Hi,

the patch/series does not apply to CC

John

On 01/01/2016 00:00, Vittorio G (VittGam) wrote:

Signed-off-by: Vittorio Gambaletta 
---

--- a/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
+++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
@@ -1417,19 +1417,19 @@ static int esw_probe(struct platform_device
*pdev)
 }

port_map = of_get_property(np, "ralink,portmap", NULL);
-if (port_map)
+if (port_map)
esw->port_map = be32_to_cpu(*port_map);

 reg_init = of_get_property(np, "ralink,fct2", NULL);
-if (reg_init)
+if (reg_init)
 esw->reg_initval_fct2 = be32_to_cpu(*reg_init);

 reg_init = of_get_property(np, "ralink,fpa2", NULL);
-if (reg_init)
+if (reg_init)
 esw->reg_initval_fpa2 = be32_to_cpu(*reg_init);

 reg_init = of_get_property(np, "ralink,led_polarity", NULL);
-if (reg_init)
+if (reg_init)
 esw->reg_led_polarity = be32_to_cpu(*reg_init);

 swdev = &esw->swdev;
___
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 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 mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH v4 1/4] [CC] ramips: Fix whitespace in the rt3052 switch driver.

2016-01-03 Thread Vittorio G (VittGam)

Hi John,

It does here...

openwrt@asd:~$ git clone https://github.com/openwrt/openwrt openwrt-cc
Cloning into 'openwrt-cc'...
remote: Counting objects: 338616, done.
remote: Compressing objects: 100% (130/130), done.
remote: Total 338616 (delta 61), reused 0 (delta 0), pack-reused 338484
Receiving objects: 100% (338616/338616), 120.31 MiB | 26.38 MiB/s, done.
Resolving deltas: 100% (229507/229507), done.
openwrt@asd:~$ cd openwrt-cc/
openwrt@asd:~/openwrt-cc$ git checkout chaos_calmer
Branch chaos_calmer set up to track remote branch chaos_calmer from origin.
Switched to a new branch 'chaos_calmer'
openwrt@asd:~/openwrt-cc$ patch -p1 < ../v4-cc-1.patch
patching file target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
openwrt@asd:~/openwrt-cc$ patch -p1 < ../v4-cc-2.patch
patching file target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
openwrt@asd:~/openwrt-cc$ patch -p1 < ../v4-cc-3.patch
patching file target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
openwrt@asd:~/openwrt-cc$ patch -p1 < ../v4-cc-4.patch
patching file target/linux/ramips/dts/HT-TM02.dts
openwrt@asd:~/openwrt-cc$

Cheers,
Vittorio

On 03/01/2016 15:53:56 CET, John Crispin wrote:

Hi,

the patch/series does not apply to CC

    John

On 01/01/2016 00:00, Vittorio G (VittGam) wrote:

Signed-off-by: Vittorio Gambaletta 
---

--- a/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
+++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
@@ -1417,19 +1417,19 @@ static int esw_probe(struct platform_device *pdev)
}

port_map = of_get_property(np, "ralink,portmap", NULL);
-if (port_map)
+   if (port_map)
esw->port_map = be32_to_cpu(*port_map);

reg_init = of_get_property(np, "ralink,fct2", NULL);
-if (reg_init)
+   if (reg_init)
esw->reg_initval_fct2 = be32_to_cpu(*reg_init);

reg_init = of_get_property(np, "ralink,fpa2", NULL);
-if (reg_init)
+   if (reg_init)
esw->reg_initval_fpa2 = be32_to_cpu(*reg_init);

reg_init = of_get_property(np, "ralink,led_polarity", NULL);
-if (reg_init)
+   if (reg_init)
esw->reg_led_polarity = be32_to_cpu(*reg_init);

swdev = &esw->swdev;
___
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 mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v4 4/4] [CC] ramips: Disable all ethernet ports except port 4 on HT-TM02.

2015-12-31 Thread Vittorio G (VittGam)
Port 4 is the only ethernet port on this router, so disable all other PHYs
in order to save power.

Signed-off-by: Vittorio Gambaletta 
---

--- a/target/linux/ramips/dts/HT-TM02.dts
+++ b/target/linux/ramips/dts/HT-TM02.dts
@@ -57,6 +57,7 @@
 
esw@1011 {
ralink,portmap = <0x10>;
+   ralink,portdisable = <0x2f>;
};
 
wmac@1018 {
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v4 3/4] [CC] ramips: Get rt3052 ethernet ports to be disabled from the device tree.

2015-12-31 Thread Vittorio G (VittGam)
This patch allows configuring ports to be disabled in the device tree; this
saves power, since disabling ports here actually disables power to ethernet
PHYs.

Line 461 enables all ethernet ports, so line 508 is getting zero ports to be
disabled, except for port 5 in SoCs where this is not implemented as it will
be sticky disabled in register POC0. Because of this, the code will still read
the switch configuration and OR it to the device tree setting.

Signed-off-by: Vittorio Gambaletta 
---

--- a/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
+++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
@@ -233,6 +233,7 @@ struct rt305x_esw {
spinlock_t  reg_rw_lock;
 
unsigned char   port_map;
+   unsigned char   port_disable;
unsigned intreg_initval_fct2;
unsigned intreg_initval_fpa2;
unsigned intreg_led_polarity;
@@ -504,8 +505,14 @@ static void esw_hw_init(struct rt305x_esw *esw)
esw_w32(esw, 0x0005, RT305X_ESW_REG_P3LED);
esw_w32(esw, 0x0005, RT305X_ESW_REG_P4LED);
 
-   /* Copy disabled port configuration from bootloader setup */
-   port_disable = esw_get_port_disable(esw);
+   /* Copy disabled port configuration from device tree setup */
+   port_disable = esw->port_disable;
+
+   /* Disable nonexistent ports by reading the switch config
+* after having enabled all possible ports above
+*/
+   port_disable |= esw_get_port_disable(esw);
+
for (i = 0; i < 6; i++)
esw->ports[i].disable = (port_disable & (1 << i)) != 0;
 
@@ -1373,7 +1380,7 @@ static int esw_probe(struct platform_device *pdev)
 {
struct device_node *np = pdev->dev.of_node;
const struct rt305x_esw_platform_data *pdata;
-   const __be32 *port_map, *reg_init;
+   const __be32 *port_map, *port_disable, *reg_init;
struct rt305x_esw *esw;
struct switch_dev *swdev;
struct resource *res, *irq;
@@ -1419,6 +1426,10 @@ static int esw_probe(struct platform_device *pdev)
port_map = of_get_property(np, "ralink,portmap", NULL);
if (port_map)
esw->port_map = be32_to_cpu(*port_map);
+
+   port_disable = of_get_property(np, "ralink,portdisable", NULL);
+   if (port_disable)
+   esw->port_disable = be32_to_cpu(*port_disable);
 
reg_init = of_get_property(np, "ralink,fct2", NULL);
if (reg_init)
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v4 3/4] ramips: Get rt3050 ethernet ports to be disabled from the device tree.

2015-12-31 Thread Vittorio G (VittGam)
This patch allows configuring ports to be disabled in the device tree; this
saves power, since disabling ports here actually disables power to ethernet
PHYs.

Line 443 enables all ethernet ports, so line 486 is getting zero ports to be
disabled, except for port 5 in SoCs where this is not implemented as it will
be sticky disabled in register POC0. Because of this, the code will still read
the switch configuration and OR it to the device tree setting.

Signed-off-by: Vittorio Gambaletta 
---

--- /dev/null
+++ 
b/target/linux/ramips/patches-4.3/0516-net-mediatek-get-rt3050-ethernet-ports-to-be-disable.patch
@@ -0,0 +1,81 @@
+From: Vittorio Gambaletta 
+Date: Fri, 01 Jan 2016 00:00:02 +0100
+Subject: [PATCH 3/3] net: mediatek: Get rt3050 ethernet ports to be disabled 
from the device tree.
+
+This patch allows configuring ports to be disabled in the device tree; this
+saves power, since disabling ports here actually disables power to ethernet
+PHYs.
+
+Line 443 enables all ethernet ports, so line 486 is getting zero ports to be
+disabled, except for port 5 in SoCs where this is not implemented as it will
+be sticky disabled in register POC0. Because of this, the code will still read
+the switch configuration and OR it to the device tree setting.
+
+Signed-off-by: Vittorio Gambaletta 
+---
+
+--- a/drivers/net/ethernet/mediatek/esw_rt3050.c
 b/drivers/net/ethernet/mediatek/esw_rt3050.c
+@@ -10,6 +10,7 @@
+  *   Copyright (C) 2009-2015 John Crispin 
+  *   Copyright (C) 2009-2015 Felix Fietkau 
+  *   Copyright (C) 2013-2015 Michael Lee 
++ *   Copyright (C) 2016 Vittorio Gambaletta 
+  */
+ 
+ #include 
+@@ -218,6 +219,7 @@ struct rt305x_esw {
+   spinlock_t  reg_rw_lock;
+ 
+   unsigned char   port_map;
++  unsigned char   port_disable;
+   unsigned intreg_led_polarity;
+ 
+   struct switch_dev   swdev;
+@@ -482,8 +484,14 @@ static void esw_hw_init(struct rt305x_es
+   esw_w32(esw, 0x0005, RT305X_ESW_REG_P3LED);
+   esw_w32(esw, 0x0005, RT305X_ESW_REG_P4LED);
+ 
+-  /* Copy disabled port configuration from bootloader setup */
+-  port_disable = esw_get_port_disable(esw);
++  /* Copy disabled port configuration from device tree setup */
++  port_disable = esw->port_disable;
++
++  /* Disable nonexistent ports by reading the switch config
++   * after having enabled all possible ports above
++   */
++  port_disable |= esw_get_port_disable(esw);
++
+   for (i = 0; i < 6; i++)
+   esw->ports[i].disable = (port_disable & (1 << i)) != 0;
+ 
+@@ -1329,7 +1337,7 @@ static int esw_probe(struct platform_dev
+ {
+   struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+   struct device_node *np = pdev->dev.of_node;
+-  const __be32 *port_map, *reg_init;
++  const __be32 *port_map, *port_disable, *reg_init;
+   struct switch_dev *swdev;
+   struct rt305x_esw *esw;
+   struct resource *irq;
+@@ -1349,6 +1357,10 @@ static int esw_probe(struct platform_dev
+   if (port_map)
+   esw->port_map = be32_to_cpu(*port_map);
+ 
++  port_disable = of_get_property(np, "mediatek,portdisable", NULL);
++  if (port_disable)
++  esw->port_disable = be32_to_cpu(*port_disable);
++
+   reg_init = of_get_property(np, "mediatek,led_polarity", NULL);
+   if (reg_init)
+   esw->reg_led_polarity = be32_to_cpu(*reg_init);
+--- a/Documentation/devicetree/bindings/net/ralink,rt3050-esw.txt
 b/Documentation/devicetree/bindings/net/ralink,rt3050-esw.txt
+@@ -16,6 +16,7 @@ Required properties:
+ Optional properties:
+ - mediatek,portmap: can be used to choose if the default switch setup is
+   w or w
++- mediatek,portdisable: disable unused ethernet PHYs to save power
+ - mediatek,led_polarity: override the active high/low settings of the leds
+ 
+ Example:
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v4 2/4] [CC] ramips: Fix comment in rt3052 ethernet switch driver.

2015-12-31 Thread Vittorio G (VittGam)
Line 461 is actually enabling all switch ports by setting the disable bits
to 0. This needs to be done because the bootloader sets all ports to disabled
by default (which is the case for at least one router based on RT5350).

So, this patch fixes the comment in line 460.

Signed-off-by: Vittorio Gambaletta 
---

--- a/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
+++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
@@ -457,7 +457,7 @@ static void esw_hw_init(struct rt305x_esw *esw)
  (RT305X_ESW_PORTS_ALL << RT305X_ESW_PFC1_EN_VLAN_S),
  RT305X_ESW_REG_PFC1);
 
-   /* Enable Back Pressure, and Flow Control */
+   /* Enable all ports, Back Pressure and Flow Control */
esw_w32(esw,
  ((RT305X_ESW_PORTS_ALL << RT305X_ESW_POC0_EN_BP_S) |
   (RT305X_ESW_PORTS_ALL << RT305X_ESW_POC0_EN_FC_S)),
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v4 1/4] [CC] ramips: Fix whitespace in the rt3052 switch driver.

2015-12-31 Thread Vittorio G (VittGam)
Signed-off-by: Vittorio Gambaletta 
---

--- a/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
+++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
@@ -1417,19 +1417,19 @@ static int esw_probe(struct platform_device *pdev)
}
 
port_map = of_get_property(np, "ralink,portmap", NULL);
-if (port_map)
+   if (port_map)
esw->port_map = be32_to_cpu(*port_map);
 
reg_init = of_get_property(np, "ralink,fct2", NULL);
-if (reg_init)
+   if (reg_init)
esw->reg_initval_fct2 = be32_to_cpu(*reg_init);
 
reg_init = of_get_property(np, "ralink,fpa2", NULL);
-if (reg_init)
+   if (reg_init)
esw->reg_initval_fpa2 = be32_to_cpu(*reg_init);
 
reg_init = of_get_property(np, "ralink,led_polarity", NULL);
-if (reg_init)
+   if (reg_init)
esw->reg_led_polarity = be32_to_cpu(*reg_init);
 
swdev = &esw->swdev;
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v4 2/4] ramips: Fix comment in rt3050 ethernet switch driver.

2015-12-31 Thread Vittorio G (VittGam)
Line 443 is actually enabling all switch ports by setting the disable bits
to 0. This needs to be done because the bootloader sets all ports to disabled
by default (which is the case for at least one router based on RT5350).

So, this patch fixes the comment in line 442.

Signed-off-by: Vittorio Gambaletta 
---

--- /dev/null
+++ 
b/target/linux/ramips/patches-4.3/0515-net-mediatek-fix-comment-in-rt3050-ethernet-switch-d.patch
@@ -0,0 +1,24 @@
+From: Vittorio Gambaletta 
+Date: Fri, 01 Jan 2016 00:00:01 +0100
+Subject: [PATCH 2/3] net: mediatek: Fix comment in rt3050 ethernet switch 
driver.
+
+Line 443 is actually enabling all switch ports by setting the disable bits
+to 0. This needs to be done because the bootloader sets all ports to disabled
+by default (which is the case for at least one router based on RT5350).
+
+So, this patch fixes the comment in line 442.
+
+Signed-off-by: Vittorio Gambaletta 
+---
+
+--- a/drivers/net/ethernet/mediatek/esw_rt3050.c
 b/drivers/net/ethernet/mediatek/esw_rt3050.c
+@@ -439,7 +439,7 @@ static void esw_hw_init(struct rt305x_es
+(RT305X_ESW_PORTS_ALL << RT305X_ESW_PFC1_EN_VLAN_S),
+   RT305X_ESW_REG_PFC1);
+ 
+-  /* Enable Back Pressure, and Flow Control */
++  /* Enable all ports, Back Pressure and Flow Control */
+   esw_w32(esw, ((RT305X_ESW_PORTS_ALL << RT305X_ESW_POC0_EN_BP_S) |
+ (RT305X_ESW_PORTS_ALL << RT305X_ESW_POC0_EN_FC_S)),
+   RT305X_ESW_REG_POC0);
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v4 4/4] ramips: Disable all ethernet ports except port 4 on HT-TM02.

2015-12-31 Thread Vittorio G (VittGam)
Port 4 is the only ethernet port on this router, so disable all other PHYs
in order to save power.

Signed-off-by: Vittorio Gambaletta 
---

--- a/target/linux/ramips/dts/HT-TM02.dts
+++ b/target/linux/ramips/dts/HT-TM02.dts
@@ -63,6 +63,7 @@
 
esw@1011 {
mediatek,portmap = <0x10>;
+   mediatek,portdisable = <0x2f>;
};
 
wmac@1018 {
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v4 1/4] ramips: Fix documentation for the rt3050 switch driver.

2015-12-31 Thread Vittorio G (VittGam)
The prefix used in the driver is now "mediatek" instead of "ralink".

Signed-off-by: Vittorio Gambaletta 
---

--- /dev/null
+++ 
b/target/linux/ramips/patches-4.3/0514-Documentation-DT-net-mediatek-fix-documentation-for-.patch
@@ -0,0 +1,23 @@
+From: Vittorio Gambaletta 
+Date: Fri, 01 Jan 2016 00:00:00 +0100
+Subject: [PATCH 1/3] Documentation: DT: net: mediatek: Fix documentation for 
the rt3050 switch driver.
+
+The prefix used in the driver is now "mediatek" instead of "ralink".
+
+Signed-off-by: Vittorio Gambaletta 
+---
+
+--- a/Documentation/devicetree/bindings/net/ralink,rt3050-esw.txt
 b/Documentation/devicetree/bindings/net/ralink,rt3050-esw.txt
+@@ -14,9 +14,9 @@ Required properties:
+ - reset-names: Should contain the reset names "esw"
+ 
+ Optional properties:
+-- ralink,portmap: can be used to choose if the default switch setup is
++- mediatek,portmap: can be used to choose if the default switch setup is
+   w or w
+-- ralink,led_polarity: override the active high/low settings of the leds
++- mediatek,led_polarity: override the active high/low settings of the leds
+ 
+ Example:
+ 
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] lantiq: Configure LED polarity for TDW8970 and TDW8980.

2015-12-17 Thread Vittorio G (VittGam)
This patch configures the correct ath9k WLAN LED polarity for the TDW8970,
and for the TDW8980 as well.

Signed-off-by: Vittorio Gambaletta 

---

--- a/target/linux/lantiq/dts/TDW8970.dts
+++ b/target/linux/lantiq/dts/TDW8970.dts
@@ -4,8 +4,4 @@
 
 / {
model = "TDW8970 - TP-LINK TD-W8970";
-
-   ath9k_eep {
-   ath,led-active-high;
-   };
 };
--- a/target/linux/lantiq/dts/TDW89X0.dtsi
+++ b/target/linux/lantiq/dts/TDW89X0.dtsi
@@ -181,6 +181,7 @@
ath,mac-increment;
ath,led-pin = <0>;
ath,disable-5ghz;
+   ath,led-active-high;
};
 
gpio-keys-polled {
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 5/5] lantiq: Configure LED polarity for TDW8970.

2015-12-16 Thread Vittorio G (VittGam)


On 16 December 2015 22:12:15 CET, Mathias Kresin  wrote:
>The TDW8980 2.4 GHz Wireless LED is active high as well and your patch 
>fixed the inverse lighting.
>
>Would you please move the definition to the dtsi!

Sure, I will update the patches then. Thanks for testing!
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] lantiq: Add default LED configuration for TDW89X0.

2015-12-16 Thread Vittorio G (VittGam)


On 16 December 2015 23:13:16 CET, Mathias Kresin  wrote:

>This look unnecessary to me.
>   
>The default internet led configuration a few lines above, already adds 
>an internet led with exactly the same values.
>
>The same applies to the wifi led. I can not yet explain why, but the 
>ath9k-phy0 led has the phy0tpt trigger configured without having the 
>wifi led defined in 01_led on my TDW8980.

Uh, okay. Actually I've just resurrected my old CC trunk patches from some 
months ago (I forgot to send them to the list before, sorry about that...), 
adapted them for current trunk and sent them to the ml, so maybe trunk takes 
care of it already.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] lantiq: Add default LED configuration for TDW89X0.

2015-12-15 Thread Vittorio G (VittGam)
Signed-off-by: Vittorio Gambaletta 

---

--- a/target/linux/lantiq/base-files/etc/board.d/01_leds
+++ b/target/linux/lantiq/base-files/etc/board.d/01_leds
@@ -38,6 +38,10 @@ BTHOMEHUBV5A)
ucidef_set_led_netdev "internet" "internet" "soc:blue:broadband" 
"pppoa-wan"
ucidef_set_led_default "dimmed" "dimmed" "dimmed" "0"
;;
+TDW8970|TDW8980)
+   ucidef_set_led_wlan "wifi" "wifi" "ath9k-phy0" "phy0tpt"
+   ucidef_set_led_netdev "internet" "internet" "internet" "pppoe-wan"
+   ;;
 VGV7510KW22)
ucidef_set_led_default "power" "power" "power" "1"
ucidef_set_led_default "power2" "power2" "power2" "0"
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] lantiq: Fix LED handling.

2015-12-15 Thread Vittorio G (VittGam)
- Use common OpenWrt blink patterns instead of custom ones
- Add preinit_regular hook
- Handle the TDW89X0 that does not have a configurable power LED

Signed-off-by: Vittorio Gambaletta 

---

--- a/target/linux/lantiq/base-files/etc/diag.sh
+++ b/target/linux/lantiq/base-files/etc/diag.sh
@@ -3,40 +3,48 @@
 
 . /lib/functions/leds.sh
 
-status_led="power"
+status_led=power
+[ ! -d /sys/class/leds/power/ ] && [ ! -d /sys/class/leds/power1/ ] && [ ! -d 
/sys/class/leds/power2/ ] && [ -d /sys/class/leds/wps/ ] && status_led=wps
 
 set_state() {
-   [ -d /sys/class/leds/power2/ ] && {
-
-   case "$1" in
-   preinit)
-   led_set_attr "power2" "trigger" "heartbeat"
-   status_led_on
-   ;;
-   failsafe)
-   led_off "power2"
-   status_led_set_timer 100 100
-   ;;
-   done)
-   led_off "power2"
-   ;;
-   esac
-   return
-   }
-
case "$1" in
preinit)
-   status_led_set_heartbeat
+   if [ -d /sys/class/leds/power2/ ]; then
+   status_led_on
+   status_led=power2
+   status_led_blink_preinit
+   status_led=power
+   else
+   status_led_blink_preinit
+   fi
;;
failsafe)
-   [ -d /sys/class/leds/power1 ] && {
+   if [ -d /sys/class/leds/power2/ ]; then
+   led_off power2
+   status_led_blink_failsafe
+   elif [ -d /sys/class/leds/power1/ ]; then
status_led_off
-   led_timer "power1" 100 100
-   } || status_led_set_timer 100 100
+   status_led=power1
+   status_led_blink_failsafe
+   status_led=power
+   else
+   status_led_blink_failsafe
+   fi
+   ;;
+   preinit_regular)
+   if [ -d /sys/class/leds/power2/ ]; then
+   status_led_on
+   status_led=power2
+   status_led_blink_preinit_regular
+   status_led=power
+   else
+   status_led_blink_preinit_regular
+   fi
;;
done)
status_led_on
-   led_off "power1"
+   led_off power1
+   led_off power2
;;
esac
 }
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 5/5] lantiq: Configure LED polarity for TDW8970.

2015-12-15 Thread Vittorio G (VittGam)
This patch configures the correct ath9k WLAN LED polarity for the TDW8970.

Signed-off-by: Vittorio Gambaletta 

---

The TDW8970 LED is active high, but I'm not sure about the TDW8980 as
I don't have one. If the TDW8980 LED is active high as well, this can
be added to TDW89X0.dtsi instead of TDW8970.dts.

--- a/target/linux/lantiq/dts/TDW8970.dts
+++ b/target/linux/lantiq/dts/TDW8970.dts
@@ -4,4 +4,8 @@
 
 / {
model = "TDW8970 - TP-LINK TD-W8970";
+
+   ath9k_eep {
+   ath,led-active-high;
+   };
 };
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 2/5] ath9k: Allow configuration of LED polarity in platform data.

2015-12-15 Thread Vittorio G (VittGam)
Signed-off-by: Vittorio Gambaletta 

---

--- a/target/linux/generic/files/include/linux/ath9k_platform.h
+++ b/target/linux/generic/files/include/linux/ath9k_platform.h
@@ -36,6 +36,7 @@ struct ath9k_platform_data {
bool tx_gain_buffalo;
bool disable_2ghz;
bool disable_5ghz;
+   bool led_active_high;
 
int (*get_mac_revision)(void);
int (*external_reset)(void);
--- /dev/null
+++ 
b/package/kernel/mac80211/patches/532-ath9k_get_led_polarity_from_platform_data.patch
@@ -0,0 +1,20 @@
+--- a/include/linux/ath9k_platform.h
 b/include/linux/ath9k_platform.h
+@@ -36,6 +36,7 @@ struct ath9k_platform_data {
+   bool tx_gain_buffalo;
+   bool disable_2ghz;
+   bool disable_5ghz;
++  bool led_active_high;
+ 
+   int (*get_mac_revision)(void);
+   int (*external_reset)(void);
+--- a/drivers/net/wireless/ath/ath9k/init.c
 b/drivers/net/wireless/ath/ath9k/init.c
+@@ -577,6 +577,7 @@ static int ath9k_init_softc(u16 devid, struct ath_softc 
*sc,
+   ah->external_reset = pdata->external_reset;
+   ah->disable_2ghz = pdata->disable_2ghz;
+   ah->disable_5ghz = pdata->disable_5ghz;
++  ah->config.led_active_high = pdata->led_active_high;
+   if (!pdata->endian_check)
+   ah->ah_flags |= AH_NO_EEP_SWAP;
+   }
--- a/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
+++ b/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
@@ -55,7 +55,7 @@
ops->spectral_scan_config = ar9003_hw_spectral_scan_config;
 --- a/drivers/net/wireless/ath/ath9k/init.c
 +++ b/drivers/net/wireless/ath/ath9k/init.c
-@@ -710,7 +710,8 @@ static void ath9k_init_txpower_limits(st
+@@ -711,7 +711,8 @@ static void ath9k_init_txpower_limits(st
if (ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ)
ath9k_init_band_txpower(sc, IEEE80211_BAND_5GHZ);
  
@@ -65,7 +65,7 @@
  }
  
  static const struct ieee80211_iface_limit if_limits[] = {
-@@ -910,6 +911,18 @@ static void ath9k_set_hw_capab(struct at
+@@ -911,6 +912,18 @@ static void ath9k_set_hw_capab(struct at
SET_IEEE80211_PERM_ADDR(hw, common->macaddr);
  }
  
@@ -84,7 +84,7 @@
  int ath9k_init_device(u16 devid, struct ath_softc *sc,
const struct ath_bus_ops *bus_ops)
  {
-@@ -955,6 +968,8 @@ int ath9k_init_device(u16 devid, struct
+@@ -956,6 +969,8 @@ int ath9k_init_device(u16 devid, struct
ARRAY_SIZE(ath9k_tpt_blink));
  #endif
  
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 4/5] lantiq: Configure disabled WLAN bands for TDW89X0.

2015-12-15 Thread Vittorio G (VittGam)
The TDW8970 has a AR9381, which is the bgn 3x3:3 variant of the AR938x family.

The TDW8980 has a AR9287, which is the bgn 2x2:2 variant of the AR928x family.

This means that the chip for both routers is 2.4 GHz only.

Anyway, the manufacturer didn't disable the 5 GHz band in the EEPROM partition
(at least on my TDW8970).

So this patch disables the 5 GHz band.

Signed-off-by: Vittorio Gambaletta 

---

--- a/target/linux/lantiq/dts/TDW89X0.dtsi
+++ b/target/linux/lantiq/dts/TDW89X0.dtsi
@@ -180,6 +180,7 @@
ath,mac-offset = <0xf100>;
ath,mac-increment;
ath,led-pin = <0>;
+   ath,disable-5ghz;
};
 
gpio-keys-polled {
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 3/5] lantiq: Allow configuration of ath9k disabled bands and LED polarity from the device tree.

2015-12-15 Thread Vittorio G (VittGam)
Signed-off-by: Vittorio Gambaletta 

---

--- 
a/target/linux/lantiq/patches-4.1/0035-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch
+++ 
b/target/linux/lantiq/patches-4.1/0035-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch
@@ -51,13 +51,14 @@ Signed-off-by: John Crispin 
  obj-$(CONFIG_XRX200_PHY_FW) += xrx200_phy_fw.o
 --- /dev/null
 +++ b/arch/mips/lantiq/xway/ath_eep.c
-@@ -0,0 +1,282 @@
+@@ -0,0 +1,298 @@
 +/*
 + *  Copyright (C) 2011 Luca Olivetti 
 + *  Copyright (C) 2011 John Crispin 
 + *  Copyright (C) 2011 Andrej Vlašić 
 + *  Copyright (C) 2013 Álvaro Fernández Rojas 
 + *  Copyright (C) 2013 Daniel Gimpelevich 

++ *  Copyright (C) 2015 Vittorio Gambaletta 
 + *
 + *  This program is free software; you can redistribute it and/or modify it
 + *  under the terms of the GNU General Public License version 2 as published
@@ -192,6 +193,21 @@ Signed-off-by: John Crispin 
 +  dev_info(&pdev->dev, "using led pin %d.\n", led_pin);
 +  }
 +
++  if (of_property_read_bool(np, "ath,led-active-high")) {
++  ath9k_pdata.led_active_high = true;
++  dev_info(&pdev->dev, "inverted LED polarity\n");
++  }
++
++  if (of_property_read_bool(np, "ath,disable-2ghz")) {
++  ath9k_pdata.disable_2ghz = true;
++  dev_info(&pdev->dev, "disabled 2.4 GHz band\n");
++  }
++
++  if (of_property_read_bool(np, "ath,disable-5ghz")) {
++  ath9k_pdata.disable_5ghz = true;
++  dev_info(&pdev->dev, "disabled 5 GHz band\n");
++  }
++
 +  dev_info(&pdev->dev, "loaded ath9k eeprom\n");
 +
 +  return 0;
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 1/5] ath9k: Pass LED polarity to ath_create_gpio_led when initializing the LEDs.

2015-12-15 Thread Vittorio G (VittGam)
Signed-off-by: Vittorio Gambaletta 

---

--- a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
+++ b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
@@ -159,7 +159,7 @@
 +  trigger = ieee80211_get_radio_led_name(sc->hw);
  
 -  sc->led_registered = true;
-+  ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, 1);
++  ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, 
!sc->sc_ah->config.led_active_high);
  }
  
  void ath_fill_led_pin(struct ath_softc *sc)
--- a/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch
+++ b/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch
@@ -59,7 +59,7 @@
 @@ -120,6 +141,12 @@ void ath_init_leds(struct ath_softc *sc)
trigger = ieee80211_get_radio_led_name(sc->hw);
  
-   ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, 1);
+   ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, 
!sc->sc_ah->config.led_active_high);
 +
 +  if (!pdata)
 +  return;
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v3 2/3] ramips: Get ethernet ports to be disabled from the device tree.

2015-12-12 Thread Vittorio G (VittGam)
Line 461 is actually enabling all switch ports, so line 508 is always getting
zero ports to be disabled (except for port 5 in SoCs where this is not 
implemented,
as it will be sticky disabled in register POC0).

Also, the bootloader on some routers sets all ports to disabled (which is
the case for at least one router based on RT5350).

(v3 of this patch adds "else port_disable = esw_get_port_disable(esw);" anyway.)

So, this patch allows configuring ports to be disabled in the device tree.

Power can be saved too this way, since disabling ports here actually disables
power to ethernet PHYs.

Signed-off-by: Vittorio Gambaletta 

---

Please apply to both trunk and CC.

--- a/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
+++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
@@ -233,6 +233,7 @@ struct rt305x_esw {
spinlock_t  reg_rw_lock;
 
unsigned char   port_map;
+   unsigned char   port_disable;
unsigned intreg_initval_fct2;
unsigned intreg_initval_fpa2;
unsigned intreg_led_polarity;
@@ -457,7 +458,7 @@ static void esw_hw_init(struct rt305x_esw *esw)
  (RT305X_ESW_PORTS_ALL << RT305X_ESW_PFC1_EN_VLAN_S),
  RT305X_ESW_REG_PFC1);
 
-   /* Enable Back Pressure, and Flow Control */
+   /* Enable all ports, Back Pressure and Flow Control */
esw_w32(esw,
  ((RT305X_ESW_PORTS_ALL << RT305X_ESW_POC0_EN_BP_S) |
   (RT305X_ESW_PORTS_ALL << RT305X_ESW_POC0_EN_FC_S)),
@@ -504,8 +505,11 @@ static void esw_hw_init(struct rt305x_esw *esw)
esw_w32(esw, 0x0005, RT305X_ESW_REG_P3LED);
esw_w32(esw, 0x0005, RT305X_ESW_REG_P4LED);
 
-   /* Copy disabled port configuration from bootloader setup */
-   port_disable = esw_get_port_disable(esw);
+   /* Copy disabled port configuration from device tree setup */
+   if (esw->port_disable)
+   port_disable = esw->port_disable;
+   else
+   port_disable = esw_get_port_disable(esw);
for (i = 0; i < 6; i++)
esw->ports[i].disable = (port_disable & (1 << i)) != 0;
 
@@ -1373,7 +1377,7 @@ static int esw_probe(struct platform_device *pdev)
 {
struct device_node *np = pdev->dev.of_node;
const struct rt305x_esw_platform_data *pdata;
-   const __be32 *port_map, *reg_init;
+   const __be32 *port_map, *port_disable, *reg_init;
struct rt305x_esw *esw;
struct switch_dev *swdev;
struct resource *res, *irq;
@@ -1419,6 +1423,10 @@ static int esw_probe(struct platform_device *pdev)
port_map = of_get_property(np, "ralink,portmap", NULL);
if (port_map)
esw->port_map = be32_to_cpu(*port_map);
+
+   port_disable = of_get_property(np, "ralink,portdisable", NULL);
+   if (port_disable)
+   esw->port_disable = be32_to_cpu(*port_disable);
 
reg_init = of_get_property(np, "ralink,fct2", NULL);
if (reg_init)
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v3 3/3] [CC] ramips: Disable all ethernet ports except port 4 on HT-TM02.

2015-12-12 Thread Vittorio G (VittGam)
Port 4 is the only ethernet port on this router, so disable all other PHYs
in order to save power.

Signed-off-by: Vittorio Gambaletta 

---

This is a backport of the patch for trunk.

--- a/target/linux/ramips/dts/HT-TM02.dts
+++ b/target/linux/ramips/dts/HT-TM02.dts
@@ -57,6 +57,7 @@
 
esw@1011 {
ralink,portmap = <0x10>;
+   ralink,portdisable = <0x2f>;
};
 
wmac@1018 {
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v3 1/3] ramips: Fix whitespace in the switch driver.

2015-12-12 Thread Vittorio G (VittGam)
Signed-off-by: Vittorio Gambaletta 

---

Please apply to both trunk and CC.

--- a/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
+++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
@@ -1417,19 +1417,19 @@ static int esw_probe(struct platform_device *pdev)
}
 
port_map = of_get_property(np, "ralink,portmap", NULL);
-if (port_map)
+   if (port_map)
esw->port_map = be32_to_cpu(*port_map);
 
reg_init = of_get_property(np, "ralink,fct2", NULL);
-if (reg_init)
+   if (reg_init)
esw->reg_initval_fct2 = be32_to_cpu(*reg_init);
 
reg_init = of_get_property(np, "ralink,fpa2", NULL);
-if (reg_init)
+   if (reg_init)
esw->reg_initval_fpa2 = be32_to_cpu(*reg_init);
 
reg_init = of_get_property(np, "ralink,led_polarity", NULL);
-if (reg_init)
+   if (reg_init)
esw->reg_led_polarity = be32_to_cpu(*reg_init);
 
swdev = &esw->swdev;
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v3 3/3] ramips: Disable all ethernet ports except port 4 on HT-TM02.

2015-12-12 Thread Vittorio G (VittGam)
Port 4 is the only ethernet port on this router, so disable all other PHYs
in order to save power.

Signed-off-by: Vittorio Gambaletta 

---

Please apply to trunk only, a backport will follow.

--- a/target/linux/ramips/dts/HT-TM02.dts
+++ b/target/linux/ramips/dts/HT-TM02.dts
@@ -63,6 +63,7 @@
 
esw@1011 {
ralink,portmap = <0x10>;
+   ralink,portdisable = <0x2f>;
};
 
wmac@1018 {
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH v2 2/3] ramips: Get ethernet ports to be disabled from the device tree.

2015-12-11 Thread Vittorio G (VittGam)

On 12/12/2015 08:23:24 CET, John Crispin wrote:

tl;dr


It does not change current behaviour because all ports get enabled before.


if you want this merged you will need to add a port_disabled variable


I don't like it this way, but okay I will add that variable.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH v2 2/3] ramips: Get ethernet ports to be disabled from the device tree.

2015-12-11 Thread Vittorio G (VittGam)

Hi,

On 12/12/2015 07:20:43 CET, John Crispin wrote:

On 12/12/2015 07:19, John Crispin wrote:

why a semicolon ? i believe a "," needs to be added instead please also
remove the superfluous "," while you are at it to make the comment
orthographically correct. it seems to be have been copied from SDK code.


you already removed the extra "," sorry i missed that


Ok. Would "Enable all ports, Back Pressure and Flow Control" be okay?


> -  /* Copy disabled port configuration from bootloader setup */
> -  port_disable = esw_get_port_disable(esw);
> +  /* Copy disabled port configuration from device tree setup */
> +  if (esw->port_disable)
> +  port_disable = esw->port_disable;
this changes the behavior of the code and will most likely break several
board.


Why? In the previous code we're going to enable all ports anyway by clearing
all of the port disabled bits, so esw_get_port_disable would have returned
zero; and now port_disable is 0 by default if it isn't set in the device tree.
The only case where esw_get_port_disable would have returned a value different
from zero is when port 5 is not implemented in the SoC, but the port power
down logic that follows is not going to handle port 5 anyway. Furthermore,
user space reporting of the disabled status (eg. swconfig dev switch0 show)
is read again from the chip at every report request, so port 5 will show as
disabled correctly for SoCs where it is not implemented like RT5350.

Anyway, if you think that an "else port_disable = esw_get_port_disable(esw);"
would be better anyway, I can add it. (But I think it'd be superfluous...
Unless there's some SoC that behaves differently than this.)


port_map is named as such as it is a port_map and not a port_disable. we
already concluded yesterday that this is a bad code style.


It's the mapping of the disabled ports... But okay, I'll change every variable
to be "tmp" instead this time.

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


Re: [OpenWrt-Devel] [PATCH v2 3/3] [CC] ramips: Disable all ethernet ports except port 4 on HT-TM02.

2015-12-11 Thread Vittorio G (VittGam)

Hi,

On 12/12/2015 07:16:09 CET, John Crispin wrote:

patch 1/3 and 3/3 seem to be missing for this eries


Patches 1/3 and 2/3 are the same for trunk and CC, and there is a
comment saying that on those patches. Patch 3/3 would not apply
cleanly to CC instead, so that's why it's splitted.

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


[OpenWrt-Devel] [PATCH v2 2/3] ramips: Get ethernet ports to be disabled from the device tree.

2015-12-11 Thread Vittorio G (VittGam)
Line 461 is actually enabling all switch ports, so line 508 is always getting
zero ports to be disabled (except for port 5 in SoCs where this is not 
implemented,
as it will be sticky disabled in register POC0).

Also, the bootloader on some routers sets all ports to disabled (which is
the case for at least one router based on RT5350).

So, this patch allows configuring ports to be disabled in the device tree.

Power can be saved too this way, since disabling ports here actually disables
power to ethernet PHYs.

Signed-off-by: Vittorio Gambaletta 

---

Please apply to both trunk and CC.

--- a/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
+++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
@@ -233,6 +233,7 @@ struct rt305x_esw {
spinlock_t  reg_rw_lock;
 
unsigned char   port_map;
+   unsigned char   port_disable;
unsigned intreg_initval_fct2;
unsigned intreg_initval_fpa2;
unsigned intreg_led_polarity;
@@ -457,7 +458,7 @@ static void esw_hw_init(struct rt305x_esw *esw)
  (RT305X_ESW_PORTS_ALL << RT305X_ESW_PFC1_EN_VLAN_S),
  RT305X_ESW_REG_PFC1);
 
-   /* Enable Back Pressure, and Flow Control */
+   /* Enable all ports; enable Back Pressure and Flow Control */
esw_w32(esw,
  ((RT305X_ESW_PORTS_ALL << RT305X_ESW_POC0_EN_BP_S) |
   (RT305X_ESW_PORTS_ALL << RT305X_ESW_POC0_EN_FC_S)),
@@ -504,8 +505,9 @@ static void esw_hw_init(struct rt305x_esw *esw)
esw_w32(esw, 0x0005, RT305X_ESW_REG_P3LED);
esw_w32(esw, 0x0005, RT305X_ESW_REG_P4LED);
 
-   /* Copy disabled port configuration from bootloader setup */
-   port_disable = esw_get_port_disable(esw);
+   /* Copy disabled port configuration from device tree setup */
+   if (esw->port_disable)
+   port_disable = esw->port_disable;
for (i = 0; i < 6; i++)
esw->ports[i].disable = (port_disable & (1 << i)) != 0;
 
@@ -1419,6 +1421,10 @@ static int esw_probe(struct platform_device *pdev)
port_map = of_get_property(np, "ralink,portmap", NULL);
if (port_map)
esw->port_map = be32_to_cpu(*port_map);
+
+   port_map = of_get_property(np, "ralink,portdisable", NULL);
+   if (port_map)
+   esw->port_disable = be32_to_cpu(*port_map);
 
reg_init = of_get_property(np, "ralink,fct2", NULL);
if (reg_init)
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v2 3/3] ramips: Disable all ethernet ports except port 4 on HT-TM02.

2015-12-11 Thread Vittorio G (VittGam)
Port 4 is the only ethernet port on this router, so disable all other PHYs
in order to save power.

Signed-off-by: Vittorio Gambaletta 

---

--- a/target/linux/ramips/dts/HT-TM02.dts
+++ b/target/linux/ramips/dts/HT-TM02.dts
@@ -63,6 +63,7 @@
 
esw@1011 {
ralink,portmap = <0x10>;
+   ralink,portdisable = <0x2f>;
};
 
wmac@1018 {
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v2 3/3] [CC] ramips: Disable all ethernet ports except port 4 on HT-TM02.

2015-12-11 Thread Vittorio G (VittGam)
Port 4 is the only ethernet port on this router, so disable all other PHYs
in order to save power.

Signed-off-by: Vittorio Gambaletta 

---

--- a/target/linux/ramips/dts/HT-TM02.dts
+++ b/target/linux/ramips/dts/HT-TM02.dts
@@ -57,6 +57,7 @@
 
esw@1011 {
ralink,portmap = <0x10>;
+   ralink,portdisable = <0x2f>;
};
 
wmac@1018 {
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v2 1/3] ramips: Fix whitespace in the switch driver.

2015-12-11 Thread Vittorio G (VittGam)
Signed-off-by: Vittorio Gambaletta 

---

At the end, let's leave port_map and reg_init, and in the next patch
reuse port_map for port_disable too.

Please apply to both trunk and CC.

--- a/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
+++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
@@ -1417,19 +1417,19 @@ static int esw_probe(struct platform_device *pdev)
}
 
port_map = of_get_property(np, "ralink,portmap", NULL);
-if (port_map)
+   if (port_map)
esw->port_map = be32_to_cpu(*port_map);
 
reg_init = of_get_property(np, "ralink,fct2", NULL);
-if (reg_init)
+   if (reg_init)
esw->reg_initval_fct2 = be32_to_cpu(*reg_init);
 
reg_init = of_get_property(np, "ralink,fpa2", NULL);
-if (reg_init)
+   if (reg_init)
esw->reg_initval_fpa2 = be32_to_cpu(*reg_init);
 
reg_init = of_get_property(np, "ralink,led_polarity", NULL);
-if (reg_init)
+   if (reg_init)
esw->reg_led_polarity = be32_to_cpu(*reg_init);
 
swdev = &esw->swdev;
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 1/3] ramips: Fix whitespace in the switch driver.

2015-12-11 Thread Vittorio G (VittGam)

Hi,

On 11/12/2015 15:12:32 CET, Arjen de Korte wrote:

Because there are two __be32's used to fetch data from the device
tree; one is used only once for the portmap, while the other is
used three times, for the two registers and for the led_polarity.
Maybe the name should be tmp instead, but I think that the variable
should be just one here.


You're trying to outsmart the compiler in order to save space? Any  compiler 
from the last decade will take notice of the scope in which  variables are used 
and will reuse stack (or register) space if the  value they hold is no longer 
needed/used. I'm with John here, clarity  in the naming of variables is much 
more important.


Well, if the single "tmp" approach is not good, the current approach
that uses reg_init even for the led_polarity is not good either...

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


Re: [OpenWrt-Devel] [PATCH] ramips: Fix failsafe for HT-TM02.

2015-12-11 Thread Vittorio G (VittGam)

On 11/12/2015 15:02:43 CET, John Crispin wrote:

On 11/12/2015 14:48, Vittorio G (VittGam) wrote:

We cannot use board.json data here: this code is called before mounting
the rootfs, in the preinit.


we can. i just spoke with jow and we will add a codepath to failsafe to
probe board.json


Is this a new feature of trunk, to have board.json available even without
mounting the jffs2 and without running the init scripts? In CC this isn't
the case...

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


Re: [OpenWrt-Devel] [PATCH 1/3] ramips: Fix whitespace in the switch driver.

2015-12-11 Thread Vittorio G (VittGam)

Hi,

On 11/12/2015 10:32:08 CET, John Crispin wrote:

1) the subject and description dont match.


Well, the description is an addition to the subject, but okay.


2) why would we want to intermingle the portmap and register init
variables. they are 2 different things. imho that is not correct


Because there are two __be32's used to fetch data from the device
tree; one is used only once for the portmap, while the other is
used three times, for the two registers and for the led_polarity.
Maybe the name should be tmp instead, but I think that the variable
should be just one here.

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


Re: [OpenWrt-Devel] [PATCH] ramips: Fix failsafe for HT-TM02.

2015-12-11 Thread Vittorio G (VittGam)

Hi,

On 11/12/2015 14:32:45 CET, John Crispin wrote:

hardcoding the board id here is not a good idea. we should rather use
the board.json data to probe if a switch is registered. if not we dont
apply the hack. i'll ask jow to tell us how to probe for a switch.


We cannot use board.json data here: this code is called before mounting
the rootfs, in the preinit.

Also, the switch is actually registered, just vlans are not needed on
HT-TM02 for normal operation and thus are normally disabled.

Also, the LAN and only port is 4, so by adding just 0 to the failsafe
vlan then the failsafe is broken for this router.

We could detect that the LAN port is 4 here, but this code is still
not needed for this router. Furthermore, this creates an useless eth0.1
interface that is visible in eg. ifconfig even when failsafe is not
triggered. This may create problems with bridging since LAN VLAN 1
would not be passed to the br-lan bridge (and thus to the WLAN, in
the default config) anymore. This will break WLAN VLAN trunking for
instance.

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


Re: [OpenWrt-Devel] [PATCH 3/3] ramips: Disable all ethernet ports except port 4 on HT-TM02.

2015-12-11 Thread Vittorio G (VittGam)

Hi,

On 11/12/2015 12:29:00 CET, John Crispin wrote:

On 05/12/2015 12:04, Vittorio G (VittGam) wrote:

esw@1011 {
ralink,portmap = <0x10>;
+   ralink,portdisable = <0x2f>;
};


i think it makes more sense to derive 0x2f from the 0x10 as both
together will always be 0x3f


No, it does not.

Portmap selects which ports are LAN ports and which are WAN ports.
Here the only port (4) is selected as LAN.

Portdisable instead selects which port we need to power down in order
to save power. In this case, every port except 4 is selected because
4 is the only port.

The fact that for this router the combination is 0x3f is just a
coincidence.

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


Re: [OpenWrt-Devel] [PATCH v6 5/6] ar71xx: scan nand ubi partition for ath9k eeprom files

2015-12-06 Thread Vittorio G (VittGam)

On 05/12/2015 23:48:07 CET, Christian Lamparter wrote:

mtd=$(find_mtd_chardev $part)
[ -n "$mtd" ] || \
-   ath9k_eeprom_die "no mtd device found for partition $part"
+   mtd="/dev/$(nand_find_volume $ubidev $part)"
+   [ -n "$mtd" ] || \
+   ath9k_eeprom_die "no mtd device found for partition 
$part"


The new check will always return true, because $mtd will contain "/dev/" if
nand_find_volume cannot find the volume.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 3/3] [CC] ramips: Disable all ethernet ports except port 4 on HT-TM02.

2015-12-05 Thread Vittorio G (VittGam)
Port 4 is the only ethernet port on this router, so disable all other PHYs
in order to save power.

Signed-off-by: Vittorio Gambaletta 

---

--- a/target/linux/ramips/dts/HT-TM02.dts
+++ b/target/linux/ramips/dts/HT-TM02.dts
@@ -57,6 +57,7 @@
 
esw@1011 {
ralink,portmap = <0x10>;
+   ralink,portdisable = <0x2f>;
};
 
wmac@1018 {
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] ramips: Fix failsafe for HT-TM02.

2015-12-05 Thread Vittorio G (VittGam)
The failsafe VLAN workaround is not needed on HT-TM02 (RT5350); it actually 
breaks
failsafe since this router has only one port and it is 4 and not 0.

Anyway, it seems that the workaround is still needed for other routers (see
https://patchwork.ozlabs.org/patch/424017/ for a previous attempt at removal of
the whole workaround).

So this patch explicitly whitelists the HT-TM02 from getting the VLAN 
workaround.

This makes failsafe work correctly on it via the ethernet port.

Signed-off-by: Vittorio Gambaletta 

---

Please apply to both trunk and CC.

--- a/target/linux/ramips/base-files/lib/preinit/07_set_preinit_iface_ramips
+++ b/target/linux/ramips/base-files/lib/preinit/07_set_preinit_iface_ramips
@@ -11,7 +11,7 @@ ramips_set_preinit_iface() {
swconfig dev rt305x set reset 1
fi
 
-   if echo $RT3X5X | egrep -q "(RT5350|MT7628|MT7688)"; then
+   if echo $RT3X5X | egrep -q "(RT5350|MT7628|MT7688)" && [ 
"$(ramips_board_name)" != "ht-tm02" ]; then
# This is a dirty hack to get by while the switch
# problem is investigated. When VLAN is disabled, ICMP
# pings work as expected, but TCP connections time
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 3/3] ramips: Disable all ethernet ports except port 4 on HT-TM02.

2015-12-05 Thread Vittorio G (VittGam)
Port 4 is the only ethernet port on this router, so disable all other PHYs
in order to save power.

Signed-off-by: Vittorio Gambaletta 

---

--- a/target/linux/ramips/dts/HT-TM02.dts
+++ b/target/linux/ramips/dts/HT-TM02.dts
@@ -63,6 +63,7 @@
 
esw@1011 {
ralink,portmap = <0x10>;
+   ralink,portdisable = <0x2f>;
};
 
wmac@1018 {
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 2/3] ramips: Get ethernet ports to be disabled from the device tree.

2015-12-05 Thread Vittorio G (VittGam)
Line 461 is actually enabling all switch ports, so line 508 is always getting
zero ports to be disabled (except for port 5 in SoCs where this is not 
implemented,
as it will be sticky disabled in register POC0).

Also, the bootloader on some routers sets all ports to disabled (which is
also the default for at least RT5350).

So, this patch allows configuring ports to be disabled in the device tree.

Power can be saved too this way, since disabling ports here actually disables
power to ethernet PHYs.

Signed-off-by: Vittorio Gambaletta 

---

Please apply to both trunk and CC.

--- a/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
+++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
@@ -233,6 +233,7 @@ struct rt305x_esw {
spinlock_t  reg_rw_lock;
 
unsigned char   port_map;
+   unsigned char   port_disable;
unsigned intreg_initval_fct2;
unsigned intreg_initval_fpa2;
unsigned intreg_led_polarity;
@@ -457,7 +458,7 @@ static void esw_hw_init(struct rt305x_esw *esw)
  (RT305X_ESW_PORTS_ALL << RT305X_ESW_PFC1_EN_VLAN_S),
  RT305X_ESW_REG_PFC1);
 
-   /* Enable Back Pressure, and Flow Control */
+   /* Enable all ports; enable Back Pressure and Flow Control */
esw_w32(esw,
  ((RT305X_ESW_PORTS_ALL << RT305X_ESW_POC0_EN_BP_S) |
   (RT305X_ESW_PORTS_ALL << RT305X_ESW_POC0_EN_FC_S)),
@@ -504,8 +505,9 @@ static void esw_hw_init(struct rt305x_esw *esw)
esw_w32(esw, 0x0005, RT305X_ESW_REG_P3LED);
esw_w32(esw, 0x0005, RT305X_ESW_REG_P4LED);
 
-   /* Copy disabled port configuration from bootloader setup */
-   port_disable = esw_get_port_disable(esw);
+   /* Copy disabled port configuration from device tree setup */
+   if (esw->port_disable)
+   port_disable = esw->port_disable;
for (i = 0; i < 6; i++)
esw->ports[i].disable = (port_disable & (1 << i)) != 0;
 
@@ -1419,6 +1421,10 @@ static int esw_probe(struct platform_device *pdev)
reg_init = of_get_property(np, "ralink,portmap", NULL);
if (reg_init)
esw->port_map = be32_to_cpu(*reg_init);
+
+   reg_init = of_get_property(np, "ralink,portdisable", NULL);
+   if (reg_init)
+   esw->port_disable = be32_to_cpu(*reg_init);
 
reg_init = of_get_property(np, "ralink,fct2", NULL);
if (reg_init)
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 1/3] ramips: Fix whitespace in the switch driver.

2015-12-05 Thread Vittorio G (VittGam)
Also avoid using two variables where one can be used.

Signed-off-by: Vittorio Gambaletta 

---

Please apply to both trunk and CC.

--- a/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
+++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
@@ -1373,7 +1373,7 @@ static int esw_probe(struct platform_device *pdev)
 {
struct device_node *np = pdev->dev.of_node;
const struct rt305x_esw_platform_data *pdata;
-   const __be32 *port_map, *reg_init;
+   const __be32 *reg_init;
struct rt305x_esw *esw;
struct switch_dev *swdev;
struct resource *res, *irq;
@@ -1416,20 +1416,20 @@ static int esw_probe(struct platform_device *pdev)
goto free_esw;
}
 
-   port_map = of_get_property(np, "ralink,portmap", NULL);
-if (port_map)
-   esw->port_map = be32_to_cpu(*port_map);
+   reg_init = of_get_property(np, "ralink,portmap", NULL);
+   if (reg_init)
+   esw->port_map = be32_to_cpu(*reg_init);
 
reg_init = of_get_property(np, "ralink,fct2", NULL);
-if (reg_init)
+   if (reg_init)
esw->reg_initval_fct2 = be32_to_cpu(*reg_init);
 
reg_init = of_get_property(np, "ralink,fpa2", NULL);
-if (reg_init)
+   if (reg_init)
esw->reg_initval_fpa2 = be32_to_cpu(*reg_init);
 
reg_init = of_get_property(np, "ralink,led_polarity", NULL);
-if (reg_init)
+   if (reg_init)
esw->reg_led_polarity = be32_to_cpu(*reg_init);
 
swdev = &esw->swdev;
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Removing Telnet

2015-09-08 Thread Vittorio G (VittGam)

Il 08.09.2015 21:31 Michael Heimpold ha scritto:

I also remember that "long time ago" there were issues because of
not enough entropy available on embedded devices.
Is this still an issue? Should only delay the time when logging in is
possible, right?


The dropbearkey key generation will delay dropbear start, so it will
reply with connection refused until it's ready. It would be worth trying
the -R option instead of dropbearkey...
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Removing Telnet

2015-09-08 Thread Vittorio G (VittGam)

Il 08.09.2015 20:34 Vittorio G (VittGam) ha scritto:

Maybe it would just be better to set the default root password to 'openwrt'
or 'insecure' or 'change_me!'?


Maybe along with a preauthentication banner that tells the user about the
default password and the fact that it should be changed as soon as possible.

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


Re: [OpenWrt-Devel] Removing Telnet

2015-09-08 Thread Vittorio G (VittGam)

Il 08.09.2015 10:15 Steven Barth ha scritto:

as of https://dev.openwrt.org/changeset/46809 telnet is no longer part of
the base images. As a replacement, it is now possible to login to the root-
account via SSH without a password prompt whenever no root password is set,
e.g. after a flash without keeping config, factory reset or in failsafe.


What about empty root password but authorized_keys for root present? This
behavior is not clear from the patch...

Maybe it would just be better to set the default root password to 'openwrt'
or 'insecure' or 'change_me!'?

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


Re: [OpenWrt-Devel] Fwd: Removing Telnet

2015-09-08 Thread Vittorio G (VittGam)

Il 08.09.2015 20:06 Sami Olmari ha scritto:

Does Dropbeard support ether? I know OpenSSH does, but default
installation does not use that.


I just checked the changelog[1] and I remembered wrong about chacha20.
But it does support curve25519 indeed; it was added along ECDSA:


2013.61test - Thursday 14 November 2013

- ECC (elliptic curve) support. Supports ECDSA hostkeys (requires new keys to
  be generated) and ECDH for setting up encryption keys (no intervention
  required). This is significantly faster.

- curve25519-sha...@libssh.org support for setting up encryption keys. This is
  another elliptic curve mode with less potential of NSA interference in
  algorithm parameters. curve25519-donna code thanks to Adam Langley


By the way, dropbearkey might not be required anymore, and removing it will
improve CSPRNG security... but that's OT here :)


- -R option to automatically generate hostkeys. This is recommended for
  embedded platforms since it allows the system random number device
  /dev/urandom a longer startup time to generate a secure seed before the
  hostkey is required.


Cheers,
Vittorio

[1]: https://matt.ucc.asn.au/dropbear/CHANGES
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Fwd: Removing Telnet

2015-09-08 Thread Vittorio G (VittGam)

Il 08.09.2015 18:31 Janusz Dziemidowicz ha scritto:

SSH time can be greatly reduced by using ECDSA host key. Dropbear can
be compiled with ECDSA support, however:
- it is disabled by default in OpenWRT
- startup script only generates RSA/DSA host keys, ECDSA host key must
be generated manually

Using 256 bit ECDSA host key reduces SSH login time for me from 0.7s
down to 0.13s. Tested on Netgear WNDR3800, ar71xx/generic, I am not
sure about other architectures.


Also, I think ed25519 keys and chacha20-poly1305 encryption might be worth
a try. They should be faster than ECDSA + AES on embedded processors, but
they need a relatively recent version of the SSH client (read: possible
problems on Windows and Macs).
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Fwd: Removing Telnet

2015-09-08 Thread Vittorio G (VittGam)

Il 08.09.2015 17:42 Brent Thomson ha scritto:

Slowness probably depends on hardware as well as all the possibilities
listed by others. I have a model of router that always takes 2-3
seconds to initiate an SSH connection, just to set up encryption
(brief, but computationally intensive; happens with every connection).
10 seconds seems really slow, though. Smells like DNS.


It might not be DNS in fact. On AR9331 (MIPS 24k CPU, not that fast...)
starting from Barrier Breaker SSH is pretty slow (3-4 seconds), so on
slower routers the login time can be longer.

If you login with ssh -v, you can see that it waits between


debug1: expecting SSH2_MSG_KEXDH_REPLY


and


debug1: Server host key: RSA [...]


If you check the CPU usage on the router while the client is waiting for
the reply, you can see that dropbear is at 100%.

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


Re: [OpenWrt-Devel] fcc hardware lockdown

2015-09-03 Thread Vittorio G (VittGam)

Il 03.09.2015 16:59 demos ha scritto:

That is a possible list for further coordination of resistance:
http://lists.prplfoundation.org/cgi-bin/mailman/listinfo/fcc


Here is a wiki page from LibrePlanet that is explaining the problem
and its conseguences in depth and tries to coordinate resistance
efforts:
https://libreplanet.org/wiki/Save_WiFi
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Huawei 3372 NCM support on CC not working

2015-07-01 Thread Vittorio G (VittGam)

Hello,

Are we talking about E3372h or E3372s?

I've got E3372h working by doing this:

echo 6000 > /sys/class/net/wwan0/cdc_ncm/tx_max
echo 0 > /sys/class/net/wwan0/cdc_ncm/min_tx_pkt

But it seems it didn't help an E3372s owner unfortunately. :/

My stick is a E3372h-153 with firmware 21.180.01.00.00. E3372s and h have
different hardware but same external look...

I'm forwarding here the mail I sent to modemmanager-devel some days ago.

-

Hello,

I faced the deaf wwan0 problem with a Huawei E3372h-153.

I'm not using ModemManager but OpenWrt CC-rc2, with Linux 3.18.14.

I've enabled the debug port of the android running in the stick. (Yes, it's
running android but without dalvik, don't ask me why since it isn't even
tethering in the standard android way... The embedded linux can't even see the
modem interface via ifconfig, it's just a relay between the vxworks that handles
the modem and the usb port. Mah.)

To enable the debug port, just search on the 'net and you will easily find the
commands. You can brick the modem permanently if you play too much with it; so
I'm not going to write the commands here, since I don't want any responsibility
if you happen to break your internet key this way. Be careful! ;)

Anyway, I've seen that the android dmesg log was full of errors, one line per 
packet
sent from the host to the modem:

[002173183ms] ERROR:gnet_copy_skb skb->len=526 should be greater than 
len=342 + offset=184
[002173935ms] ERROR:gnet_copy_skb skb->len=226 should be greater than 
len=42 + offset=184
[002176186ms] ERROR:gnet_copy_skb skb->len=526 should be greater than 
len=342 + offset=184
[002176207ms] ERROR:gnet_copy_skb skb->len=226 should be greater than 
len=42 + offset=184
[002177205ms] ERROR:gnet_copy_skb skb->len=226 should be greater than 
len=42 + offset=184
[002178205ms] ERROR:gnet_copy_skb skb->len=226 should be greater than 
len=42 + offset=184
[002179187ms] ERROR:gnet_copy_skb skb->len=526 should be greater than 
len=342 + offset=184

After testing many things, I've found the "magic" settings that do work:

echo 6000 > /sys/class/net/wwan0/cdc_ncm/tx_max
echo 0 > /sys/class/net/wwan0/cdc_ncm/min_tx_pkt

After issuing these commands, the interface works fine! (Or at least it seems
for now...)

Of course, I think that it's way far from perfect, but it's a starting point
for debugging at least.

I've seen that setting tx_max to 1698 (the minimum) only allows packets up to
1496 bytes to work (ping -s 1468).

If I increase the tx_max, the limit changes of course, and 1500-byte packets
get sent correctly.

But if the tx_max is too big, like with the default of 16384, a lot of delay
is introduced. It seems that a buffer needs to get full before the packets
are sent to the modem and then out to the internet... (I've checked with tcpdump
on the remote host that the modem will not send out packets before this 
hypotethical
buffer gets full, then they are sent all together.)

The number 6000 for tx_max seems to be a fair compromise between low delay (it's
like with 1698) and being able to send big packets in a burst (I've tested with
fragmented ping up to -s 3, and also wget of a big file works great).

If you need some more testing, definitely let me know!

(By the way, just a note since it helped me with OpenWrt and might help you too:
in case you don't get AT^NDISDUP to connect, it's because this stick seems not 
to
want the APN name specified there. Instead, just set it with 
AT+CGDCONT=1,"IP","apn"
and then send AT^NDISDUP=1,1 to connect. To disconnect, send AT^NDISDUP=1,0 .)


Best regards,
Vittorio G
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] ramips: Fix failsafe switch workaround for RT5350 introduced in r42179.

2015-03-10 Thread Vittorio G (VittGam)

Il 10.03.2015 20:42 John Crispin ha scritto:

we can hook this up with the board detect code. i'll put it on my todo
list. might take a bit till i find the time


That would be great!

By the way, we should test if recent revisions fix the checksum issue so that 
we can completely remove this hacky workaround. On my RT5350-based HT-TM02, 
disabling VLAN and using eth0 works as of r43771, while it didn't work on 
r42649. (That's why I proposed http://patchwork.ozlabs.org/patch/424017/ at 
first.) But I don't have hardware based on other affected SoCs (rt3x5x, mt7628) 
to test.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] ramips: Fix failsafe switch workaround for RT5350 introduced in r42179.

2015-03-10 Thread Vittorio G (VittGam)

Il 10.03.2015 14:18 John Crispin ha scritto:

hi

can you send a version that has the pattern shown below please

and "0 1 2 3 4 5 6" is wrong, exclude the wan port from the list please.

John




The problem is that it's not easy to determine what number the LAN or WAN port(s) is/are. 
On many routers a LAN port can be 0, but on the HT-TM02 there is only one port and it is 
4. So the current "0 6" is effectively soft-bricking the HT-TM02 if failsafe is 
needed and one doesn't have a serial adapter... That's why I proposed to just enable all 
ports for failsafe.


board=$(ramips_board_name)

board_config_update
ports="0 6""
case $board in
my_board_name)
ports="0 1 2 3 4 5 6"
;;
esac
swconfig dev rt305x set enable_vlan 1
swconfig dev rt305x vlan 1 set ports "$ports"
swconfig dev rt305x port 6 set untag 0
swconfig dev rt305x set apply 1
vconfig add eth0 1


This needs to be better addressed somehow, without replicating the port layout 
here for every router that does not have port 0 exposed at all.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] ramips: Fix failsafe switch workaround for RT5350 introduced in r42179.

2015-03-07 Thread Vittorio G (VittGam)
This patch fixes the failsafe switch workaround to avoid soft-bricking routers 
where the only exposed Ethernet port is not 0 (it is 4 for the HT-TM02 for 
instance).

This is a follow-up of http://patchwork.ozlabs.org/patch/424017/ (sorry for the 
delay).

Signed-off-by: Vittorio Gambaletta 

diff --git 
a/target/linux/ramips/base-files/lib/preinit/07_set_preinit_iface_ramips 
b/target/linux/ramips/base-files/lib/preinit/07_set_preinit_iface_ramips
index cae6396..efdc5fd 100644
--- a/target/linux/ramips/base-files/lib/preinit/07_set_preinit_iface_ramips
+++ b/target/linux/ramips/base-files/lib/preinit/07_set_preinit_iface_ramips
@@ -20,7 +20,7 @@ ramips_set_preinit_iface() {
# disabled:
# 
https://www.mail-archive.com/openwrt-devel@lists.openwrt.org/msg19870.html
swconfig dev rt305x set enable_vlan 1
-   swconfig dev rt305x vlan 1 set ports "0 6"
+   swconfig dev rt305x vlan 1 set ports "0 1 2 3 4 5 6"
swconfig dev rt305x port 6 set untag 0
swconfig dev rt305x set apply 1
vconfig add eth0 1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] ar71xx: Fix LED polarity for the TP-LINK TL-MR13U.

2015-03-07 Thread Vittorio G (VittGam)
Please also backport to Barrier Breaker (this same patch applies there too).

Signed-off-by: Vittorio Gambaletta 

diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-mr13u.c 
b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-mr13u.c
index 8b03645..84b6937 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-mr13u.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-mr13u.c
@@ -45,7 +45,7 @@ static struct gpio_led tl_mr13u_leds_gpio[] __initdata = {
{
.name   = "tp-link:blue:system",
.gpio   = TL_MR13U_GPIO_LED_SYSTEM,
-   .active_low = 1,
+   .active_low = 0,
},
 };
 
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] [BB] Backport: ar71xx: Fix board detection for the TP-LINK TL-MR13U.

2015-03-07 Thread Vittorio G (VittGam)
Signed-off-by: Vittorio Gambaletta 

--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -646,7 +646,7 @@
*"TL-MR11U")
name="tl-mr11u"
;;
-   *"TL-MR13U")
+   *"TL-MR13U v1")
name="tl-mr13u"
;;
*"Tube2H")
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] ar71xx: Fix board detection for the TP-LINK TL-MR13U.

2015-03-07 Thread Vittorio G (VittGam)
Signed-off-by: Vittorio Gambaletta 

diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh 
b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 52acc6b..fb047b4 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -738,7 +738,7 @@ ar71xx_board_detect() {
*"TL-MR12U")
name="tl-mr12u"
;;
-   *"TL-MR13U")
+   *"TL-MR13U v1")
name="tl-mr13u"
;;
*"Tube2H")
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] ramips: revert failsafe switch workaround for RT5350 introduced in r42179.

2015-01-17 Thread Vittorio G (VittGam)

Hi,

Il 17.01.2015 14:55 John Crispin ha scritto:

On 25/12/2014 02:29, Vittorio G (VittGam) wrote:

It is not needed anymore as TCP packets get passed correctly now
even when VLAN is disabled.



are you sure this is the case for all rt3x5x, rt5350 and mt7628 units ?


I've tested it on my RT5350-based router. With a previous OpenWrt revision 
(r42649 if I remember well) it wasn't working, since it was zeroing a TCP field 
as seen from the tcpdump verbose output. I don't remember the tcpdump details 
correctly, sorry. But now with recent revisions it's working fine.

If you're not sure about this for rt3x5x and mt7628, it should at least get modified to 
"0 1 2 3 4 5 6" to avoid soft-bricking routers where the only Ethernet port 
exposed is not 0 (4 for the HT-TM02 for instance).

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


Re: [OpenWrt-Devel] [PATCH] ramips: HooToo HT-TM02 factory image generation.

2015-01-09 Thread Vittorio G (VittGam)

Il 09.01.2015 16:17 Florian Fainelli ha scritto:


What about a statically linked binary at least?


Of course I've missed the obvious thing here. :) Thanks for the 
suggestion! I'm going to try this as soon as I've some spare time (in a 
week or so). Otherwise the code is on my github if you want to try to do 
it in the meantime (and you have the hardware...).


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


Re: [OpenWrt-Devel] [PATCH] ramips: HooToo HT-TM02 factory image generation.

2015-01-09 Thread Vittorio G (VittGam)

Il 09.01.2015 10:48 John Crispin ha scritto:

+mkhootoofw.sh "$(DL_DIR)/hootoo_mtd_writer" "$(call
sysupname,$(1),$(2))" "$(call imgname,$(1),$(2))-factory.bin"
+endef +BuildFirmware/HooToo8M/initramfs=$(call
BuildFirmware/OF/initramfs,$(1),$(2),$(3)) +



this bit is really bad. you cannot install a binary from a random
source and use that to flash the unit. the tool needs to be compiled
during the build process


Unfortunately the factory image uses an ancient version of uclibc, so 
binaries compiled with the newer version bundled with OpenWrt do not 
work on it... Anyway I've compiled that binary using the toolchain 
provided by HooToo, and the build is reproducible, so you or anybody 
else can easily verify that I'm not lying. :)


Please let me know if you have a better solution, because in fact this 
is not quite clean.


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


Re: [OpenWrt-Devel] Strange LED behavior on ramips

2015-01-09 Thread Vittorio G (VittGam)

Hi everybody,

Is nobody else experiencing this on their ramips/rt5350-based router?

Cheers,
Vittorio G

Il 25.12.2014 02:55 Vittorio G (VittGam) ha scritto:

Hi everybody,

I've got some HooToo HT-TM02 rt5350-based routers, and I've noticed a
quite weird thing with LEDs.

It seems that the LED handling gets halted for ~100ms every second.

I'm linking to a video to explain this behavior. Here I've set the
timer trigger for the blue LED to 50ms of delay_on/delay_off (like
when in failsafe):

https://server2.vittgam.net/openwrt-hootoo.mp4

The halting happens even with other delay times, even on the other
green LED, and it is also noticeable when using other triggers, like
netdev.

I think the issue is with the rt5350 LED and/or GPIO driver, so does
this happen to other ramips routers as well?

Cheers, and Happy Xmas
Vittorio G
___
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] [RESEND] [v2] base-files: Use 200ms LED timing as before for the new phase preinit_regular.

2015-01-09 Thread Vittorio G (VittGam)
This restores normal pre-r43715 200ms blink-period for the System LED we're all 
accustomed to see while our OpenWrt routers are booting.

Failsafe possibility will now be signalled with a new 100ms blinking, which is 
easily recognizable from the normal 200ms booting.

So no existing user will be scared by a new 500ms LED pattern, since such a 
slow pattern could easily be mistaken for something wrong... I was like "ok why 
my router is collapsing now, is this a bad flash, a kernel panic, or what else" 
when I've seen it for the first time ;)

Sorry for not having explained myself better in v1 of this patch.

Original:
Preinit, failsafe is possible: 200ms
Preinit, failsafe not possible anymore, booting normally: 200ms
Failsafe entered: 50ms

Now (after preinit_regular has been introduced):
Preinit, failsafe is possible: 200ms
Preinit, failsafe not possible anymore, booting normally: 500ms *here is the 
"offending" change*
Failsafe entered: 50ms

With my proposed patch:
Preinit, failsafe is possible: 100ms *indicate this condition with a new 
timing, that prompts the user to press the key if they want to start failsafe*
Preinit, failsafe not possible anymore, booting normally: 200ms *keep this as 
before*
Failsafe entered: 50ms

Signed-off-by: Vittorio Gambaletta 

diff --git a/package/base-files/files/lib/functions/leds.sh 
b/package/base-files/files/lib/functions/leds.sh
index 4ac8145..d4d4512 100644
--- a/package/base-files/files/lib/functions/leds.sh
+++ b/package/base-files/files/lib/functions/leds.sh
@@ -60,7 +60,7 @@ status_led_blink_fast() {
 }
 
 status_led_blink_preinit() {
-   led_timer $status_led 200 200
+   led_timer $status_led 100 100
 }
 
 status_led_blink_failsafe() {
@@ -68,5 +68,5 @@ status_led_blink_failsafe() {
 }
 
 status_led_blink_preinit_regular() {
-   led_timer $status_led 500 500
+   led_timer $status_led 200 200
 }
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] ramips: HooToo HT-TM02 factory image generation.

2015-01-09 Thread Vittorio G (VittGam)

Hi,

What is the reason has this been rejected? Do I need to change 
something?


Thanks,
Vittorio

Il 28.12.2014 13:34 Vittorio G (VittGam) ha scritto:

The mkhootoofw.sh is a shell script, because official factory images
are shell scripts by themselves, and it made more sense to me to just
use a shell script on the build host to put the pieces for the 
factory

image file together, rather than reimplement the wheel in C.

The hootoo_mtd_writer is a stripped-down and modified version of mtd
that includes support for flashing at an offset in the MTD. This is
needed for the HooToo, because the only usable partition for factory
flashing is the one labeled "ALL", and we don't want to flash the
u-boot, u-boot-env and factory partitions too...

The hootoo_mtd_writer binary has been compiled using the toolchain
contained in the GPL tarball provided by HooToo. (It seems to me from
some tests that this is the only way to get executables running on 
the

stock kernel...)

In order to update the firmware from the web interface you need to
put a FAT-formatted pendrive in the router USB port, since the
original firmware needs this as temporary storage, because the RAM is
quite bloated. Then you upload the OpenWrt factory image generated by
mkhootoofw.sh, and the script kills unneeded services and partitions
to free up RAM, backs up the original firmware on the pendrive,
extracts the hootoo_mtd_writer and the sysupgrade image, flashes the
sysupgrade image and then reboots.

I've tested the resulting image on the factory firmware, and it
successfully installed OpenWrt on my HT-TM02.

Signed-off-by: Vittorio Gambaletta 

--- a/target/linux/ramips/image/Makefile
+++ b/target/linux/ramips/image/Makefile
@@ -317,6 +317,15 @@
fi
 endef

+# Build HooToo factory images
+define BuildFirmware/HooToo8M/squashfs
+   $(call BuildFirmware/Default8M/$(1),$(1),$(2),$(3))
+   [ -e "$(call sysupname,$(1),$(2))" ] && \
+   $(SCRIPT_DIR)/download.pl "$(DL_DIR)" "hootoo_mtd_writer"
"3d72349cbb1d8e96086a084a6940304d"
"https://github.com/VittGam/hootoo_mtd_writer/releases/download/1.0/";
&& \
+   mkhootoofw.sh "$(DL_DIR)/hootoo_mtd_writer" "$(call
sysupname,$(1),$(2))" "$(call imgname,$(1),$(2))-factory.bin"
+endef
+BuildFirmware/HooToo8M/initramfs=$(call
BuildFirmware/OF/initramfs,$(1),$(2),$(3))
+
 #
 # RT288X Profiles
 #
@@ -480,7 +489,7 @@
 endef
 Image/Build/Profile/HLKRM04=$(call
BuildFirmware/HLKRM04/$(1),$(1),hlk-rm04,HLKRM04,HLK-RM02)

-Image/Build/Profile/HT-TM02=$(call
BuildFirmware/Default8M/$(1),$(1),ht-tm02,HT-TM02)
+Image/Build/Profile/HT-TM02=$(call
BuildFirmware/HooToo8M/$(1),$(1),ht-tm02,HT-TM02)

 Image/Build/Profile/M3=$(call BuildFirmware/Poray4M/$(1),$(1),m3,M3)

--- a/tools/firmware-utils/Makefile
+++ b/tools/firmware-utils/Makefile
@@ -76,6 +76,7 @@

 define Host/Install
$(INSTALL_BIN) $(HOST_BUILD_DIR)/bin/* $(STAGING_DIR_HOST)/bin/
+   $(INSTALL_BIN) src/mkhootoofw.sh $(STAGING_DIR_HOST)/bin/
 endef

 $(eval $(call HostBuild))
--- /dev/null
+++ b/tools/firmware-utils/src/mkhootoofw.sh
@@ -0,0 +1,88 @@
+#!/bin/sh
+#
+# HooToo Factory Firmware Generator for OpenWrt
+# Copyright (C) 2014 Vittorio Gambaletta 
+#
+# This is free software, licensed under the GNU General Public 
License v2.

+# See /LICENSE for more information.
+#
+# Sources for the hootoo_mtd_writer utility, which must be compiled
with the GPL
+# toolchain provided by HooToo for it to work on the factory kernel, 
can be

+# found at: https://github.com/VittGam/hootoo_mtd_writer
+#
+# Usage: mkhootoofw.sh path-to-hootoo_mtd_writer
path-to-openwrt-sysupgrade.bin path-to-openwrt-factory.bin
+#
+
+# Write the shellscript stub
+cat > "${3}.tmp" <<'EOF'
+SKIP=57
+
+echo "Checking firmware checksum..."
+[ "$CRCSUM" != "`sed '1,3d' "$0" | cksum | sed -e 's/ /Z/' -e 's/
/Z/' | cut -dZ -f1`" ] && {
+   echo "Firmware checksum error!"
+   exit 1
+}
+echo "Firmware checksum OK"
+
+echo "Killing unneeded services..."
+killall -9 fileserv ioos upnpd led_control owndns ownhttp vstddns
udhcpc udhcpd udevd minidlna smbd nmbd
+sleep 1
+
+echo "Unmounting unneeded mounts..."
+umount /etc
+umount /boot/tmp
+umount /usr/local/samba/var
+umount /opt
+umount /var
+
+echo "Backing up original firmware..."
+BKPDIRBASE="/data/UsbDisk1/Volume1/OpenWrt-HooToo-Backup-`sed
's/:/-/g' < /sys/class/net/ra0/address`-"
+BKPDIRNUM=1
+BKPDIR="${BKPDIRBASE}${BKPDIRNUM}"
+while [ -e "$BKPDIR" ]; do
+   BKPDIRNUM=$((${BKPDIRNUM}+1))
+   BKPDIR="${BKPDIRBASE}${BKPDIRNUM}"
+done
+echo "Backup directory: ${BKPDIR}"
+
+mkdir "$BKPDIR"
+cp /dev/mtdblock* "${BKPDIR}/" || {
+   echo "Backu

Re: [OpenWrt-Devel] [PATCH] base-files: Enhancements to /etc/profile.

2015-01-06 Thread Vittorio G (VittGam)

Il 06.01.2015 12:18 Felix Fietkau ha scritto:

On 2014-12-25 02:28, Vittorio G (VittGam) wrote:
- Update terminal window title with current directory and hostname 
like on Ubuntu.

- Add an optional colored prompt, in case user wants to enable it.
- Add ll, an useful alias to ls.

Signed-off-by: Vittorio Gambaletta 

This is a matter of personal preference, which should be put into the
wiki instead of the default /etc/profile.


Well, the terminal window title and ll alias are standard in many Linux 
distributions, like Ubuntu and its derivatives, so that's why I proposed 
them for inclusion in OpenWrt. The colored prompt is just a personal 
preference instead :)




- Felix


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


Re: [OpenWrt-Devel] [PATCH] base-files: Use the same LED timing as before for preinit_regular.

2014-12-29 Thread Vittorio G (VittGam)

Il 29.12.2014 09:04 Rafał Miłecki ha scritto:
1) I think that most OpenWrt users, like me, are accustomed to see a 
led
pattern of 200ms. I thought it was a bad flash or something else bad 
when

I've seen that 500ms blinking...


Is there any reason for that? Was 200ms ever used or documented by 
OpenWrt?


It has always been 200ms... The thing is that preinit_regular has been 
introduced some revisions ago.


Original:
Preinit, failsafe is possible: 200ms
Preinit, failsafe not possible anymore, booting normally: 200ms
Failsafe entered: 50ms

Now (after preinit_regular has been introduced):
Preinit, failsafe is possible: 200ms
Preinit, failsafe not possible anymore, booting normally: 500ms *here 
is the "offending" change*

Failsafe entered: 50ms

With my proposed patch:
Preinit, failsafe is possible: 100ms *indicate this condition with a 
new timing, that prompts the user to press the key if they want to start 
failsafe*
Preinit, failsafe not possible anymore, booting normally: 200ms *keep 
this as before*

Failsafe entered: 50ms

2) "As before" means that when failsafe is possible, it is indicated 
by a

new pattern of 100ms. When it is not possible anymore, the
"classic"/previous 200ms pattern is used.


"As before" and "new pattern" seem to be in conflict ;)


As before is referred to 200ms for the normal boot after the 2-second 
"failsafe-is-possible" condition.


Same question (as above) about the 200ms. What makes it "classic" or 
"previous"?


See above.



500ms looks OK for me, just calm booting, not sure about other people
opinion. But I don't like using 50ms / 100ms / 200ms for 3 different
states because I find them too close/similar. Also if preinit was
always using 200ms (am I wrong? can you prove different interval?) I
don't think we should change it to 100ms.


Calm booting is not good, 200ms makes it look like it's booting, 500ms 
seems that there is a problem... IMHO at least ;) (Also please try the 
led patterns on the hardware, the numbers alone might mislead. I thought 
the same of you too before testing...)

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


Re: [OpenWrt-Devel] [PATCH] base-files: Use the same LED timing as before for preinit_regular.

2014-12-28 Thread Vittorio G (VittGam)

On 26 December 2014 at 09:53, Rafał Miłecki  wrote:

On 26 December 2014 at 09:51, Rafał Miłecki  wrote:
On 25 December 2014 at 02:28, Vittorio G (VittGam) 
 wrote:

Signed-off-by: Vittorio Gambaletta 

diff --git a/package/base-files/files/lib/functions/leds.sh 
b/package/base-files/files/lib/functions/leds.sh

index 4ac8145..d4d4512 100644
--- a/package/base-files/files/lib/functions/leds.sh
+++ b/package/base-files/files/lib/functions/leds.sh
@@ -60,7 +60,7 @@ status_led_blink_fast() {
 }

 status_led_blink_preinit() {
-   led_timer $status_led 200 200
+   led_timer $status_led 100 100
 }

 status_led_blink_failsafe() {
@@ -68,5 +68,5 @@ status_led_blink_failsafe() {
 }

 status_led_blink_preinit_regular() {
-   led_timer $status_led 500 500
+   led_timer $status_led 200 200
 }


1) Why?
2) Explain "as before"
3) I don't think there is enough difference between 100ms and 200ms


4) You don't mention  status_led_blink_preinit(), but your patch also 
touches it


1) I think that most OpenWrt users, like me, are accustomed to see a 
led pattern of 200ms. I thought it was a bad flash or something else bad 
when I've seen that 500ms blinking...
2) "As before" means that when failsafe is possible, it is indicated by 
a new pattern of 100ms. When it is not possible anymore, the 
"classic"/previous 200ms pattern is used.
3) IMHO there is. It is visible enough for the user to know if it's 
possible to enter failsafe or not, while it is not disturbing for being 
too slow like the new 500ms.

4) Already explained in point 2, I think.

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


[OpenWrt-Devel] [PATCH] ramips: HooToo HT-TM02 factory image generation.

2014-12-28 Thread Vittorio G (VittGam)
The mkhootoofw.sh is a shell script, because official factory images are shell 
scripts by themselves, and it made more sense to me to just use a shell script 
on the build host to put the pieces for the factory image file together, rather 
than reimplement the wheel in C.

The hootoo_mtd_writer is a stripped-down and modified version of mtd that 
includes support for flashing at an offset in the MTD. This is needed for the 
HooToo, because the only usable partition for factory flashing is the one 
labeled "ALL", and we don't want to flash the u-boot, u-boot-env and factory 
partitions too...

The hootoo_mtd_writer binary has been compiled using the toolchain contained in 
the GPL tarball provided by HooToo. (It seems to me from some tests that this 
is the only way to get executables running on the stock kernel...)

In order to update the firmware from the web interface you need to put a 
FAT-formatted pendrive in the router USB port, since the original firmware 
needs this as temporary storage, because the RAM is quite bloated. Then you 
upload the OpenWrt factory image generated by mkhootoofw.sh, and the script 
kills unneeded services and partitions to free up RAM, backs up the original 
firmware on the pendrive, extracts the hootoo_mtd_writer and the sysupgrade 
image, flashes the sysupgrade image and then reboots.

I've tested the resulting image on the factory firmware, and it successfully 
installed OpenWrt on my HT-TM02.

Signed-off-by: Vittorio Gambaletta 

--- a/target/linux/ramips/image/Makefile
+++ b/target/linux/ramips/image/Makefile
@@ -317,6 +317,15 @@
fi
 endef
 
+# Build HooToo factory images
+define BuildFirmware/HooToo8M/squashfs
+   $(call BuildFirmware/Default8M/$(1),$(1),$(2),$(3))
+   [ -e "$(call sysupname,$(1),$(2))" ] && \
+   $(SCRIPT_DIR)/download.pl "$(DL_DIR)" "hootoo_mtd_writer" 
"3d72349cbb1d8e96086a084a6940304d" 
"https://github.com/VittGam/hootoo_mtd_writer/releases/download/1.0/"; && \
+   mkhootoofw.sh "$(DL_DIR)/hootoo_mtd_writer" "$(call 
sysupname,$(1),$(2))" "$(call imgname,$(1),$(2))-factory.bin"
+endef
+BuildFirmware/HooToo8M/initramfs=$(call 
BuildFirmware/OF/initramfs,$(1),$(2),$(3))
+
 #
 # RT288X Profiles
 #
@@ -480,7 +489,7 @@
 endef
 Image/Build/Profile/HLKRM04=$(call 
BuildFirmware/HLKRM04/$(1),$(1),hlk-rm04,HLKRM04,HLK-RM02)
 
-Image/Build/Profile/HT-TM02=$(call 
BuildFirmware/Default8M/$(1),$(1),ht-tm02,HT-TM02)
+Image/Build/Profile/HT-TM02=$(call 
BuildFirmware/HooToo8M/$(1),$(1),ht-tm02,HT-TM02)
 
 Image/Build/Profile/M3=$(call BuildFirmware/Poray4M/$(1),$(1),m3,M3)
 
--- a/tools/firmware-utils/Makefile
+++ b/tools/firmware-utils/Makefile
@@ -76,6 +76,7 @@
 
 define Host/Install
$(INSTALL_BIN) $(HOST_BUILD_DIR)/bin/* $(STAGING_DIR_HOST)/bin/
+   $(INSTALL_BIN) src/mkhootoofw.sh $(STAGING_DIR_HOST)/bin/
 endef
 
 $(eval $(call HostBuild))
--- /dev/null
+++ b/tools/firmware-utils/src/mkhootoofw.sh
@@ -0,0 +1,88 @@
+#!/bin/sh
+#
+# HooToo Factory Firmware Generator for OpenWrt
+# Copyright (C) 2014 Vittorio Gambaletta 
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+# Sources for the hootoo_mtd_writer utility, which must be compiled with the 
GPL
+# toolchain provided by HooToo for it to work on the factory kernel, can be
+# found at: https://github.com/VittGam/hootoo_mtd_writer
+#
+# Usage: mkhootoofw.sh path-to-hootoo_mtd_writer 
path-to-openwrt-sysupgrade.bin path-to-openwrt-factory.bin
+#
+
+# Write the shellscript stub
+cat > "${3}.tmp" <<'EOF'
+SKIP=57
+
+echo "Checking firmware checksum..."
+[ "$CRCSUM" != "`sed '1,3d' "$0" | cksum | sed -e 's/ /Z/' -e 's/   /Z/' | cut 
-dZ -f1`" ] && {
+   echo "Firmware checksum error!"
+   exit 1
+}
+echo "Firmware checksum OK"
+
+echo "Killing unneeded services..."
+killall -9 fileserv ioos upnpd led_control owndns ownhttp vstddns udhcpc 
udhcpd udevd minidlna smbd nmbd
+sleep 1
+
+echo "Unmounting unneeded mounts..."
+umount /etc
+umount /boot/tmp
+umount /usr/local/samba/var
+umount /opt
+umount /var
+
+echo "Backing up original firmware..."
+BKPDIRBASE="/data/UsbDisk1/Volume1/OpenWrt-HooToo-Backup-`sed 's/:/-/g' < 
/sys/class/net/ra0/address`-"
+BKPDIRNUM=1
+BKPDIR="${BKPDIRBASE}${BKPDIRNUM}"
+while [ -e "$BKPDIR" ]; do
+   BKPDIRNUM=$((${BKPDIRNUM}+1))
+   BKPDIR="${BKPDIRBASE}${BKPDIRNUM}"
+done
+echo "Backup directory: ${BKPDIR}"
+
+mkdir "$BKPDIR"
+cp /dev/mtdblock* "${BKPDIR}/" || {
+   echo "Backup failed!"
+   exit 1
+}
+sync && echo 3 > /proc/sys/vm/drop_caches
+echo "Backup OK"
+
+echo "Extracting OpenWrt firmware..."
+tail -n +$SKIP "$0" | tar xv -C /tmp/ || {
+   echo "Extraction of firmware failed!"
+   exit 1
+}
+chmod +x /tmp/hootoo_mtd_writer
+sync && echo 3 > /proc/sys/vm/drop_caches
+
+echo "Writing OpenWrt firmware..."
+cd /tmp/
+/tmp/hootoo_mtd_writer /tmp/openwrt.bin ALL 327680 1
+
+echo "Upgrade not successful (reboot by hootoo_mtd_writer not happene

Re: [OpenWrt-Devel] [PATCH] ramips: Fix HooToo HT-TM02 support.

2014-12-25 Thread Vittorio G (VittGam)

Il 25.12.2014 13:26 Paul Fertser ha scritto:


On Thu, Dec 25, 2014 at 12:46:20PM +0100, Vittorio G (VittGam) wrote:


And LAN port is 4, it can be seen from running: swconfig dev switch0
show.


Hm, ok, sure. Sorry for the noise.


No problem :)




Also this is not exactly an MPR-A1 clone as it does not have the
battery, it is small like the TP-LINK WR703N.


Mine is without a battery too, I guess they call it MPR-A15 or so. 
But

it came with 8M flash, 32M RAM.


The HT-TM02 also has 8MB flash and 32MB of RAM.

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


Re: [OpenWrt-Devel] [PATCH] ramips: Fix HooToo HT-TM02 support.

2014-12-25 Thread Vittorio G (VittGam)

Hi,

Il 25.12.2014 12:37 Paul Fertser ha scritto:


Hello,

Few comments from a person that doesn't own this device (but owns an
MPR-A1 clone).

"Vittorio G (VittGam)" writes:


- Remove unneeded VLAN now that the ethernet driver is fixed and TCP
packets get passed correctly now. (This router only has one port.)


I've checked the OpenWrt wiki, the device page is not present [1]. I
think VLAN config might be useful for documentation purposes in case
someone would need to enable tagging on Ethernet he'd need to learn
the
CPU and physical port numbers somehow. If you already have a suitable
config (probably disabled) in uci-defaults, that would be much
easier.



I'll add the wiki page as soon as I can... Thanks for notifying me ;)

Also the device has only one Ethernet port, so VLAN would only add
overhead.

And LAN port is 4, it can be seen from running: swconfig dev switch0
show.

Also this is not exactly an MPR-A1 clone as it does not have the
battery, it is small like the TP-LINK WR703N.


- Remove unnecessary packages from the profile. (The end-user is
supposed to use mechanisms such as the ImageBuilder in order to add
his
own set of packages to his own images... while the precompiled
images
should just contain the core set of packages needed to run the base
functions of a wireless router.)


So you remove wpad-mini but leave USB packages in place? :) IMHO
triggers are not needed but wpad-mini should stay. I agree it's
useful
to have kernel modules that handle specific USB controller,
everything
else is clearly optional (apart from packages like button-hotplug and
fstools that are part of the base install anyway, afair).


It is already included in the list for the ramips default profile here:

https://dev.openwrt.org/browser/trunk/target/linux/ramips/Makefile

Other ramips profiles inherit the packages list from here.



[1] http://wiki.openwrt.org/toh/hootoo/ht-tm02 [2]



Cheers,
Vittorio G


Links:
--
[1] mailto:open...@vittgam.net
[2] http://wiki.openwrt.org/toh/hootoo/ht-tm02
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] Strange LED behavior on ramips

2014-12-24 Thread Vittorio G (VittGam)
Hi everybody,

I've got some HooToo HT-TM02 rt5350-based routers, and I've noticed a quite 
weird thing with LEDs.

It seems that the LED handling gets halted for ~100ms every second.

I'm linking to a video to explain this behavior. Here I've set the timer 
trigger for the blue LED to 50ms of delay_on/delay_off (like when in failsafe):

https://server2.vittgam.net/openwrt-hootoo.mp4

The halting happens even with other delay times, even on the other green LED, 
and it is also noticeable when using other triggers, like netdev.

I think the issue is with the rt5350 LED and/or GPIO driver, so does this 
happen to other ramips routers as well?

Cheers, and Happy Xmas
Vittorio G
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] ramips: Fix HooToo HT-TM02 support.

2014-12-24 Thread Vittorio G (VittGam)
- Fix LED definitions.
- Add mode-switch slider definition (at GPIO 14).
- Remove unneeded VLAN now that the ethernet driver is fixed and TCP packets 
get passed correctly now. (This router only has one port.)
- Fix LAN port MAC address, which is defined in the factory partition as WLAN 
MAC address + 1.
- Fix board name, as the company name is HooToo and not HOOTOO.
- Remove unnecessary packages from the profile. (The end-user is supposed to 
use mechanisms such as the ImageBuilder in order to add his own set of packages 
to his own images... while the precompiled images should just contain the core 
set of packages needed to run the base functions of a wireless router.)

Signed-off-by: Vittorio Gambaletta 

diff --git a/target/linux/ramips/base-files/etc/board.d/01_leds 
b/target/linux/ramips/base-files/etc/board.d/01_leds
index 9c49c5c..405a6c0 100755
--- a/target/linux/ramips/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds
@@ -118,10 +118,10 @@ case $board in
hlk-rm04)
set_wifi_led "rt2800pci-phy0::radio"
;;
-ht-tm02)
-   ucidef_set_led_netdev "eth" "ETH" "ht-tm02:white:status" "eth0"
-   set_wifi_led "ht-tm02:blue:wifi"
-;;
+   ht-tm02)
+   ucidef_set_led_netdev "eth" "Ethernet" "ht-tm02:green:lan" 
"eth0"
+   set_wifi_led "ht-tm02:blue:wlan"
+   ;;
all0239-3g|\
hw550-3g)
set_usb_led "hw550-3g:green:usb"
diff --git a/target/linux/ramips/base-files/etc/board.d/02_network 
b/target/linux/ramips/base-files/etc/board.d/02_network
index 80b5449..a86466e 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -50,6 +50,7 @@ ramips_setup_interfaces()
all5003 | \
broadway | \
dcs-930| \
+   ht-tm02| \
ncs601w | \
wnce2001)
ucidef_add_switch "switch0" "1" "0"
@@ -103,12 +104,6 @@ ramips_setup_interfaces()
ucidef_add_switch_vlan "switch0" "2" "4 9t"
;;
 
-   ht-tm02)
-   ucidef_set_interface_lan "eth0.1"
-   ucidef_add_switch "switch0" "1" "1"
-   ucidef_add_switch_vlan "switch0" "1" "4 6t"
-   ;;
-
3g-6200n | \
ai-br100 | \
dir-610-a1 | \
@@ -291,7 +286,6 @@ ramips_setup_macs()
hlk-rm04 | \
mpr-a1 | \
mpr-a2 | \
-ht-tm02 | \
dir-300-b7 | \
dir-320-b1 | \
psr-680w |\
@@ -303,6 +297,10 @@ ramips_setup_macs()
wan_mac=$(macaddr_add "$lan_mac" 1)
;;
 
+   ht-tm02)
+   lan_mac=$(cat /sys/class/net/eth0/address)
+   ;;
+
cy-swr1100 | \
dir-645)
lan_mac=$(mtd_get_mac_ascii nvram lanmac)
diff --git a/target/linux/ramips/base-files/etc/diag.sh 
b/target/linux/ramips/base-files/etc/diag.sh
index 1af64b2..103dfcd 100755
--- a/target/linux/ramips/base-files/etc/diag.sh
+++ b/target/linux/ramips/base-files/etc/diag.sh
@@ -73,7 +73,7 @@ get_status_led() {
status_led="hlk-rm04:red:power"
;;
ht-tm02)
-   status_led="ht-tm02:white:status"
+   status_led="ht-tm02:blue:wlan"
;;
all0239-3g|\
hw550-3g)
diff --git a/target/linux/ramips/base-files/lib/ramips.sh 
b/target/linux/ramips/base-files/lib/ramips.sh
index b4e5d91..257f605 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -172,7 +172,7 @@ ramips_board_detect() {
*"HILINK HLK-RM04")
name="hlk-rm04"
;;
-   *"HOOTOO HT-TM02")
+   *"HooToo HT-TM02")
name="ht-tm02"
;;
*"HAME MPR-A1")
diff --git a/target/linux/ramips/dts/HT-TM02.dts 
b/target/linux/ramips/dts/HT-TM02.dts
index 1f456f0..40d9e01 100644
--- a/target/linux/ramips/dts/HT-TM02.dts
+++ b/target/linux/ramips/dts/HT-TM02.dts
@@ -4,14 +4,12 @@
 
 / {
compatible = "HT-TM02", "ralink,rt5350-soc";
-   model = "HOOTOO HT-TM02";
+   model = "HooToo HT-TM02";
 
palmbus@1000 {
-
-   gpio0: gpio@600 {
+   gpio0: gpio@600 {
status = "okay";
-   };
-   
+   };
spi@b00 {
status = "okay";
m25p80@0 {
@@ -21,25 +19,21 @@
reg = <0 0>;
linux,modalias = "m25p80", "mx25l6405d";
spi-max-frequency = <1000>;
-
partition@0 {
label = "u-boot";
reg = <0x0 0x3>;
read-only;
}

[OpenWrt-Devel] [PATCH] ramips: base-files: Whitespace fixes.

2014-12-24 Thread Vittorio G (VittGam)
Signed-off-by: Vittorio Gambaletta 

diff --git a/target/linux/ramips/base-files/etc/board.d/01_leds 
b/target/linux/ramips/base-files/etc/board.d/01_leds
index 9c49c5c..405a6c0 100755
--- a/target/linux/ramips/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds
@@ -182,9 +182,9 @@ case $board in
set_usb_led "wcr150gn:amber:user"
;;
hg255d)
-   set_wifi_led "hg255d:wlan"
-   set_usb_led "hg255d:usb"
-   ucidef_set_led_interface "lan" "hg255d:internet"
+   set_wifi_led "hg255d:wlan"
+   set_usb_led "hg255d:usb"
+   ucidef_set_led_interface "lan" "hg255d:internet"
;;
wnce2001)
set_wifi_led "netgear:green:wlan"
diff --git a/target/linux/ramips/base-files/etc/board.d/02_network 
b/target/linux/ramips/base-files/etc/board.d/02_network
index 80b5449..a86466e 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -58,8 +58,8 @@ ramips_setup_interfaces()
 
3g-6200nl | \
mlw221)
-ucidef_set_interface_lan "eth0.2"
-;;
+   ucidef_set_interface_lan "eth0.2"
+   ;;
 
wizard8800 | \
wl-330n | \
@@ -314,7 +314,7 @@ ramips_setup_macs()
;;
 
wcr-150gn)
-wan_mac=$(mtd_get_mac_binary factory 40)
+   wan_mac=$(mtd_get_mac_binary factory 40)
;;
 
rt-n56u)
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] ramips: revert failsafe switch workaround for RT5350 introduced in r42179.

2014-12-24 Thread Vittorio G (VittGam)
It is not needed anymore as TCP packets get passed correctly now even when VLAN 
is disabled.

This piece of code also broke routers where the LAN port is not wired to port 0 
of the internal switch.

Signed-off-by: Vittorio Gambaletta 

diff --git 
a/target/linux/ramips/base-files/lib/preinit/07_set_preinit_iface_ramips 
b/target/linux/ramips/base-files/lib/preinit/07_set_preinit_iface_ramips
index cae6396..386b527 100644
--- a/target/linux/ramips/base-files/lib/preinit/07_set_preinit_iface_ramips
+++ b/target/linux/ramips/base-files/lib/preinit/07_set_preinit_iface_ramips
@@ -11,24 +11,7 @@ ramips_set_preinit_iface() {
swconfig dev rt305x set reset 1
fi
 
-   if echo $RT3X5X | egrep -q "(RT5350|MT7628)"; then
-   # This is a dirty hack to get by while the switch
-   # problem is investigated. When VLAN is disabled, ICMP
-   # pings work as expected, but TCP connections time
-   # out, so telnetting in failsafe is impossible. The
-   # likely reason is TCP checksumming hardware getting
-   # disabled:
-   # 
https://www.mail-archive.com/openwrt-devel@lists.openwrt.org/msg19870.html
-   swconfig dev rt305x set enable_vlan 1
-   swconfig dev rt305x vlan 1 set ports "0 6"
-   swconfig dev rt305x port 6 set untag 0
-   swconfig dev rt305x set apply 1
-   vconfig add eth0 1
-   ifconfig eth0 up
-   ifname=eth0.1
-   else
-   ifname=eth0
-   fi
+   ifname=eth0
 }
 
 boot_hook_add preinit_main ramips_set_preinit_iface
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] base-files: Fix switch settings for uci-defaults-new.sh.

2014-12-24 Thread Vittorio G (VittGam)
The enable and reset settings need to be added even when they're false. This is 
true at least for 'enable', that seems to default to true otherwise.

Signed-off-by: Vittorio Gambaletta 

diff --git a/package/base-files/files/lib/functions/uci-defaults-new.sh 
b/package/base-files/files/lib/functions/uci-defaults-new.sh
index 0751744..7222ff8 100755
--- a/package/base-files/files/lib/functions/uci-defaults-new.sh
+++ b/package/base-files/files/lib/functions/uci-defaults-new.sh
@@ -70,8 +70,8 @@ ucidef_add_switch() {
json_select_object switch
 
json_select_object $name
-   [ "$enable" -eq 1 ] && json_add_boolean enable 1
-   [ "$reset" -eq 1 ] && json_add_boolean reset 1
+   json_add_boolean enable $enable
+   json_add_boolean reset $reset
json_select ..
 
json_select ..
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] base-files: Use the same LED timing as before for preinit_regular.

2014-12-24 Thread Vittorio G (VittGam)
Signed-off-by: Vittorio Gambaletta 

diff --git a/package/base-files/files/lib/functions/leds.sh 
b/package/base-files/files/lib/functions/leds.sh
index 4ac8145..d4d4512 100644
--- a/package/base-files/files/lib/functions/leds.sh
+++ b/package/base-files/files/lib/functions/leds.sh
@@ -60,7 +60,7 @@ status_led_blink_fast() {
 }
 
 status_led_blink_preinit() {
-   led_timer $status_led 200 200
+   led_timer $status_led 100 100
 }
 
 status_led_blink_failsafe() {
@@ -68,5 +68,5 @@ status_led_blink_failsafe() {
 }
 
 status_led_blink_preinit_regular() {
-   led_timer $status_led 500 500
+   led_timer $status_led 200 200
 }
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] base-files: Enhancements to /etc/profile.

2014-12-24 Thread Vittorio G (VittGam)
- Update terminal window title with current directory and hostname like on 
Ubuntu.
- Add an optional colored prompt, in case user wants to enable it.
- Add ll, an useful alias to ls.

Signed-off-by: Vittorio Gambaletta 

diff --git a/package/base-files/files/etc/profile 
b/package/base-files/files/etc/profile
index 3dd58e1..cee7faf 100644
--- a/package/base-files/files/etc/profile
+++ b/package/base-files/files/etc/profile
@@ -5,7 +5,10 @@
 export PATH=/usr/bin:/usr/sbin:/bin:/sbin
 export HOME=$(grep -e "^${USER:-root}:" /etc/passwd | cut -d ":" -f 6)
 export HOME=${HOME:-/root}
-export PS1='\u@\h:\w\$ '
+export PS1='\[\e]0;\u@\h: \w\a\]\u@\h \w \$ '
+
+# If you want a colored prompt, uncomment the following line:
+#export PS1='\[\e]0;\u@\h: 
\w\a\]\[\033[01;33m\]\u\[\033[01;34m\]@\[\033[01;32m\]\h \[\033[01;31m\]\w 
\[\033[01;35m\]\$ \[\033[00m\]'
 
 [ -x /bin/more ] || alias more=less
 [ -x /usr/bin/vim ] && alias vi=vim || alias vim=vi
@@ -14,3 +17,5 @@ export PS1='\u@\h:\w\$ '
 
 [ -x /usr/bin/arp ] || arp() { cat /proc/net/arp; }
 [ -x /usr/bin/ldd ] || ldd() { LD_TRACE_LOADED_OBJECTS=1 $*; }
+
+alias ll='ls -alF --color=auto'
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] 4addr mode hangs on rekey on a WPA2+CCMP 802.1x network with ar71xx hardware

2014-11-16 Thread Vittorio G (VittGam)

Hi everyone,

I'm having the problem described in this bug I filed: 
https://dev.openwrt.org/ticket/18343


In the bug you can see I've tested various options and I've come to the 
conclusion that the problem is with 4addr mode being enabled (option wds 
'1'). The problem is made worse if I enable 802.11w Management Frame 
Protection along with 4addr mode. There is no problem at all with 4addr 
mode disabled.


Is this a known problem? Could somebody help me debug this further?

Thank you very much.

Best regards,
Vittorio G
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH v2 1/3] mac80211, hostapd: Fix hostapd_set_bss_options function call in mac80211.sh and its definition in netifd.sh

2014-11-14 Thread Vittorio G (VittGam)
  Hi Felix,

Yes, they will not be used again with the to-be-modified
http://patchwork.openwrt.org/patch/6468/ [2] patch.

I will send the new
patch along with the other one.

Cheers,
Vittorio

Il 18.10.2014 21:35
Felix Fietkau ha scritto: 

> On 2014-10-14 20:04, Vittorio G (VittGam)
wrote:
> 
>> - Fix the call to hostapd_set_bss_options in mac80211.sh,
since $vif is not defined in the calling context, and $phy was not being
passed to the function. - Swap $vif and $phy in hostapd_set_bss_options,
to be coherent with the old function with the same name defined in the
hostapd-common-old script. Signed-off-by: Vittorio Gambaletta
> 
> They
seem to be unused, so how about removing them instead?
> 
> - Felix



Links:
--
[1] mailto:open...@vittgam.net
[2]
http://patchwork.openwrt.org/patch/6468/
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH v2 3/3] hostapd: Add uapsd option to netifd.sh

2014-11-14 Thread Vittorio G (VittGam)
  Hi Felix,

Sorry for the late reply.

I've seen the check is already
implemented here in hostapd since 2011:
http://w1.fi/cgit/hostap/commit/?id=70619a5d8a3d32faa43d66bcb1b670cacf0c243e

So
maybe we should just set uapsd as default enabled, and let hostapd
check the actual support.

Do you think this would be
fine?

Cheers,
Vittorio

Il 18.10.2014 21:37 Felix Fietkau ha scritto:


> On 2014-10-14 20:05, Vittorio G (VittGam) wrote:
> 
>> The uapsd
option sets the uapsd_advertisement_enabled flag in hostapd, only if the
phy actually supports the option. Signed-off-by: Vittorio Gambaletta ---
package/network/services/hostapd/files/netifd.sh | 9 +++-- 1 file
changed, 7 insertions(+), 2 deletions(-) diff --git
a/package/network/services/hostapd/files/netifd.sh
b/package/network/services/hostapd/files/netifd.sh index
ccea5ff..48bcc9d 100644 ---
a/package/network/services/hostapd/files/netifd.sh +++
b/package/network/services/hostapd/files/netifd.sh
> 
>> @@ -189,6
+190,10 @@ hostapd_set_bss_options() { append bss_conf
"wmm_enabled=$wmm" "$N" append bss_conf "ignore_broadcast_ssid=$hidden"
"$N" + [ -n "$phy" ] && iw phy "$phy" info 2>/dev/null | grep -q 'Device
supports AP-side u-APSD.' && { + append bss_conf
"uapsd_advertisement_enabled=$uapsd" "$N" + }
> 
> hostapd's netifd.sh
should not hardcode cfg80211/mac80211 specific
> calls, it may be called
from other drivers in the future.
> 
> - Felix
 

Links:
--
[1]
mailto:open...@vittgam.net
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v2 2/3] hostapd: Add wpa_psk_file option to netifd.sh

2014-10-14 Thread Vittorio G (VittGam)
The wpa_psk_file option offers the possibility to use a different WPA-PSK key 
for each client. The directive points to a file with the following syntax:

mac_address wpa_passphrase_or_hex_key

Example:

00:11:22:33:44:55 passphrase_for_client_1
00:11:22:33:44:67 passphrase_for_client_2
00:11:22:33:44:89 
0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef

So it is possible to specify both ASCII passphrases and raw 64-chars hex keys.

Signed-off-by: Vittorio Gambaletta 

---
 package/network/services/hostapd/files/netifd.sh |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/package/network/services/hostapd/files/netifd.sh 
b/package/network/services/hostapd/files/netifd.sh
index 12c375b..ccea5ff 100644
--- a/package/network/services/hostapd/files/netifd.sh
+++ b/package/network/services/hostapd/files/netifd.sh
@@ -134,6 +134,8 @@ hostapd_common_add_bss_config() {
 
config_add_string 'key1:wepkey' 'key2:wepkey' 'key3:wepkey' 
'key4:wepkey' 'password:wpakey'
 
+   config_add_string wpa_psk_file
+
config_add_boolean wps_pushbutton wps_label ext_registrar wps_pbc_in_m1
config_add_string wps_device_type wps_device_name wps_manufacturer 
wps_pin
 
@@ -201,7 +203,7 @@ hostapd_set_bss_options() {
wps_not_configured=1
;;
psk)
-   json_get_vars key
+   json_get_vars key wpa_psk_file
if [ ${#key} -lt 8 ]; then
wireless_setup_vif_failed INVALID_WPA_PSK
return 1
@@ -210,6 +212,10 @@ hostapd_set_bss_options() {
else
append bss_conf "wpa_passphrase=$key" "$N"
fi
+   [ -n "$wpa_psk_file" ] && {
+   [ -e "$wpa_psk_file" ] || touch "$wpa_psk_file"
+   append bss_conf "wpa_psk_file=$wpa_psk_file" 
"$N"
+   }
wps_possible=1
;;
eap)
-- 
1.7.9.5
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v2 3/3] hostapd: Add uapsd option to netifd.sh

2014-10-14 Thread Vittorio G (VittGam)
The uapsd option sets the uapsd_advertisement_enabled flag in hostapd, only if 
the phy actually supports the option.

Signed-off-by: Vittorio Gambaletta 

---
 package/network/services/hostapd/files/netifd.sh |9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/package/network/services/hostapd/files/netifd.sh 
b/package/network/services/hostapd/files/netifd.sh
index ccea5ff..48bcc9d 100644
--- a/package/network/services/hostapd/files/netifd.sh
+++ b/package/network/services/hostapd/files/netifd.sh
@@ -100,7 +100,7 @@ EOF
 
 hostapd_common_add_bss_config() {
config_add_string 'bssid:macaddr' 'ssid:string'
-   config_add_boolean wds wmm hidden
+   config_add_boolean wds wmm uapsd hidden
 
config_add_int maxassoc max_inactivity
config_add_boolean disassoc_low_ack isolate short_preamble
@@ -163,7 +163,7 @@ hostapd_set_bss_options() {
maxassoc max_inactivity disassoc_low_ack isolate auth_cache \
wps_pushbutton wps_label ext_registrar wps_pbc_in_m1 \
wps_device_type wps_device_name wps_manufacturer wps_pin \
-   macfilter ssid wmm hidden short_preamble rsn_preauth
+   macfilter ssid wmm uapsd hidden short_preamble rsn_preauth
 
set_default isolate 0
set_default maxassoc 0
@@ -172,6 +172,7 @@ hostapd_set_bss_options() {
set_default disassoc_low_ack 1
set_default hidden 0
set_default wmm 1
+   set_default uapsd 1
 
append bss_conf "ctrl_interface=/var/run/hostapd"
if [ "$isolate" -gt 0 ]; then
@@ -189,6 +190,10 @@ hostapd_set_bss_options() {
append bss_conf "wmm_enabled=$wmm" "$N"
append bss_conf "ignore_broadcast_ssid=$hidden" "$N"
 
+   [ -n "$phy" ] && iw phy "$phy" info 2>/dev/null | grep -q 'Device 
supports AP-side u-APSD.' && {
+   append bss_conf "uapsd_advertisement_enabled=$uapsd" "$N"
+   }
+
[ "$wpa" -gt 0 ] && {
[ -n "$wpa_group_rekey"  ] && append bss_conf 
"wpa_group_rekey=$wpa_group_rekey" "$N"
[ -n "$wpa_pair_rekey"   ] && append bss_conf 
"wpa_ptk_rekey=$wpa_pair_rekey""$N"
-- 
1.7.9.5
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v2 1/3] mac80211, hostapd: Fix hostapd_set_bss_options function call in mac80211.sh and its definition in netifd.sh

2014-10-14 Thread Vittorio G (VittGam)
- Fix the call to hostapd_set_bss_options in mac80211.sh, since $vif is not 
defined in the calling context, and $phy was not being passed to the function.
- Swap $vif and $phy in hostapd_set_bss_options, to be coherent with the old 
function with the same name defined in the hostapd-common-old script.

Signed-off-by: Vittorio Gambaletta 

---
 .../mac80211/files/lib/netifd/wireless/mac80211.sh |2 +-
 package/network/services/hostapd/files/netifd.sh   |4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh 
b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
index e6241de..748d0f1 100644
--- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
+++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
@@ -310,7 +310,7 @@ mac80211_hostapd_setup_bss() {
hostapd_cfg=
append hostapd_cfg "$type=$ifname" "$N"
 
-   hostapd_set_bss_options hostapd_cfg "$vif" || return 1
+   hostapd_set_bss_options hostapd_cfg "$ifname" "$phy" || return 1
json_get_vars wds dtim_period max_listen_int
 
set_default wds 0
diff --git a/package/network/services/hostapd/files/netifd.sh 
b/package/network/services/hostapd/files/netifd.sh
index 30d12e9..12c375b 100644
--- a/package/network/services/hostapd/files/netifd.sh
+++ b/package/network/services/hostapd/files/netifd.sh
@@ -148,8 +148,8 @@ hostapd_common_add_bss_config() {
 
 hostapd_set_bss_options() {
local var="$1"
-   local phy="$2"
-   local vif="$3"
+   local vif="$2"
+   local phy="$3"
 
wireless_vif_parse_encryption
 
-- 
1.7.9.5
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] Add u-APSD and WPA-PSK-file options to hostapd

2014-10-14 Thread Vittorio G (VittGam)
I'm sorry, I've sent the wrong diff. Actually the code is right, but 
the diff is based on the root filesystem and not on the source repo.


I'm going to send an updated patch (actually, two patches, so it is 
cleaner :) ).


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


[OpenWrt-Devel] [PATCH] Add u-APSD and WPA-PSK-file options to hostapd

2014-10-13 Thread Vittorio G (VittGam)
This patch adds uapsd and wpa_psk_file options to hostapd.

It also fixes the hostapd_set_bss_options call in mac80211.sh.

The uapsd option sets the uapsd_advertisement_enabled flag in hostapd, only if 
the adapter actually supports the option.

The wpa_psk_file offers the possibility to use a different WPA-PSK key for each 
client. The directive points to a file with the following syntax:

> 00:11:22:33:44:55 passphrase_for_client_1
> 00:11:22:33:44:67 passphrase_for_client_2
> 00:11:22:33:44:89 
> 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef

So it is possible to specify both ASCII passphrases and raw 64-chars hex keys.

Signed-off-by: Vittorio Gambaletta 

diff -aur /rom/lib/netifd/hostapd.sh /overlay/lib/netifd/hostapd.sh
--- /rom/lib/netifd/hostapd.sh  2014-10-12 12:59:38.0 +0200
+++ /overlay/lib/netifd/hostapd.sh  2014-10-14 00:03:52.0 +0200
@@ -100,7 +100,7 @@
 
 hostapd_common_add_bss_config() {
config_add_string 'bssid:macaddr' 'ssid:string'
-   config_add_boolean wds wmm hidden
+   config_add_boolean wds wmm uapsd hidden
 
config_add_int maxassoc max_inactivity
config_add_boolean disassoc_low_ack isolate short_preamble
@@ -134,6 +134,8 @@
 
config_add_string 'key1:wepkey' 'key2:wepkey' 'key3:wepkey' 
'key4:wepkey' 'password:wpakey'
 
+   config_add_string wpa_psk_file
+
config_add_boolean wps_pushbutton wps_label ext_registrar wps_pbc_in_m1
config_add_string wps_device_type wps_device_name wps_manufacturer 
wps_pin
 
@@ -161,7 +163,7 @@
maxassoc max_inactivity disassoc_low_ack isolate auth_cache \
wps_pushbutton wps_label ext_registrar wps_pbc_in_m1 \
wps_device_type wps_device_name wps_manufacturer wps_pin \
-   macfilter ssid wmm hidden short_preamble rsn_preauth
+   macfilter ssid wmm uapsd hidden short_preamble rsn_preauth
 
set_default isolate 0
set_default maxassoc 0
@@ -170,6 +172,7 @@
set_default disassoc_low_ack 1
set_default hidden 0
set_default wmm 1
+   set_default uapsd 1
 
append bss_conf "ctrl_interface=/var/run/hostapd"
if [ "$isolate" -gt 0 ]; then
@@ -187,6 +190,10 @@
append bss_conf "wmm_enabled=$wmm" "$N"
append bss_conf "ignore_broadcast_ssid=$hidden" "$N"
 
+   [ -n "$phy" ] && iw phy "$phy" info 2>/dev/null | grep -q 'Device 
supports AP-side u-APSD.' && {
+   append bss_conf "uapsd_advertisement_enabled=$uapsd" "$N"
+   }
+
[ "$wpa" -gt 0 ] && {
[ -n "$wpa_group_rekey"  ] && append bss_conf 
"wpa_group_rekey=$wpa_group_rekey" "$N"
[ -n "$wpa_pair_rekey"   ] && append bss_conf 
"wpa_ptk_rekey=$wpa_pair_rekey""$N"
@@ -201,7 +208,7 @@
wps_not_configured=1
;;
psk)
-   json_get_vars key
+   json_get_vars key wpa_psk_file
if [ ${#key} -lt 8 ]; then
wireless_setup_vif_failed INVALID_WPA_PSK
return 1
@@ -210,6 +217,10 @@
else
append bss_conf "wpa_passphrase=$key" "$N"
fi
+   [ -n "$wpa_psk_file" ] && {
+   [ -e "$wpa_psk_file" ] || touch "$wpa_psk_file"
+   append bss_conf "wpa_psk_file=$wpa_psk_file" 
"$N"
+   }
wps_possible=1
;;
eap)
diff -aur /rom/lib/netifd/wireless/mac80211.sh 
/overlay/lib/netifd/wireless/mac80211.sh
--- /rom/lib/netifd/wireless/mac80211.sh2014-10-12 23:44:53.0 
+0200
+++ /overlay/lib/netifd/wireless/mac80211.sh2014-10-13 23:59:39.0 
+0200
@@ -310,7 +310,7 @@
hostapd_cfg=
append hostapd_cfg "$type=$ifname" "$N"
 
-   hostapd_set_bss_options hostapd_cfg "$vif" || return 1
+   hostapd_set_bss_options hostapd_cfg "$phy" "$ifname" || return 1
json_get_vars wds dtim_period max_listen_int
 
set_default wds 0
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] Fix LED definitions for the DRAGINO2 board

2014-10-13 Thread Vittorio G (VittGam)
This patch fixes LED definitions for the DRAGINO2 board.

1. It renames the Router/USB led to System, as it is now marked "SYS" on the 
board.
2. It gives control of the LAN and WAN leds and some other GPIOs to Linux.
3. It fixes the active_low property for the LAN and WAN leds.
4. It sets up WLAN, LAN and WAN leds in the UCI defaults.
5. It allows usage of the System led by the diag.sh script, so it will be used 
to indicate boot and failsafe status.

Signed-off-by: Vittorio Gambaletta 

diff --git a/target/linux/ar71xx/base-files/etc/diag.sh 
b/target/linux/ar71xx/base-files/etc/diag.sh
index 1864b11..fa07f39 100755
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -62,6 +62,9 @@ get_status_led() {
dir-835-a1)
status_led="d-link:amber:power"
;;
+   dragino2)
+   status_led="dragino2:red:system"
+   ;;
eap300v2)
status_led="engenius:blue:power"
;;
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 d3b766d..5b9dbe7 100755
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
@@ -65,6 +65,12 @@ db120)
ucidef_set_led_usbdev "usb" "USB" "db120:green:usb" "1-1"
;;
 
+dragino2)
+   ucidef_set_led_wlan "wlan" "WLAN" "dragino2:red:wlan" "phy0tpt"
+   ucidef_set_led_netdev "lan" "LAN" "dragino2:red:lan" "eth0"
+   ucidef_set_led_netdev "wan" "WAN" "dragino2:red:wan" "eth1"
+   ;;
+
 eap300v2)
ucidef_set_led_netdev "lan" "LAN" "engenius:blue:lan" "eth0"
ucidef_set_led_wlan "wlan" "WLAN" "engenius:blue:wlan" "phy0tpt"
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-dragino2.c 
b/target/linux/ar71xx/files/arch/mips/ath79/mach-dragino2.c
index 156fbe5..95bd6f4 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-dragino2.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-dragino2.c
@@ -3,6 +3,7 @@
  *
  *  Copyright (C) 2011-2012 Gabor Juhos 
  *  Copyright (C) 2012 Elektra Wagenrad 
+ *  Copyright (C) 2014 Vittorio Gambaletta 
  *
  *  This program is free software; you can redistribute it and/or modify it
  *  under the terms of the GNU General Public License version 2 as published
@@ -27,12 +28,12 @@
 #define DRAGINO2_GPIO_LED_WAN  17
 
 /*
- * The following GPIO is actually named "Router" on the board.
- * However, since the "Router" feature is not supported as of yet
- * we use it to display USB activity.
+ * The following GPIO is named "SYS" on newer revisions of the the board.
+ * It was previously used to indicate USB activity, even though it was
+ * named "Router".
  */
 
-#define DRAGINO2_GPIO_LED_USB  28
+#define DRAGINO2_GPIO_LED_SYS  28
 #define DRAGINO2_GPIO_BTN_JUMPSTART11
 #define DRAGINO2_GPIO_BTN_RESET12
 
@@ -46,23 +47,23 @@
 
 static struct gpio_led dragino2_leds_gpio[] __initdata = {
{
-   .name   = "dragino2:red:lan",
-   .gpio   = DRAGINO2_GPIO_LED_LAN,
-   .active_low = 0,
-   },
-   {
.name   = "dragino2:red:wlan",
.gpio   = DRAGINO2_GPIO_LED_WLAN,
.active_low = 0,
},
-   {
+   {
.name   = "dragino2:red:wan",
.gpio   = DRAGINO2_GPIO_LED_WAN,
-   .active_low = 0,
+   .active_low = 1,
},
{
-   .name   = "dragino2:red:usb",
-   .gpio   = DRAGINO2_GPIO_LED_USB,
+   .name   = "dragino2:red:lan",
+   .gpio   = DRAGINO2_GPIO_LED_LAN,
+   .active_low = 1,
+   },
+   {
+   .name   = "dragino2:red:system",
+   .gpio   = DRAGINO2_GPIO_LED_SYS,
.active_low = 0,
},
 };
@@ -99,15 +100,23 @@ static void __init dragino2_common_setup(void)
 
ath79_register_mdio(0, 0x0);
 
-   /* Enable GPIO15 and GPIO16 and possibly GPIO26 and GPIO27 */
-   ath79_gpio_function_disable(AR933X_GPIO_FUNC_ETH_SWITCH_LED2_EN |
-   AR933X_GPIO_FUNC_ETH_SWITCH_LED3_EN);
+   /* Enable GPIO13, GPIO14, GPIO15, GPIO16 and GPIO17 */
+   ath79_gpio_function_disable(AR933X_GPIO_FUNC_ETH_SWITCH_LED0_EN |
+   AR933X_GPIO_FUNC_ETH_SWITCH_LED1_EN |
+   AR933X_GPIO_FUNC_ETH_SWITCH_LED2_EN |
+   AR933X_GPIO_FUNC_ETH_SWITCH_LED3_EN |
+   AR933X_GPIO_FUNC_ETH_SWITCH_LED4_EN);
 
-   /* LAN ports */
+   /* LAN port */
ath79_register_eth(1);
 
/* WAN port */
ath79_register_eth(0);
+
+   /* Ena

Re: [OpenWrt-Devel] [PATCH] [authsae] Fix 802.11s authsae support in netifd

2014-04-11 Thread Vittorio G (VittGam)
  

P.s.: This would fix ticket #15283. ___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] [authsae] Fix 802.11s authsae support in netifd

2014-04-11 Thread Vittorio G (VittGam)
Hi,

This patch implements support for 802.11s protected mesh wireless networks 
(using authsae) in the netifd framework.

Until meshd-nl80211 implements a proper -P option for the PID file, this uses 
shell backgrounding in order to be able to get the PID for the process.


Signed-off-by: Vittorio Gambaletta 

---


diff -upr a/package/network/services/hostapd/files/netifd.sh 
b/package/network/services/hostapd/files/netifd.sh
--- a/package/network/services/hostapd/files/netifd.sh
+++ b/package/network/services/hostapd/files/netifd.sh
@@ -585,5 +585,5 @@ wpa_supplicant_run() {
 }
 
 hostapd_common_cleanup() {
-   killall hostapd wpa_supplicant
+   killall hostapd wpa_supplicant meshd-nl80211
 }

diff -upr a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh 
b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
--- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
+++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
@@ -449,6 +449,7 @@ mac80211_setup_adhoc() {
 
 mac80211_setup_vif() {
local name="$1"
+   local failed
 
json_select data
json_get_vars ifname
@@ -473,7 +474,19 @@ mac80211_setup_vif() {
json_get_var mp_val "$var"
[ -n "$mp_val" ] && iw dev "$ifname" set 
mesh_param "$var" "$mp_val"
done
-   # todo: authsae
+
+   # authsae
+   json_get_vars key
+   if [ -n "$key" ]; then
+   if [ -e "/lib/wifi/authsae.sh" ]; then
+   . /lib/wifi/authsae.sh
+   authsae_start_interface || failed=1
+   else
+   wireless_setup_vif_failed 
AUTHSAE_NOT_INSTALLED
+   json_select ..
+   return
+   fi
+   fi
;;
adhoc)
wireless_vif_parse_encryption

diff -upr a/package/network/services/authsae/files/lib/wifi/authsae.sh 
b/package/network/services/authsae/files/lib/wifi/authsae.sh
--- a/package/network/services/authsae/files/lib/wifi/authsae.sh
+++ b/package/network/services/authsae/files/lib/wifi/authsae.sh
@@ -1,28 +1,24 @@
 authsae_start_interface() {
-   local device="$1" # to use the correct channel
-   local vif="$2"
-   local band
-
-   cfgfile="/var/run/authsae-$vif.cfg"
-   config_get channel "$device" channel
-   config_get hwmode "$device" hwmode
-   config_get htmode "$device" htmode
-   config_get ifname "$vif" ifname
-   config_get key "$vif" key
-   config_get mesh_id "$vif" mesh_id
-   config_get mcast_rate "$vif" mcast_rate "12"
+   local mcast_rate
+   local mesh_htmode
+   local mesh_band
+   local authsae_conf_file="/var/run/authsae-$ifname.cfg"
+   local ret=1
+
+   json_get_vars mcast_rate
+   set_default mcast_rate "12"
 
case "$htmode" in
-   HT20|HT40+|HT40-) htmode="$htmode";;
-   NOHT|none|*) htmode="none";;
+   HT20|HT40+|HT40-) mesh_htmode="$htmode";;
+   *) mesh_htmode="none";;
esac
 
case "$hwmode" in
-   *g*) band=11g;;
-   *a*) band=11a;;
+   *g*) mesh_band=11g;;
+   *a*) mesh_band=11a;;
esac
 
-   cat > "$cfgfile" < "$authsae_conf_file" /dev/null &
+   authsae_pid="$!"
+   ret="$?"
+
+   echo $authsae_pid > /var/run/authsae-$ifname.pid
+   wireless_add_process "$authsae_pid" "/usr/bin/meshd-nl80211" 1
+
+   [ "$ret" != 0 ] && wireless_setup_vif_failed AUTHSAE_FAILED
+   return $ret
 }
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] hostadp/netifd Full Dynamic VLAN support

2014-03-03 Thread Vittorio G (VittGam)
Hi Joseph,

Thank you for the patch! But there is an error here:

On Mar 3, 2014 5:59 PM, "Joseph CG Walker" 
wrote:

> +define Package/hostpad-common/conffiles
> +/etc/config/hostpad.vlan
> +endef

Hostpad instead of hostapd. ;)

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


[OpenWrt-Devel] [PATCH] Fix regression in busybox sysntpd init when specifying more than one ntp server in the config file.

2014-02-28 Thread Vittorio G (VittGam)

Hi,

This patch fixes a regression introduced with r38787.

Before patching:
/usr/sbin/ntpd -n -l -p server1 server2 server3 server4

After patching:
/usr/sbin/ntpd -n -l -p server1 -p server2 -p server3 -p server4

Signed-off-by: Vittorio Gambaletta 
---

--- a/trunk/package/utils/busybox/files/sysntpd	2013-11-28 
12:28:40.0 +0100
+++ b/trunk/package/utils/busybox/files/sysntpd	2014-02-28 
19:51:48.957785869 +0100

@@ -24,7 +24,7 @@
procd_open_instance
procd_set_param command "$PROG" -n
[ "$enable_server" = "1" ] && procd_append_param command -l
-   for peer in "$server"; do
+   for peer in $server; do
procd_append_param command -p $peer
done
procd_set_param respawn
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


  1   2   >