Re: [OpenWrt-Devel] Hooks on wifi up/down for starting/stopping dependent functionality?

2014-11-20 Thread Johan Almbladh
Thanks for the ubus pointers, Bastian. That should solve it :)

Johan




On Mon, Nov 17, 2014 at 10:34 AM, Bastian Bittorf 
wrote:

> * Johan Almbladh  [17.11.2014 10:22]:
> > The hotplug scripts receive events for interface names, but they know
> > nothing about the underlying configuration. Is there any way to map a
> WLAN
> > interface name, e.g. wlan0, to the corresponding UCI config entry in
> > /etc/config/wireless?
>
> /sbin/hotplug-call exports some global shell-vars, which you
> can use in your script, e.g.:
>
> ACTION - e.g. 'ifup'
> INTERFACE - e.g. 'mywan'
> DEVICE - e.g. eth0.2
>
> if you need some more, you can query them in your
> script with e.g.
>
> ubus call network.interface.mywan status
>
> you can parse the JSON with e.g.
>
> . /usr/share/libubox/jshn.sh
> OUT="$( ubus call network.interface.mywan status )"
> eval $( jshn -r "$OUT" )
> echo $JSON_VAR_status
>
> bye, bastian
>
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Hooks on wifi up/down for starting/stopping dependent functionality?

2014-11-17 Thread Bastian Bittorf
* Johan Almbladh  [17.11.2014 10:22]:
> The hotplug scripts receive events for interface names, but they know
> nothing about the underlying configuration. Is there any way to map a WLAN
> interface name, e.g. wlan0, to the corresponding UCI config entry in
> /etc/config/wireless?

/sbin/hotplug-call exports some global shell-vars, which you
can use in your script, e.g.:

ACTION - e.g. 'ifup'
INTERFACE - e.g. 'mywan'
DEVICE - e.g. eth0.2

if you need some more, you can query them in your
script with e.g.

ubus call network.interface.mywan status

you can parse the JSON with e.g.

. /usr/share/libubox/jshn.sh
OUT="$( ubus call network.interface.mywan status )"
eval $( jshn -r "$OUT" )
echo $JSON_VAR_status

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


Re: [OpenWrt-Devel] Hooks on wifi up/down for starting/stopping dependent functionality?

2014-11-12 Thread Johan Almbladh
Thanks, Bastian. If I add a script /etc/hotplug.d/net/ I get up/down events
for WLAN interfaces when /sbin/wifi is run.

The hotplug scripts receive events for interface names, but they know
nothing about the underlying configuration. Is there any way to map a WLAN
interface name, e.g. wlan0, to the corresponding UCI config entry in
/etc/config/wireless?

Johan

On Wed, Nov 12, 2014 at 10:53 AM, Bastian Bittorf 
wrote:

> * Johan Almbladh  [12.11.2014 10:45]:
> > I tried just doing "ubus listen" in one shell and then running "wifi"
> from
> > another, but that doesn't give much to go on:
>
> which events do you need?
>
> a joining or leaving station?
> use 'iw event'
>
> an upcoming (or going down) interface?
> use '/etc/hotplug.d/iface/$yourscript'
>
> bye, bastian
>
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Hooks on wifi up/down for starting/stopping dependent functionality?

2014-11-12 Thread Bastian Bittorf
* Johan Almbladh  [12.11.2014 10:45]:
> I tried just doing "ubus listen" in one shell and then running "wifi" from
> another, but that doesn't give much to go on:

which events do you need?

a joining or leaving station?
use 'iw event'

an upcoming (or going down) interface?
use '/etc/hotplug.d/iface/$yourscript'

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