Re: [OpenWrt-Devel] DSL support and luci integration

2013-01-25 Thread Antonio Di Martino

I found this old post in the OpenWrt-Devel mailing list
( https://lists.openwrt.org/pipermail/openwrt-devel/2012-January/013587.html )

I also have a Buffalo WBMR-HP-G300H and I installed OpenWrt r35047
/ LuCI Trunk (trunk+svn9599) on it. This LuCI extension for viewing DSL
line parameters isn't there. Is there a package I can install
on top of that? Can you provide any help? It would be most appreciated,
probably not only by me, but by most of the many users of this modem/router
as well.

Thanks for reading to the end of the message :)
-Antonio

I am quoting the old message below, since it's a year old.

--- Original Message ---

From: lee.essen at nowonline.co.uk
Date: Thu Jan 19 21:51:17 CET 2012 
Subject: DSL support and luci integration

I've been using trunk on a Buffalo WBMR-HP-G300H ADSL router with great 
success, so I've been looking at the existing DSL support and am keen to 
help out getting it better integrated.

I'm conscious that there are likely to be a number of different DSL 
devices needing support and have been thinking about a way to have 
relatively standard support in LuCI but with flexibility in 
implementation.

I have put together some patches to start doing this, but thought it 
best to check the concepts before getting too far ... also I don't know 
if anyone else is working on this or if other ideas have been discussed.

So basically:

A single control script that is shipped as part of the relevant 
driver (or app) for the device. For me, this is the lantiq one.
The control script (my suggestion is:  /etc/init.d/dsl_control) would 
be responsible for the normal start and stop as any rc script would be.
But also ... the control script can be used to get the DSL status, 
either in human readable form, or in a standard form parsable by Luci.

In this way any DSL implementation need only provide basic start, stop 
and status information and then it could easily appear in LuCI to 
provide line status, speed and noise information without any hardware 
specific detail in LuCI.

Just by way of example:

root at OpenWrt:~# /etc/init.d/dsl_control status
Line State: UP [0x801: showtime_tc_sync]
Data Rate:  4.064 Mb/s / 448 Kb/s
Line Attenuation:   49.0dB / 26.5dB
Noise Margin:   12.2dB / 25.0dB

Or, the LuCI compatible version ... I went for a loadstring approach 
that returned a lua table:

root at OpenWrt:~# /etc/init.d/dsl_control luastat
local dsl={}
dsl.line_state_num=0x801
dsl.line_state_detail=showtime_tc_sync
dsl.line_state=UP
dsl.data_rate_down=4064000
dsl.data_rate_up=448000
dsl.data_rate_down_s=4.064 Mb
dsl.data_rate_up_s=448 Kb
dsl.line_attenuation_down=49.0
dsl.line_attenuation_up=26.5
dsl.noise_margin_down=12.3
dsl.noise_margin_up=25.0
return dsl

I've also implemented the basic summary in the LuCI admin overview page 
which looks pretty nice, updates regularly (you can see the noise margin 
changing) and doesn't seem to place much load on the system.

There's a bit more to do, it currently doesn't actually check the 
daemon is running etc, also I think a start_available and 
stop_available variable might be a nice way to control whether LuCI 
should allow start and stop buttons ... possible on the network admin 
page?

Anyway ... just a few ideas, interested in thoughts, I can post the 
current patches if there's interest, or happy to explore other ideas if 
I'm way off the mark.

Cheers,

Lee.

-- 
bassm...@katamail.com

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


[OpenWrt-Devel] DSL support and luci integration

2012-11-27 Thread Frank Meerkötter
Hi,

back in January there was a discussion on how to integrate DSL
into Luci.

https://lists.openwrt.org/pipermail/openwrt-devel/2012-January/013587.html

A patch was presented which only got partially merged. The
dsl_control.sh is there, the integration into the web-ui seems
to be missing (AA  trunk).

What happened to the web-ui part?

Also there was a discussion about replacing the DSL
status reporting (and also control?) with a netlink based
solution.

What is the status of that?

Kind Regards,
Frank

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


Re: [OpenWrt-Devel] DSL support and luci integration

2012-11-27 Thread John Crispin

On 27/11/12 12:23, Frank Meerkötter wrote:

Hi,

