Re: [OpenWrt-Devel] ath79: Force usb host mode for ar9331

2019-11-18 Thread Micke Prag
Den 11/16/19 kl. 4:44 PM, skrev Piotr Dymacz:
> Hi Micke,
>
> On 08.11.2019 13:30, Micke Prag wrote:
>> Den 11/8/19 kl. 11:01 AM, skrev Piotr Dymacz:
>>> Hi Micke,
>>>
>>> On 08.11.2019 08:36, Micke Prag wrote:
>>>> In commit 00ea16557d [1] the way usb is initiated was changed. Instead
>>>> of initiate both ehci-platform and ci_hdrc the bootstrap status
>>>> register
>>>> is checked and used to determine which platform to initiate.
>>>
>>> There were other changes later, see for example 57c641ba6e.
>> Yes, I was looking at the code after this commit when making my
>> conclusions above. But 00ea16557d is the commit that breaks the board
>> initially.
>>>
>>>> Unfortunately this break my board since the gpio used to determine
>>>> this
>>>> is used for other purposes.
>>>
>>> This means your board has a wrong bootstrap configuration and you
>>> should make sure GPIO for host/device mode has correct initialization
>>> value.
>>
>> Yes, it is correct the bootstrap is not correct at hardware level. But
>> there is 30 k+ boards out in the world so fixing this now is a bit
>> late... ;)
>>
>>>
>>>> dev-usb.h only exposes one function:
>>>> void ath79_register_usb(void);
>>>> so there is not much to alter the way usb is initiated.
>>>>
>>>> I tried to write to the bootstrap register but unfortunately this did
>>>> not seem to work:
>>>>
>>>> u32 t;
>>>> t = ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP);
>>>> pr_warn("ath79: Register before %X", t);
>>>> t |= AR933X_BOOTSTRAP_USB_MODE_HOST;
>>>> ath79_reset_wr(AR933X_RESET_REG_BOOTSTRAP, t);
>>>> pr_warn("ath79: Register after %X",
>>>> ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP));
>>>>
>>>> Gives the following output:
>>>>
>>>> ath79: Register before 42202
>>>> ath79: Register after 42202
>>> USB mode in AR9331 is selected at power on, based on GPIO13 value and
>>> I'm not aware of any other/software ways to change it. AFAIK, only
>>> QCA9563 allows to switch between host and device modes 'on the fly'.
>>
>> Is was working before 00ea16557d so simply initialize ehci-platform
>> instead ci_hdrc will fix it. Unfortunately I cannot find a way to tell
>> ath79_register_usb to force it into host mode in my board file instead
>> of reading the bootstrap register.
>
> Do you want to tell me that a board with wrong bootstrap configuration
> and USB switched to device mode was able to use the bus in host mode?
>
> IIRC, during my tests I found that this bootstrap option makes the D+
> line to gets pulled-up to VBUS and there was no way to change it back.
> I would need to make some more tests to confirm that, though.
>
Yes, I am.

Or, to be correct. This gpio is used as an output so it is connected to
a transistor. It's not "driven" to either high nor low other than what
the base-pin from the transistor is doing.

Regardless the bootstrap register is set incorrect and forcing to host
mode _do_ work.

I can provide more testing if you want me to?



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


Re: [OpenWrt-Devel] ath79: Force usb host mode for ar9331

2019-11-08 Thread Micke Prag
Den 11/8/19 kl. 11:01 AM, skrev Piotr Dymacz:
> Hi Micke,
>
> On 08.11.2019 08:36, Micke Prag wrote:
>> In commit 00ea16557d [1] the way usb is initiated was changed. Instead
>> of initiate both ehci-platform and ci_hdrc the bootstrap status register
>> is checked and used to determine which platform to initiate.
>
> There were other changes later, see for example 57c641ba6e.
Yes, I was looking at the code after this commit when making my
conclusions above. But 00ea16557d is the commit that breaks the board
initially.
>
>> Unfortunately this break my board since the gpio used to determine this
>> is used for other purposes.
>
> This means your board has a wrong bootstrap configuration and you
> should make sure GPIO for host/device mode has correct initialization
> value.