back in January there was a discussion on how to integrate DSL
into Luci.

https://lists.openwrt.org/pipermail/openwrt-devel/2012-January/013587.html

A patch was presented which only got partially merged. The
dsl_control.sh is there, the integration into the web-ui seems
to be missing (AA  trunk).

What happened to the web-ui part?


got lost durig the release i guess

would be nice if the webui part could be rebased and resubmitted






Also there was a discussion about replacing the DSL
status reporting (and also control?) with a netlink based
solution.

What is the status of that?


i am in the middle of refactoring the whole mei/atm codebase and am 
considering to do the netlink bit at the same time




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


Re: [OpenWrt-Devel] DSL support and luci integration

2012-11-27 Thread Jo-Philipp Wich
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Why is there even a need for dedicated DSL control in the gui?
Shouldn't the normal per-interface ifup/ifdown be enough?

~ Jow
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iEYEARECAAYFAlC0pNsACgkQdputYINPTPOcEwCfR2BudTZt/wf5DzrU5PdC6AKc
J8sAn2dem+SofxCw2hCOU5jpm7Y0LuwC
=ekju
-END PGP SIGNATURE-
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] DSL support and luci integration

2012-11-27 Thread Frank Meerkötter
On 27/11/12 12:28, John Crispin wrote:
 On 27/11/12 12:23, Frank Meerkötter wrote:
 Hi,

 back in January there was a discussion on how to integrate DSL
 into Luci.

 https://lists.openwrt.org/pipermail/openwrt-devel/2012-January/013587.html

 A patch was presented which only got partially merged. The
 dsl_control.sh is there, the integration into the web-ui seems
 to be missing (AA  trunk).

 What happened to the web-ui part?
 
 got lost durig the release i guess
 
 would be nice if the webui part could be rebased and resubmitted

I'll look into it.

Frank

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


Re: [OpenWrt-Devel] DSL support and luci integration

2012-01-25 Thread Andrew Lyon
On Thu, Jan 19, 2012 at 8:51 PM,  lee.es...@nowonline.co.uk wrote:
 Hi,

 I've been using trunk on a Buffalo WBMR-HP-G300H ADSL router with great
 success, so I've been looking at the existing DSL support and am keen to
 help out getting it better integrated.

Could you explain or point me in the direction of documentation about
how you installed openwrt onto the WBMR-HP-G300H? I just got one to do
some testing with and have loaded dd-wrt, I have serial console
working and I think I can simply write the appropriate image to one of
the mtd devices but if you can detail how you did it it would be
helpful, and reduce the chances of me bricking the device.

The openwrt wiki has hardly any documentation about the WBMR-HP-G300H,
I will try to contribute some info...

Thanks
Andy



 I'm conscious that there are likely to be a number of different DSL devices
 needing support and have been thinking about a way to have relatively
 standard support in LuCI but with flexibility in implementation.

 I have put together some patches to start doing this, but thought it best to
 check the concepts before getting too far ... also I don't know if anyone
 else is working on this or if other ideas have been discussed.

 So basically:

 A single control script that is shipped as part of the relevant driver (or
 app) for the device. For me, this is the lantiq one.
 The control script (my suggestion is:  /etc/init.d/dsl_control) would be
 responsible for the normal start and stop as any rc script would be.
 But also ... the control script can be used to get the DSL status, either in
 human readable form, or in a standard form parsable by Luci.

 In this way any DSL implementation need only provide basic start, stop and
 status information and then it could easily appear in LuCI to provide line
 status, speed and noise information without any hardware specific detail in
 LuCI.

 Just by way of example:

 root@OpenWrt:~# /etc/init.d/dsl_control status
 Line State:             UP [0x801: showtime_tc_sync]
 Data Rate:              4.064 Mb/s / 448 Kb/s
 Line Attenuation:       49.0dB / 26.5dB
 Noise Margin:           12.2dB / 25.0dB

 Or, the LuCI compatible version ... I went for a loadstring approach that
 returned a lua table:

 root@OpenWrt:~# /etc/init.d/dsl_control luastat
 local dsl={}
 dsl.line_state_num=0x801
 dsl.line_state_detail=showtime_tc_sync
 dsl.line_state=UP
 dsl.data_rate_down=4064000
 dsl.data_rate_up=448000
 dsl.data_rate_down_s=4.064 Mb
 dsl.data_rate_up_s=448 Kb
 dsl.line_attenuation_down=49.0
 dsl.line_attenuation_up=26.5
 dsl.noise_margin_down=12.3
 dsl.noise_margin_up=25.0
 return dsl

 I've also implemented the basic summary in the LuCI admin overview page
 which looks pretty nice, updates regularly (you can see the noise margin
 changing) and doesn't seem to place much load on the system.

 There's a bit more to do, it currently doesn't actually check the daemon is
 running etc, also I think a start_available and stop_available variable
 might be a nice way to control whether LuCI should allow start and stop
 buttons ... possible on the network admin page?

 Anyway ... just a few ideas, interested in thoughts, I can post the current
 patches if there's interest, or happy to explore other ideas if I'm way off
 the mark.

 Cheers,

 Lee.

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


Re: [OpenWrt-Devel] DSL support and luci integration

2012-01-25 Thread Lee Essen
Hi Andy,

I posted a brief summary on the openwrt 'General' forum earlier today ... it's 
brief but will hopefully help. I've done 2 now, only bricked one (by 
experimenting) and the serial cable makes it pretty easy to recover.

Cheers,

Lee.


On 25 Jan 2012, at 22:01, Andrew Lyon andrew.l...@gmail.com wrote:

 On Thu, Jan 19, 2012 at 8:51 PM,  lee.es...@nowonline.co.uk wrote:
 Hi,
 
 I've been using trunk on a Buffalo WBMR-HP-G300H ADSL router with great
 success, so I've been looking at the existing DSL support and am keen to
 help out getting it better integrated.
 
 Could you explain or point me in the direction of documentation about
 how you installed openwrt onto the WBMR-HP-G300H? I just got one to do
 some testing with and have loaded dd-wrt, I have serial console
 working and I think I can simply write the appropriate image to one of
 the mtd devices but if you can detail how you did it it would be
 helpful, and reduce the chances of me bricking the device.
 
 The openwrt wiki has hardly any documentation about the WBMR-HP-G300H,
 I will try to contribute some info...
 
 Thanks
 Andy
 
 
 
 I'm conscious that there are likely to be a number of different DSL devices
 needing support and have been thinking about a way to have relatively
 standard support in LuCI but with flexibility in implementation.
 
 I have put together some patches to start doing this, but thought it best to
 check the concepts before getting too far ... also I don't know if anyone
 else is working on this or if other ideas have been discussed.
 
 So basically:
 
 A single control script that is shipped as part of the relevant driver (or
 app) for the device. For me, this is the lantiq one.
 The control script (my suggestion is:  /etc/init.d/dsl_control) would be
 responsible for the normal start and stop as any rc script would be.
 But also ... the control script can be used to get the DSL status, either in
 human readable form, or in a standard form parsable by Luci.
 
 In this way any DSL implementation need only provide basic start, stop and
 status information and then it could easily appear in LuCI to provide line
 status, speed and noise information without any hardware specific detail in
 LuCI.
 
 Just by way of example:
 
 root@OpenWrt:~# /etc/init.d/dsl_control status
 Line State: UP [0x801: showtime_tc_sync]
 Data Rate:  4.064 Mb/s / 448 Kb/s
 Line Attenuation:   49.0dB / 26.5dB
 Noise Margin:   12.2dB / 25.0dB
 
 Or, the LuCI compatible version ... I went for a loadstring approach that
 returned a lua table:
 
 root@OpenWrt:~# /etc/init.d/dsl_control luastat
 local dsl={}
 dsl.line_state_num=0x801
 dsl.line_state_detail=showtime_tc_sync
 dsl.line_state=UP
 dsl.data_rate_down=4064000
 dsl.data_rate_up=448000
 dsl.data_rate_down_s=4.064 Mb
 dsl.data_rate_up_s=448 Kb
 dsl.line_attenuation_down=49.0
 dsl.line_attenuation_up=26.5
 dsl.noise_margin_down=12.3
 dsl.noise_margin_up=25.0
 return dsl
 
 I've also implemented the basic summary in the LuCI admin overview page
 which looks pretty nice, updates regularly (you can see the noise margin
 changing) and doesn't seem to place much load on the system.
 
 There's a bit more to do, it currently doesn't actually check the daemon is
 running etc, also I think a start_available and stop_available variable
 might be a nice way to control whether LuCI should allow start and stop
 buttons ... possible on the network admin page?
 
 Anyway ... just a few ideas, interested in thoughts, I can post the current
 patches if there's interest, or happy to explore other ideas if I'm way off
 the mark.
 
 Cheers,
 
 Lee.
 
 ___
 openwrt-devel mailing list
 openwrt-devel@lists.openwrt.org
 https://lists.openwrt.org/mailman/listinfo/openwrt-devel
 ___
 openwrt-devel mailing list
 openwrt-devel@lists.openwrt.org
 https://lists.openwrt.org/mailman/listinfo/openwrt-devel
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] DSL support and luci integration