Yes, it is correct the bootstrap is not correct at hardware level. But
there is 30 k+ boards out in the world so fixing this now is a bit
late... ;)

>
>> dev-usb.h only exposes one function:
>> void ath79_register_usb(void);
>> so there is not much to alter the way usb is initiated.
>>
>> I tried to write to the bootstrap register but unfortunately this did
>> not seem to work:
>>
>> u32 t;
>> t = ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP);
>> pr_warn("ath79: Register before %X", t);
>> t |= AR933X_BOOTSTRAP_USB_MODE_HOST;
>> ath79_reset_wr(AR933X_RESET_REG_BOOTSTRAP, t);
>> pr_warn("ath79: Register after %X",
>> ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP));
>>
>> Gives the following output:
>>
>> ath79: Register before 42202
>> ath79: Register after 42202
> USB mode in AR9331 is selected at power on, based on GPIO13 value and
> I'm not aware of any other/software ways to change it. AFAIK, only
> QCA9563 allows to switch between host and device modes 'on the fly'.

Is was working before 00ea16557d so simply initialize ehci-platform
instead ci_hdrc will fix it. Unfortunately I cannot find a way to tell
ath79_register_usb to force it into host mode in my board file instead
of reading the bootstrap register.

Writing to the bootstrap register was a workaround I tried. In the
datasheet this register should be read/write. I don't know if my code
for writing the register is wrong or it is simply not possible to write
into this register.

>
>> How can I solve this?
>
> Only in hardware I suppose (setup correct initial value on GPIO13).
>
It could also be solved by telling the module to force it into host mode
and not reading the bootstrap register. I am not sure the best approach
for this that would be accepted upstream.

Adding a parameter to ath79_register_usb() could be one option?



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


[OpenWrt-Devel] ath79: Force usb host mode for ar9331

2019-11-07 Thread Micke Prag
In commit 00ea16557d [1] the way usb is initiated was changed. Instead
of initiate both ehci-platform and ci_hdrc the bootstrap status register
is checked and used to determine which platform to initiate.

Unfortunately this break my board since the gpio used to determine this
is used for other purposes.

dev-usb.h only exposes one function: 
void ath79_register_usb(void);
so there is not much to alter the way usb is initiated.

I tried to write to the bootstrap register but unfortunately this did
not seem to work:

u32 t;
t = ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP);
pr_warn("ath79: Register before %X", t);
t |= AR933X_BOOTSTRAP_USB_MODE_HOST;
ath79_reset_wr(AR933X_RESET_REG_BOOTSTRAP, t);
pr_warn("ath79: Register after %X",
ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP));

Gives the following output:

ath79: Register before 42202
ath79: Register after 42202

How can I solve this?


[1] https://github.com/openwrt/openwrt/commit/00ea16557d


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


[OpenWrt-Devel] ar71xx: Setting the usb mode from kernel board file

2016-11-08 Thread micke . prag
 

Hi, 

I have a board based on ar9331. According to the datasheet [1]
page 81 the USB_MODE is determined by reading GPIO13 on boot.
Unfortunately this pin is connected to some other function that ties
this pin to ground and therefore the USB_MODE is set wrong. 

Does
someone know how I can manually set this to 0x1 in the kernel and
override the value read from the gpio? 

Regards
Micke 

[1]
https://www.openhacks.com/uploadsproductos/ar9331_datasheet.pdf 

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


[OpenWrt-Devel] [PATCH 2/2] ar71xx: add support for the Telldus TellStick ZNet Lite

2016-03-08 Thread Micke Prag
Signed-off-by: Micke Prag <micke.p...@telldus.se>
---
 target/linux/ar71xx/base-files/etc/board.d/01_leds |   5 +
 .../linux/ar71xx/base-files/etc/board.d/02_network |   5 +
 target/linux/ar71xx/base-files/etc/diag.sh |   3 +
 target/linux/ar71xx/base-files/lib/ar71xx.sh   |   6 +
 .../ar71xx/base-files/lib/upgrade/platform.sh  |   1 +
 target/linux/ar71xx/config-4.1 |   1 +
 target/linux/ar71xx/config-4.4 |   1 +
 .../ar71xx/files/arch/mips/ath79/Kconfig.openwrt   |  10 ++
 target/linux/ar71xx/files/arch/mips/ath79/Makefile |   1 +
 .../arch/mips/ath79/mach-tellstick-znet-lite.c | 129 +
 .../linux/ar71xx/files/arch/mips/ath79/machtypes.h |   1 +
 target/linux/ar71xx/generic/profiles/telldus.mk|  17 +++
 target/linux/ar71xx/image/Makefile |   9 ++
 13 files changed, 189 insertions(+)
 create mode 100644 
target/linux/ar71xx/files/arch/mips/ath79/mach-tellstick-znet-lite.c
 create mode 100644 target/linux/ar71xx/generic/profiles/telldus.mk

diff --git a/target/linux/ar71xx/base-files/etc/board.d/01_leds 
b/target/linux/ar71xx/base-files/etc/board.d/01_leds
index 6cec5df..eff6e0d 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/01_leds
+++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds
@@ -407,6 +407,11 @@ smart-300)
ucidef_set_led_wlan "wlan" "WLAN" "nc-link:green:wlan" "phy0tpt"
;;
 
+tellstick-znet-lite)
+   ucidef_set_led_netdev "lan_act" "LANACT" "tellstick:green:lan" "eth0" 
"tx rx"
+   ucidef_set_led_netdev "lan_link" "LANLINK" "tellstick:orange:lan" 
"eth0" "link"
+   ;;
+
 tew-712br)
ucidef_set_led_netdev "wan" "WAN" "trendnet:green:wan" "eth1"
ucidef_set_led_switch "lan1" "LAN1" "trendnet:green:lan1" "switch0" 
"0x02"
diff --git a/target/linux/ar71xx/base-files/etc/board.d/02_network 
b/target/linux/ar71xx/base-files/etc/board.d/02_network
index 799d98e..e88ef3a 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/02_network
+++ b/target/linux/ar71xx/base-files/etc/board.d/02_network
@@ -192,6 +192,11 @@ el-m150)
"0:lan" "1:lan" "3@eth1" # XXX: confirm!
;;
 
+tellstick-znet-lite)
+   ucidef_set_interface_wan "eth0" "dhcp"
+   ucidef_set_interface_raw "wlan" "wlan0" "dhcp"
+   ;;
+
 tl-wdr4300|\
 tl-wr1041n-v2)