2012-01-23 Thread Florian Fainelli

Hello,

On 01/23/12 02:34, Philip Prindeville wrote:

On 1/21/12 1:18 AM, Lee Essen wrote:


On 20 Jan 2012, at 23:47, Philip Prindeville wrote:


I'd sure like to see netlink being used to communicate speed/carrier changes up 
into userspace.



Unfortunately there's absolutely no netlink support in the lantiq driver and I 
don't think any of that info is available elsewhere, I would have thought 
trying to add a netlink capability would be a bit extreme? (and probably well 
outside my capability) … and that would then need to be done for every 
subsequent DSL driver to maintain standardisation.

There is an ioctl interface, which also works without the daemon running, which 
I did consider, but my thought was that this would require an extra binary to 
maintain (unless there's a simple lua ioctl interface, but I couldn't find one) 
and would have a lot less transparency than a script -- but I'm happy to knock 
something up to make use of this if it's considered a better approach.

Regards,

Lee.


There aren't that many DSL flavors out there... Danube, Solos, Viking... that's 
probably 90% of the market I'm guessing.


You missed all the BCM63xx SoCs, which represent 90% of the DSL market 
actually, though their drivers are not opensource which is why people 
tend to forget about them.




Once it gets done for one architecture, I'm sure someone on the linux-atm 
mailing list would port it to others.  I might do it for the Solos if I have a 
working example of the netlink portion, then I can figure out how to 
interrogate the hardware for link quality changes.


Having a generic DSL stack in Linux will be quite some work from an 
acceptance perspective because:


- there are not only DSL ATM drivers in Linux (e.g: SoNET), and they 
need to be supported too by this stack


- there is only one modern DSL/ATM driver right now which is solos, I 
am not sure Lantiq has any plans for mainlining their driver, rewriting 
ar7-atm to fit into that model is also a lot of work


Anyway, if you got that way, I think you could use generic netlink in 
order to avoid the complexity of netlink and still have something useful.

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


Re: [OpenWrt-Devel] DSL support and luci integration