ucidef_add_switch "switch0" \
diff --git a/target/linux/ar71xx/base-files/etc/diag.sh 
b/target/linux/ar71xx/base-files/etc/diag.sh
index db69757..d083a79 100644
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -263,6 +263,9 @@ get_status_led() {
qihoo-c301)
status_led="qihoo:green:status"
;;
+   tellstick-znet-lite)
+   status_led="tellstick:white:system"
+   ;;
tew-632brp)
status_led="tew-632brp:green:status"
;;
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh 
b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 804f622..46f1685 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -120,6 +120,9 @@ tplink_board_detect() {
"12"*)
model="MERCURY MAC1200R"
;;
+   "007260"*)
+   model="TellStick ZNet Lite"
+   ;;
"3C0001"*)
model="OOLITE"
;;
@@ -749,6 +752,9 @@ ar71xx_board_detect() {
"Smart Electronics Black Swift board"*)
name="bsb"
;;
+   *"Telldus TellStick ZNet Lite")
+   name="tellstick-znet-lite"
+   ;;
*TEW-632BRP)
name="tew-632brp"
;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh 
b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index 8a70502..d410819 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -336,6 +336,7 @@ platform_check_image() {
onion-omega | \
oolite | \
smart-300 | \
+   tellstick-znet-lite | \
tl-mr10u | \
tl-mr11u | \
tl-mr12u | \
diff --git a/target/linux/ar71xx/config-4.1 b/target/linux/ar71xx/config-4.1
index 0ccb278..0570749 100644
--- a/target/linux/ar71xx/config-4.1
+++ b/target/linux/ar71xx/config-4.1
@@ -123,6 +123,7 @@ CONFIG_ATH79_MACH_R6100=y
 # CONFIG_ATH79_MACH_RBSXTLITE is not se

[OpenWrt-Devel] [PATCH 1/2] base-files: add function ucidef_set_interface_raw to enable default configuration on interfaces other than lan and wan.

2016-03-08 Thread Micke Prag
Signed-off-by: Micke Prag <micke.p...@telldus.se>
---
 package/base-files/files/lib/functions/uci-defaults.sh | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/package/base-files/files/lib/functions/uci-defaults.sh 
b/package/base-files/files/lib/functions/uci-defaults.sh
index 31e4687..b097fba 100755
--- a/package/base-files/files/lib/functions/uci-defaults.sh
+++ b/package/base-files/files/lib/functions/uci-defaults.sh
@@ -89,6 +89,12 @@ ucidef_set_interfaces_lan_wan() {
json_select ..
 }
 
+ucidef_set_interface_raw() {
+   json_select_object network
+   _ucidef_set_interface "$@"
+   json_select ..
+}
+
 _ucidef_add_switch_port() {
# inherited: $num $device $need_tag $role $index $prev_role
# inherited: $n_cpu $n_ports $n_vlan $cpu0 $cpu1 $cpu2 $cpu3 $cpu4 $cpu5
-- 
2.4.10
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCHv2] base-files: add function ucidef_set_interface_raw

2016-03-01 Thread micke . prag
This function can be used to configure default configuration on 
interfaces other

than lan and wan, such as wlan or other custom interfaces.

Signed-off-by: Micke Prag <micke.p...@telldus.se>
---
 package/base-files/files/lib/functions/uci-defaults.sh | 6 ++
 1 file changed, 6 insertions(+)

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

index 512e0ed..d36ead2 100755
--- a/package/base-files/files/lib/functions/uci-defaults.sh
+++ b/package/base-files/files/lib/functions/uci-defaults.sh
@@ -89,6 +89,12 @@ ucidef_set_interfaces_lan_wan() {
json_select ..
 }

+ucidef_set_interface_raw() {
+   json_select_object network
+   _ucidef_set_interface "$@"
+   json_select ..
+}
+
 _ucidef_add_switch_port() {
# inherited: $num $device $need_tag $role $index $prev_role
 	# inherited: $n_cpu $n_ports $n_vlan $cpu0 $cpu1 $cpu2 $cpu3 $cpu4 
$cpu5

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


[OpenWrt-Devel] [PATCH] ar71xx: add support for the Telldus TellStick ZNet Lite

2016-03-01 Thread micke . prag

Signed-off-by: Micke Prag <micke.p...@telldus.se>
---
 target/linux/ar71xx/base-files/etc/board.d/01_leds |   5 +
 .../linux/ar71xx/base-files/etc/board.d/02_network |   5 +
 target/linux/ar71xx/base-files/etc/diag.sh |   3 +
 target/linux/ar71xx/base-files/lib/ar71xx.sh   |   6 +
 .../ar71xx/base-files/lib/upgrade/platform.sh  |   1 +
 target/linux/ar71xx/config-4.1 |   1 +
 target/linux/ar71xx/config-4.4 |   1 +
 .../ar71xx/files/arch/mips/ath79/Kconfig.openwrt   |  10 ++
 target/linux/ar71xx/files/arch/mips/ath79/Makefile |   1 +
 .../arch/mips/ath79/mach-tellstick-znet-lite.c | 129 
+

 .../linux/ar71xx/files/arch/mips/ath79/machtypes.h |   1 +
 target/linux/ar71xx/generic/profiles/telldus.mk|  17 +++
 target/linux/ar71xx/image/Makefile |   9 ++
 13 files changed, 189 insertions(+)
 create mode 100644 
target/linux/ar71xx/files/arch/mips/ath79/mach-tellstick-znet-lite.c

 create mode 100644 target/linux/ar71xx/generic/profiles/telldus.mk

diff --git a/target/linux/ar71xx/base-files/etc/board.d/01_leds 
b/target/linux/ar71xx/base-files/etc/board.d/01_leds

index 151eac2..c787ed7 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/01_leds
+++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds
@@ -407,6 +407,11 @@ smart-300)
ucidef_set_led_wlan "wlan" "WLAN" "nc-link:green:wlan" "phy0tpt"
;;

+tellstick-znet-lite)
+	ucidef_set_led_netdev "lan_act" "LANACT" "tellstick:green:lan" "eth0" 
"tx rx"
+	ucidef_set_led_netdev "lan_link" "LANLINK" "tellstick:orange:lan" 
"eth0" "link"

+   ;;
+
 tew-712br)
ucidef_set_led_netdev "wan" "WAN" "trendnet:green:wan" "eth1"
 	ucidef_set_led_switch "lan1" "LAN1" "trendnet:green:lan1" "switch0" 
"0x02"
diff --git a/target/linux/ar71xx/base-files/etc/board.d/02_network 
b/target/linux/ar71xx/base-files/etc/board.d/02_network

index 799d98e..e88ef3a 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/02_network
+++ b/target/linux/ar71xx/base-files/etc/board.d/02_network
@@ -192,6 +192,11 @@ el-m150)
"0:lan" "1:lan" "3@eth1" # XXX: confirm!
;;

+tellstick-znet-lite)
+   ucidef_set_interface_wan "eth0" "dhcp"
+   ucidef_set_interface_raw "wlan" "wlan0" "dhcp"
+   ;;
+
 tl-wdr4300|\
 tl-wr1041n-v2)
ucidef_add_switch "switch0" \
diff --git a/target/linux/ar71xx/base-files/etc/diag.sh 
b/target/linux/ar71xx/base-files/etc/diag.sh

index 1971b84..4078eab 100644
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -263,6 +263,9 @@ get_status_led() {
qihoo-c301)
status_led="qihoo:green:status"
;;
+   tellstick-znet-lite)
+   status_led="tellstick:white:system"
+   ;;
tew-632brp)
status_led="tew-632brp:green:status"
;;
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh 
b/target/linux/ar71xx/base-files/lib/ar71xx.sh

index 3203273..3a568d0 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -120,6 +120,9 @@ tplink_board_detect() {
"12"*)
model="MERCURY MAC1200R"
;;
+   "007260"*)
+   model="TellStick ZNet Lite"
+   ;;
"3C0001"*)
model="OOLITE"
;;
@@ -749,6 +752,9 @@ ar71xx_board_detect() {
"Smart Electronics Black Swift board"*)
name="bsb"
;;
+   *"Telldus TellStick ZNet Lite")
+   name="tellstick-znet-lite"
+   ;;
*TEW-632BRP)
name="tew-632brp"
;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh 
b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh

index 8a70502..d410819 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -336,6 +336,7 @@ platform_check_image() {
onion-omega | \
oolite | \
smart-300 | \
+   tellstick-znet-lite | \
tl-mr10u | \
tl-mr11u | \
tl-mr12u | \
diff --git a/target/linux/ar71xx/config-4.1 
b/target/linux/ar71xx/config-4.1

index 0ccb278..0570749 100644
--- a/target/linux/ar71xx/config-4.1
+++ b/target/linux/ar71xx/config-4.1
@@ -123,6 +123,7 @@ CONFIG_ATH79_MACH_R6100=y
 # CONFIG_ATH79_MACH_RBSXTLITE is not set

[OpenWrt-Devel] [PATCH] base-files: add function ucidef_set_interface_raw

2016-02-29 Thread micke . prag
This function can be used to configure default configuration on 
interfaces other

than lan and wan, such as wlan or other custom interfaces.

Signed-off-by: Micke Prag <micke.p...@telldus.se>
---
 package/base-files/files/lib/functions/uci-defaults.sh | 6 ++
 1 file changed, 6 insertions(+)

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

index 512e0ed..d36ead2 100755
--- a/package/base-files/files/lib/functions/uci-defaults.sh
+++ b/package/base-files/files/lib/functions/uci-defaults.sh
@@ -89,6 +89,12 @@ ucidef_set_interfaces_lan_wan() {
json_select ..
 }

+ucidef_set_interface_raw() {
+   json_select_object network
+   _ucidef_set_interface "$@"
+   json_select ..
+}
+
 _ucidef_add_switch_port() {
# inherited: $num $device $need_tag $role $index $prev_role
 	# inherited: $n_cpu $n_ports $n_vlan $cpu0 $cpu1 $cpu2 $cpu3 $cpu4 
$cpu5

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


Re: [OpenWrt-Devel] Setting uci defaults in trunk

2016-02-26 Thread micke . prag

2016-02-26 17:20 skrev Felix Fietkau:


On 2016-02-26 15:54, micke.prag@telldus.sewrote:


2016-02-26 15:35 skrev Felix Fietkau:


On 2016-02-26 15:27, micke.prag@telldus.sewrote:


Hi I have a board config for a device that I am about to commit to
OpenWRT. I am rebasing my work against trunk but some things have
changed since I made the config. My code was written against 
r46120

but somethings doesn't work on r48800. My question is how I should
update my code to "proper OpenWRT standard"? First, network. The
board has only one network port (it is not a router). This should
be configured using DHCP. The board also has Wifi and should be
configured as a client but disabled as default. In -r46120 I put
this in /etc/uci-defaults/02_network: ucidef_set_interface_raw
"lan" "eth0" "dhcp" ucidef_set_interface_raw "wlan" "wlan0" "dhcp"
uci batch 

Re: [OpenWrt-Devel] Setting uci defaults in trunk

2016-02-26 Thread micke . prag

2016-02-26 15:35 skrev Felix Fietkau:


On 2016-02-26 15:27, micke.prag@telldus.sewrote:


Hi I have a board config for a device that I am about to commit to
OpenWRT. I am rebasing my work against trunk but some things have
changed since I made the config. My code was written against r46120 
but
somethings doesn't work on r48800. My question is how I should 
update

my code to "proper OpenWRT standard"? First, network. The board has
only one network port (it is not a router). This should be 
configured

using DHCP. The board also has Wifi and should be configured as a
client but disabled as default. In -r46120 I put this in
/etc/uci-defaults/02_network: ucidef_set_interface_raw "lan" "eth0"
"dhcp" ucidef_set_interface_raw "wlan" "wlan0" "dhcp" uci batch 
<
set network.lan.hostname='TellStick-ZNet-Lite' set
wireless.radio0.disabled=0 set 
wireless.@wifi-iface[0].network='wlan'

set wireless.@wifi-iface[0].mode='sta' set
wireless.@wifi-iface[0].encryption=psk2 EOF uci commit wireless In
r48800 this file seems to have been replaced by 
/etc/board.d/02_network

instead. Unfortunately "raw" uci commands does not work since its
generating /etc/board.json instead? Am I correct? If I do this then
"dhcp" is ignored and the interface is set to static anyway:
ucidef_set_interface_lan "eth0" "dhcp" How to convert the wireless 
and

the hostname I have no idea? Next is led. I had this in
/etc/uci-defaults/02_network: ucidef_set_led_netdev "lan_act" 
"LANACT"
"tellstick:green:lan" "eth0" ucidef_set_led_netdev "lan_link" 
"LANLINK"
"tellstick:orange:lan" "eth0" uci set system.led_lan_act.mode='tx 
rx'

uci set system.led_lan_link.mode='link' The first two lines work in
r48800 but how do I convert the last two lines? How do I set the 
mode?


To change the defaults, you shouldn't just modify the existing files.
You can simply create a new file in /etc/uci-defaults which runs your
uci batch command as usual. It will run after /etc/board.d has been
processed and the default config has been generated, so you should be
able to override any parameter you want.


The file /etc/uci-defaults/02_network was (re)moved in r47534. Is it 
really the right way to go to reintroduce this file again?
My thougs was that this should be implemented in /etc/board.json 
instead, maybe I was wrong?


Please note that my goal is to have the board config sent upstream, not 
only for my local build.

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


[OpenWrt-Devel] Setting uci defaults in trunk

2016-02-26 Thread micke . prag

Hi

I have a board config for a device that I am about to commit to 
OpenWRT. I am rebasing my work against trunk but some things have 
changed since I made the config. My code was written against r46120 but 
somethings doesn't work on r48800.


My question is how I should update my code to "proper OpenWRT 
standard"?


First, network.

The board has only one network port (it is not a router). This should 
be configured using DHCP. The board also has Wifi and should be 
configured as a client but disabled as default.


In -r46120 I put this in /etc/uci-defaults/02_network:
ucidef_set_interface_raw "lan" "eth0" "dhcp"
ucidef_set_interface_raw "wlan" "wlan0" "dhcp"
uci batch 

Re: [OpenWrt-Devel] write/read from mtd ART partition

2016-02-16 Thread micke . prag

2016-02-16 11:43 skrev John kerry:


Hi

I am trying to write mac address and Serial number in ART partition.

Creating 6 MTD partitions on "spi0.0":
0x-0x0004 : "u-boot"
0x0004-0x0005 : "u-boot-env"
0x0005-0x0068 : "rootfs"
mtd: partition "rootfs" set to be root filesystem
mtd: partition "rootfs_data" created automatically, ofs=5B, 
len=D

0x005b-0x0068 : "rootfs_data"
0x0068-0x007f : "kernel"
0x007f-0x0080 : "art"
0x0005-0x007e : "firmware"

cat /proc/mtd
dev: size erasesize name
mtd0: 0004 0001 "u-boot"
mtd1: 0001 0001 "u-boot-env"
mtd2: 0063 0001 "rootfs"
mtd3: 000d 0001 "rootfs_data"
mtd4: 0017 0001 "kernel"
mtd5: 0001 0001 "art"
mtd6: 0079 0001 "firmware"

Could anyone help me to write wifi mac address and Serial number to 
ART

partition without overwriting on calibration data.

Thanks, John

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


You may modify these three lines for your application. You need to 
alter the offset for the mac address:


dd if=/dev/mtd5 of=/tmp/art.img
printf "\xAA\xBB\xCC\xDD\xEE\xFF" | dd conv=notrunc of=/tmp/art.img 
bs=1 seek=$((0x10))

mtd write /tmp/art.img art
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] alternative for pyserial+python-mini

2015-06-26 Thread micke . prag

Hi,

I have just created a pull request for an updated version of pyserial.
https://github.com/openwrt/packages/pull/1485

Regards
Micke Prag

2015-06-26 15:26 skrev Alexandru Ardelean:

Ah, since that email, python became: - python-base - just the minimal 
to

have a python interpreter running - python-light - is a dynamic
package; it's python (full) minus all other python-codecs,
python-compiler, etc - python - full python install, minus a few 
stuff I

considered that could be stripped [to reduce size], like tests [per
module], some python-tk/tcl [GUI] libs

The idea of python-light is that, whenever you move a Python built-in
module from python-light into a separate package (like 
python-codecs),

python-light gets lighter.

The mechanism is fairly dynamic; you just need to add a new
'python-package-xxx.mk [3]' file with some basic Makefile rules, 
and

that's it.

People can choose to install python-base if they need like
really-really-really-really basic python (a = b + c and maybe some 
other

syntax).
Then they can choose to install other optional packages.
But for most cases, maybe python-light would be sufficient.

The above is also true for python3.

On Fri, Jun 26, 2015 at 4:15 PM, valent.turko...@gmail.com
valent.turko...@gmail.com wrote:


On 24 October 2014 at 11:10, Alexandru Ardelean
ardeleana...@gmail.com wrote:
 python-mini is now just python.

Thanks for clarification, I'll add that info on Python OpenWrt Wiki
page [1].

I tried installing python package on Caos Calmer rc2 and I get a 
bunch

of dependencies installed automatically and they use up bunch of
space. I didn't notice that python-mini package installed lots of
dependencies on Barrier Breaker, but I'm not 100% sure.

Was python-mini package on BB python without any dependencies and
python same package but with all added dependencies?

[1] http://wiki.openwrt.org/doc/software/python [1]


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



Links:
--
[1] http://wiki.openwrt.org/doc/software/python
[2] https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[3] http://python-package-xxx.mk
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] musl breaks python