2012-01-23 Thread Philip Prindeville
On 1/23/12 2:38 AM, Florian Fainelli wrote:
 Hello,

 On 01/23/12 02:34, Philip Prindeville wrote:
 On 1/21/12 1:18 AM, Lee Essen wrote:
 On 20 Jan 2012, at 23:47, Philip Prindeville wrote:

 I'd sure like to see netlink being used to communicate speed/carrier 
 changes up into userspace.

 Unfortunately there's absolutely no netlink support in the lantiq driver 
 and I don't think any of that info is available elsewhere, I would have 
 thought trying to add a netlink capability would be a bit extreme? (and 
 probably well outside my capability) … and that would then need to be done 
 for every subsequent DSL driver to maintain standardisation.

 There is an ioctl interface, which also works without the daemon running, 
 which I did consider, but my thought was that this would require an extra 
 binary to maintain (unless there's a simple lua ioctl interface, but I 
 couldn't find one) and would have a lot less transparency than a script -- 
 but I'm happy to knock something up to make use of this if it's considered 
 a better approach.

 Regards,

 Lee.
 There aren't that many DSL flavors out there... Danube, Solos, Viking... 
 that's probably 90% of the market I'm guessing.
 You missed all the BCM63xx SoCs, which represent 90% of the DSL market 
 actually, though their drivers are not opensource which is why people 
 tend to forget about them.

 Once it gets done for one architecture, I'm sure someone on the linux-atm 
 mailing list would port it to others.  I might do it for the Solos if I have 
 a working example of the netlink portion, then I can figure out how to 
 interrogate the hardware for link quality changes.
 Having a generic DSL stack in Linux will be quite some work from an 
 acceptance perspective because:

There might be a miscommunication: I wasn't talking about rewriting the DSL 
stack, but merely adding instrumentation to the existing drivers that would 
message into user-space any line status changes.

-Philip


 - there are not only DSL ATM drivers in Linux (e.g: SoNET), and they 
 need to be supported too by this stack

 - there is only one modern DSL/ATM driver right now which is solos, I 
 am not sure Lantiq has any plans for mainlining their driver, rewriting 
 ar7-atm to fit into that model is also a lot of work

 Anyway, if you got that way, I think you could use generic netlink in 
 order to avoid the complexity of netlink and still have something useful.
 --
 Florian

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


Re: [OpenWrt-Devel] DSL support and luci integration

2012-01-23 Thread John Crispin

 There might be a miscommunication: I wasn't talking about rewriting the DSL 
 stack, but merely adding instrumentation to the existing drivers that would 
 message into user-space any line status changes.

 -Philip

ideally using netlink and having a iw/ip/... like userland tool

we should create a list of things that we want this api to be able to do.

and then make a spec for the kernel side and userland tool


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


Re: [OpenWrt-Devel] DSL support and luci integration

2012-01-23 Thread Philip Prindeville
On 1/23/12 11:47 AM, John Crispin wrote:
 
 There might be a miscommunication: I wasn't talking about rewriting the DSL 
 stack, but merely adding instrumentation to the existing drivers that would 
 message into user-space any line status changes.

 -Philip
 
 ideally using netlink and having a iw/ip/... like userland tool
 
 we should create a list of things that we want this api to be able to do.
 
 and then make a spec for the kernel side and userland tool

Yes, this is what I'm talking about:

If you look at some of the instrumentation that solos provides, this is a start:

drivers/atm/solos-attrlist.c

Of these, I'd pick:

DriverVersion
FirmwareVersion
Connected
OperationalMode
State
TxBitRate
RxBitRate
AnnexType
LocalEndLOS
LocalSNRMargin
LocalLineAttn
RawAttn
LocalTxPower
RemoteTxPower
RemoteSEF
RemoteLOS
RemoteLineAttn
RemoteSNRMargin
Retrain
LineMode
DetectNoise
SupportedAnnexes


There might be more than are useful, such as some of the Annex-specific stuff.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] DSL support and luci integration

2012-01-22 Thread Lee Essen
Ok, with a bit of further investigation, netlink doesn't actually seem too 
difficult … is there a process for registering new support (i.e. NETLINK_DSL) 
or is there some other way to do this?  Could something else be re-used?

I'm happy to have a go at a sample implementation, but I'm completely new to 
netlink, so a little help and a few pointers would be great.

Cheers,

Lee.


On 20 Jan 2012, at 23:47, Philip Prindeville wrote:

 I'd sure like to see netlink being used to communicate speed/carrier changes 
 up into userspace.
 
 
 On 1/20/12 12:20 AM, Lee Essen wrote:
 
 On 19 Jan 2012, at 22:17, John Crispin wrote:
 
 
 
 Anyway ... just a few ideas, interested in thoughts, I can post the
 current patches if there's interest, or happy to explore other ideas if
 I'm way off the mark.
 
 sure, show us your patch please ;)
 ___
 
 Ok, these aren't in the right format for a couple of reasons (namely that I 
 haven't got a LuCI tree checked out yet, and that I'm still working on the 
 main script and haven't put it back into the main tree), but hopefully this 
 will give you a feel for what I'm talking about….
 
 Firstly the main dsl_control script (/etc/init.d/dsl_control) … used to 
 stop/start and provide hardware specific stats, this is still work in 
 progress, I'll tidy it up and add more functionality (and error checking) 
 over the next couple of days, and build a proper patch...
 [snip]
 ___
 openwrt-devel mailing list
 openwrt-devel@lists.openwrt.org
 https://lists.openwrt.org/mailman/listinfo/openwrt-devel

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


Re: [OpenWrt-Devel] DSL support and luci integration

2012-01-22 Thread Philip Prindeville
On 1/21/12 1:18 AM, Lee Essen wrote:
 
 On 20 Jan 2012, at 23:47, Philip Prindeville wrote:
 
 I'd sure like to see netlink being used to communicate speed/carrier changes 
 up into userspace.

 
 Unfortunately there's absolutely no netlink support in the lantiq driver and 
 I don't think any of that info is available elsewhere, I would have thought 
 trying to add a netlink capability would be a bit extreme? (and probably well 
 outside my capability) … and that would then need to be done for every 
 subsequent DSL driver to maintain standardisation.
 
 There is an ioctl interface, which also works without the daemon running, 
 which I did consider, but my thought was that this would require an extra 
 binary to maintain (unless there's a simple lua ioctl interface, but I 
 couldn't find one) and would have a lot less transparency than a script -- 
 but I'm happy to knock something up to make use of this if it's considered a 
 better approach.
 
 Regards,
 
 Lee.

There aren't that many DSL flavors out there... Danube, Solos, Viking... that's 
probably 90% of the market I'm guessing.

Once it gets done for one architecture, I'm sure someone on the linux-atm 
mailing list would port it to others.  I might do it for the Solos if I have a 
working example of the netlink portion, then I can figure out how to 
interrogate the hardware for link quality changes.

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


Re: [OpenWrt-Devel] DSL support and luci integration

2012-01-22 Thread Philip Prindeville
You probably want to go through 'netdev' (net...@vger.kernel.org) for changes 
to Netlink.


On 1/22/12 10:35 AM, Lee Essen wrote:
 Ok, with a bit of further investigation, netlink doesn't actually seem too 
 difficult … is there a process for registering new support (i.e. NETLINK_DSL) 
 or is there some other way to do this?  Could something else be re-used?
 
 I'm happy to have a go at a sample implementation, but I'm completely new to 
 netlink, so a little help and a few pointers would be great.
 
 Cheers,
 
 Lee.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] DSL support and luci integration

2012-01-21 Thread Lee Essen

On 20 Jan 2012, at 23:47, Philip Prindeville wrote:

 I'd sure like to see netlink being used to communicate speed/carrier changes 
 up into userspace.
 

Unfortunately there's absolutely no netlink support in the lantiq driver and I 
don't think any of that info is available elsewhere, I would have thought 
trying to add a netlink capability would be a bit extreme? (and probably well 
outside my capability) … and that would then need to be done for every 
subsequent DSL driver to maintain standardisation.

There is an ioctl interface, which also works without the daemon running, which 
I did consider, but my thought was that this would require an extra binary to 
maintain (unless there's a simple lua ioctl interface, but I couldn't find one) 
and would have a lot less transparency than a script -- but I'm happy to knock 
something up to make use of this if it's considered a better approach.

Regards,

Lee.

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


Re: [OpenWrt-Devel] DSL support and luci integration

2012-01-21 Thread John Crispin
On 21/01/12 09:18, Lee Essen wrote:
 
 On 20 Jan 2012, at 23:47, Philip Prindeville wrote:
 
 I'd sure like to see netlink being used to communicate speed/carrier changes 
 up into userspace.

 
 Unfortunately there's absolutely no netlink support in the lantiq driver and 
 I don't think any of that info is available elsewhere, I would have thought 
 trying to add a netlink capability would be a bit extreme? (and probably well 
 outside my capability) … and that would then need to be done for every 
 subsequent DSL driver to maintain standardisation.
 
 There is an ioctl interface, which also works without the daemon running, 
 which I did consider, but my thought was that this would require an extra 
 binary to maintain (unless there's a simple lua ioctl interface, but I 
 couldn't find one) and would have a lot less transparency than a script -- 
 but I'm happy to knock something up to make use of this if it's considered a 
 better approach.
 

as far as i can tell the patch looks fine.


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


Re: [OpenWrt-Devel] DSL support and luci integration

2012-01-20 Thread Philip Prindeville
I'd sure like to see netlink being used to communicate speed/carrier changes up 
into userspace.


On 1/20/12 12:20 AM, Lee Essen wrote:
 
 On 19 Jan 2012, at 22:17, John Crispin wrote:
 


 Anyway ... just a few ideas, interested in thoughts, I can post the
 current patches if there's interest, or happy to explore other ideas if
 I'm way off the mark.

 sure, show us your patch please ;)
 ___
 
 Ok, these aren't in the right format for a couple of reasons (namely that I 
 haven't got a LuCI tree checked out yet, and that I'm still working on the 
 main script and haven't put it back into the main tree), but hopefully this 
 will give you a feel for what I'm talking about….
 
 Firstly the main dsl_control script (/etc/init.d/dsl_control) … used to 
 stop/start and provide hardware specific stats, this is still work in 
 progress, I'll tidy it up and add more functionality (and error checking) 
 over the next couple of days, and build a proper patch...
 [snip]
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] DSL support and luci integration