2015-06-22 Thread micke . prag

Hi,

I have discovered that python is broken using musl. When a thread 
created

using the threading library exists, python segfaults.

This is a simple example application showing the issue:

import time
import threading

def test():
print(Hello)
time.sleep(2)
print(world)

t = threading.Thread(target=test)
t.start()

After printing world python segfaults.

root@OpenWrt:~# python test.py
Hello
world
Segmentation fault

This has only been tested/verified by me on the ar71xx platform using 
AR9331. Built using r46106.

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


[OpenWrt-Devel] [PATCH] Combine CA-certificates in one file

2015-06-12 Thread micke . prag

From: Micke Prag micke.p...@telldus.se

Some packages or libraries cannot use split ca cetificates in a folder. 
This adds a config to combine all certificates into one file.


Since this adds another ~300 Kb to the image this can be enabled by a 
config

which is disabled by default.

This also allows for packes to require this option in the DEPENDS 
section.


Signed-off-by: Micke Prag micke.p...@telldus.se
---
 package/system/ca-certificates/Config.in | 7 +++
 package/system/ca-certificates/Makefile  | 7 +++
 2 files changed, 14 insertions(+)
 create mode 100644 package/system/ca-certificates/Config.in

diff --git a/package/system/ca-certificates/Config.in 
b/package/system/ca-certificates/Config.in