2012-01-19 Thread lee . essen

Hi,

I've been using trunk on a Buffalo WBMR-HP-G300H ADSL router with great 
success, so I've been looking at the existing DSL support and am keen to 
help out getting it better integrated.


I'm conscious that there are likely to be a number of different DSL 
devices needing support and have been thinking about a way to have 
relatively standard support in LuCI but with flexibility in 
implementation.


I have put together some patches to start doing this, but thought it 
best to check the concepts before getting too far ... also I don't know 
if anyone else is working on this or if other ideas have been discussed.


So basically:

A single control script that is shipped as part of the relevant 
driver (or app) for the device. For me, this is the lantiq one.
The control script (my suggestion is:  /etc/init.d/dsl_control) would 
be responsible for the normal start and stop as any rc script would be.
But also ... the control script can be used to get the DSL status, 
either in human readable form, or in a standard form parsable by Luci.


In this way any DSL implementation need only provide basic start, stop 
and status information and then it could easily appear in LuCI to 
provide line status, speed and noise information without any hardware 
specific detail in LuCI.


Just by way of example:

root@OpenWrt:~# /etc/init.d/dsl_control status
Line State: UP [0x801: showtime_tc_sync]
Data Rate:  4.064 Mb/s / 448 Kb/s
Line Attenuation:   49.0dB / 26.5dB
Noise Margin:   12.2dB / 25.0dB

Or, the LuCI compatible version ... I went for a loadstring approach 
that returned a lua table:


root@OpenWrt:~# /etc/init.d/dsl_control luastat
local dsl={}
dsl.line_state_num=0x801
dsl.line_state_detail=showtime_tc_sync
dsl.line_state=UP
dsl.data_rate_down=4064000
dsl.data_rate_up=448000
dsl.data_rate_down_s=4.064 Mb
dsl.data_rate_up_s=448 Kb
dsl.line_attenuation_down=49.0
dsl.line_attenuation_up=26.5
dsl.noise_margin_down=12.3
dsl.noise_margin_up=25.0
return dsl

I've also implemented the basic summary in the LuCI admin overview page 
which looks pretty nice, updates regularly (you can see the noise margin 
changing) and doesn't seem to place much load on the system.


There's a bit more to do, it currently doesn't actually check the 
daemon is running etc, also I think a start_available and 
stop_available variable might be a nice way to control whether LuCI 
should allow start and stop buttons ... possible on the network admin 
page?


Anyway ... just a few ideas, interested in thoughts, I can post the 
current patches if there's interest, or happy to explore other ideas if 
I'm way off the mark.


Cheers,

Lee.

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


Re: [OpenWrt-Devel] DSL support and luci integration

2012-01-19 Thread John Crispin

 
 Anyway ... just a few ideas, interested in thoughts, I can post the
 current patches if there's interest, or happy to explore other ideas if
 I'm way off the mark.

sure, show us your patch please ;)
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] DSL support and luci integration

2012-01-19 Thread Lee Essen

On 19 Jan 2012, at 22:17, John Crispin wrote:

 
 
 Anyway ... just a few ideas, interested in thoughts, I can post the
 current patches if there's interest, or happy to explore other ideas if
 I'm way off the mark.
 
 sure, show us your patch please ;)
 ___

Ok, these aren't in the right format for a couple of reasons (namely that I 
haven't got a LuCI tree checked out yet, and that I'm still working on the main 
script and haven't put it back into the main tree), but hopefully this will 
give you a feel for what I'm talking about….

Firstly the main dsl_control script (/etc/init.d/dsl_control) … used to 
stop/start and provide hardware specific stats, this is still work in progress, 
I'll tidy it up and add more functionality (and error checking) over the next 
couple of days, and build a proper patch...

#!/bin/sh /etc/rc.common
# Copyright (C) 2008 OpenWrt.org
START=99

EXTRA_COMMANDS=status luastat
EXTRA_HELP=status  Get DSL status information
lustat  Get status information if lua friendly format 

#
# Basic functions to send CLI commands to the dsl_cpe_control daemon
#
dsl_cmd() {
echo $@  /tmp/pipe/dsl_cpe0_cmd
cat /tmp/pipe/dsl_cpe0_ack
}
dsl_val() {
echo $(expr $1 : '.*'$2'=\([[:alnum:]]*\).*')
}

#
# Simple divide by 10 routine to cope with one decimal place
#
dbt() {
local a=$(expr $1 / 10)
local b=$(expr $1 % 10)
echo ${a}.${b}
}
#
# Take a number and convert to k or meg
#
scale() {
local val=$1
local a
local b

if [ $val -gt 100 ]; then
a=$(expr $val / 1000)
b=$(expr $a % 1000)
a=$(expr $a / 1000)
printf %d.%03d Mb ${a} ${b}
elif [ $val -gt 1000 ]; then
a=$(expr $val / 1000)
printf %d Kb ${a}
else
echo ${val} b
fi
}


start() {

# start CPE dsl daemon in the background
/sbin/dsl_cpe_control -i \
-n /sbin/dsl_notify.sh \
-f /lib/firmware/ModemHWE.bin 

#   PS=`ps`
#   echo $PS | grep -q dsl_cpe_control  {
#   # workaround for nfs: allow write to pipes for non-root
#   while [ ! -e /tmp/pipe/dsl_cpe1_ack ] ; do sleep 1; done
#   chmod a+w /tmp/pipe/dsl_*
#   }
echo $PS | grep -q dsl_cpe_control || {
echo Start of dsl_cpe_control failed!!!
false
}
}




data_rates() {
local csg
local dru
local drd
local sdru
local sdrd

csg=$(dsl_cmd g997csg 0 1)
drd=$(dsl_val $csg ActualDataRate)

csg=$(dsl_cmd g997csg 0 0)
dru=$(dsl_val $csg ActualDataRate)

sdrd=$(scale $drd)
sdru=$(scale $dru)

if [ $action = luastat ]; then
echo dsl.data_rate_down=$drd
echo dsl.data_rate_up=$dru
echo dsl.data_rate_down_s=\$sdrd\
echo dsl.data_rate_up_s=\$sdru\
else
echo Data Rate:${sdrd}/s / ${sdru}/s
fi
}

line_data() {
local lsg
local latnu
local latnd
local snru
local snrd

lsg=$(dsl_cmd g997lsg 1 1)
latnd=$(dsl_val $lsg LATN)
snrd=$(dsl_val $lsg SNR)

lsg=$(dsl_cmd g997lsg 0 1)
latnu=$(dsl_val $lsg LATN)
snru=$(dsl_val $lsg SNR)

latnd=$(dbt $latnd)
latnu=$(dbt $latnu)
snrd=$(dbt $snrd)
snru=$(dbt $snru)

if [ $action = luastat ]; then
echo dsl.line_attenuation_down=$latnd
echo dsl.line_attenuation_up=$latnu
echo dsl.noise_margin_down=$snrd
echo dsl.noise_margin_up=$snru
else
echo Line Attenuation: ${latnd}dB / ${latnu}dB
echo Noise Margin: ${snrd}dB / ${snru}dB
fi
}


line_state() {
local lsg=$(dsl_cmd lsg)
local ls=$(dsl_val $lsg nLineState);
local s;


case $ls in
0x0)  s=not initialized ;;
0x1)  s=exception ;;
0x10) s=not updated ;;
0xff) s=idle request ;;
0x100)s=idle ;;
0x1ff)s=silent request ;;
0x200)s=silent ;;
0x300)s=handshake ;;
0x380)s=full_init ;;
0x400)s=discovery ;;
0x500)s=training ;;
0x600)s=analysis ;;
0x700)s=exchange ;;
0x800)s=showtime_no_sync ;;
0x801)s=showtime_tc_sync ;;
0x900)s=fastretrain ;;
0xa00)