new file mode 100644
index 000..36ebdc3
--- /dev/null
+++ b/package/system/ca-certificates/Config.in
@@ -0,0 +1,7 @@
+config CA_CERTIFICATES_COMBINE_CERTIFICATES
+   bool Combine certificates
+   depends on PACKAGE_ca-certificates
+   help
+   Combine all CA-certificates in 
/etc/ssl/certs/ca-certificates.crt
+		This might be required by some applications and adds ~300 Kb to the 
image

+   default n
diff --git a/package/system/ca-certificates/Makefile 
b/package/system/ca-certificates/Makefile

index 9c50fef..9fd1632 100644
--- a/package/system/ca-certificates/Makefile
+++ b/package/system/ca-certificates/Makefile
@@ -23,6 +23,10 @@ define Package/ca-certificates
   TITLE:=System CA certificates
 endef

+define Package/ca-certificates/config
+   source $(SOURCE)/Config.in
+endef
+
 define Build/Install
mkdir -p \
$(PKG_INSTALL_DIR)/usr/sbin \
@@ -41,6 +45,9 @@ define Package/ca-certificates/install
let SUFFIX += 1 ; \
done ; \
$(LN) CERTFILE $(1)/etc/ssl/certs/HASH.SUFFIX ; 
\
+		if [ $(CONFIG_CA_CERTIFICATES_COMBINE_CERTIFICATES) == y ]; then 
\
+			cat $(1)/etc/ssl/certs/CERTFILE  
$(1)/etc/ssl/certs/ca-certificates.crt ; \

+   fi ; \
done
 endef

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


Re: [OpenWrt-Devel] [PATCH] Combine CA-certificates in one file

2015-06-12 Thread micke . prag

2015-06-12 09:39 skrev Cristian Morales Vega:


On 12 June 2015 at 08:30, micke.p...@telldus.se wrote:

Some packages or libraries cannot use split ca cetificates in a 
folder.

This adds a config to combine all certificates into one file.


I have nothing against this patch. But do you have a list of such
packages? I may be interested in patching them.


Any application using Python should have this issue. I am not aware of 
any application in OpenWRT currently that have this issue but my company 
are developing some python software intended to run on OpenWRT boards.


The function ssl.wrap_socket() has one parameter called ca_certs which 
takes only one file. The documentations says:
The ca_certs file contains a set of concatenated “certification 
authority” certificates, which are used to validate certificates passed 
from the other end of the connection. See the discussion of Certificates 
for more information about how to arrange the certificates in this file.

https://docs.python.org/2/library/ssl.html
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] Combine CA-certificates in one file

2015-06-12 Thread micke . prag

2015-06-12 09:39 skrev Cristian Morales Vega:


On 12 June 2015 at 08:30, micke.p...@telldus.se wrote:

Some packages or libraries cannot use split ca cetificates in a 
folder.

This adds a config to combine all certificates into one file.


I have nothing against this patch. But do you have a list of such
packages? I may be interested in patching them.


In python 2.7.9 there is a new class SSLContext that can load the 
system certificates. This was not available previously. OpenWRT 
currently ships 2.7.10. I have modified our code to use this instead.


My patch can be discarded, I think.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel