maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Maemo 5 / Fremantle (https://talk.maemo.org/forumdisplay.php?f=40)
-   -   Widget Proposal: Cellular Bandwidth Monitor (https://talk.maemo.org/showthread.php?t=32047)

qole 2009-09-25 06:07

Re: Widget Proposal: Cellular Bandwidth Monitor
 
OT and banging my own drum:

Here's how to get the IP address for your device, whether you are on wlan, gprs, or adhoc.

Code:

/sbin/ifconfig | grep "Mask:255.2" | cut -21-40 | tr -d " BcastP-\:"
I guess I could start another thread... Or start a Brainstorm idea... But I just want to know my IP address... :(

qwerty12 2009-09-25 06:24

Re: Widget Proposal: Cellular Bandwidth Monitor
 
FWIW, the CPA retrieves those "Data Rx/Tx" values from some GConf keys.
For fear of getting lynched by Nokia, I won't say which, but it's not hard to find the keys in question.

lma 2009-09-25 09:29

Re: Widget Proposal: Cellular Bandwidth Monitor
 
Quote:

Originally Posted by qole (Post 333385)
Here's how to get the IP address for your device, whether you are on wlan, gprs, or adhoc.

Code:

/sbin/ifconfig | grep "Mask:255.2" | cut -21-40 | tr -d " BcastP-\:"

This will break if you are on a /10 or larger subnet, better to say what you mean ("fgrep -v 127.0.0.1") :-)

Quote:

But I just want to know my IP address...
A shorter pipeline:
Code:

/sbin/ifconfig | sed -n -e "/127\.0\.0\.1/d" -e "s/^.*addr:\([0-9.]*\).*$/\1/p"
but this would also break if you are multi-homed (no idea if that will be supported in Fremantle, but you never know), in which case you probably want the IP address of the default route interface:

Code:

ip addr list dev `ip route list exact 0/0 | cut -d" " -f5` | \
  sed -ne "s/^.*inet \([0-9.]*\).*$/\1/p"


qole 2009-09-25 16:58

Re: Widget Proposal: Cellular Bandwidth Monitor
 
Thanks, lma.

All I knew is that the diablo homeip widget doesn't work for ad-hoc, and mine does. Plus it works for all of my Fremantle use-cases...

thp 2009-09-25 17:10

Re: Widget Proposal: Cellular Bandwidth Monitor
 
I've written something like that as statusbar applet for the Linux Desktop and OS2008 that screenscrapes my cellular operator's website and displays the data/voice usage:

http://thpinfo.com/2009/naranjito/

This currently only works for one operator, but could of course be extended to operators which allow the traffic to be seen from some (login-protected) website. Of course, modifying it to be a desktop widget should not be too hard, also...

The code is open source and available from the website.

http://thpinfo.com/2009/naranjito/naranjito-maemo.png

zerojay 2009-09-25 17:13

Re: Widget Proposal: Cellular Bandwidth Monitor
 
Quote:

Originally Posted by thp (Post 333672)
I've written something like that as statusbar applet for the Linux Desktop and OS2008 that screenscrapes my cellular operator's website and displays the data/voice usage:

http://thpinfo.com/2009/naranjito/

This currently only works for one operator, but could of course be extended to operators which allow the traffic to be seen from some (login-protected) website. Of course, modifying it to be a desktop widget should not be too hard, also...

The code is open source and available from the website.

http://thpinfo.com/2009/naranjito/naranjito-maemo.png

While that's cool and thanks for showing it, I find it somewhat ironic that to find out how much bandwidth you've used, you've gotta use more. ;)

frals 2009-09-25 17:55

Re: Widget Proposal: Cellular Bandwidth Monitor
 
Quote:

Originally Posted by zerojay (Post 333673)
While that's cool and thanks for showing it, I find it somewhat ironic that to find out how much bandwidth you've used, you've gotta use more. ;)

:D

Most operators (atleast here in .se) won't tax you for surfing on their own page. :)

/me waits for his isp (cellphone service provider? geh, isp sounds better) to implement a statistics page to scrape... ;)

qole 2009-09-25 18:30

Re: Widget Proposal: Cellular Bandwidth Monitor
 
Quote:

Originally Posted by lma (Post 333447)
... in which case you probably want the IP address of the default route interface:

Code:

ip addr list dev `ip route list exact 0/0 | cut -d" " -f5` | \
  sed -ne "s/^.*inet \([0-9.]*\).*$/\1/p"


There's no ip command... Where would I get it?

allnameswereout 2009-09-25 18:38

Re: Widget Proposal: Cellular Bandwidth Monitor
 
Quote:

Originally Posted by qole (Post 333715)
There's no ip command... Where would I get it?

You need to install iproute2 and sed

iproute2 is excellent software btw. Much more convenient than /sbin/route and /sbin/ifconfig it saves a lot of typing and is easier to parse, supports ipv6, etc.

Excellent, lma.

I found vnStat a lightweight network traffic monitor. Does not require sniffer. It comes with init.d script. You will need to use the daemon because you use ppp0 (akin to dialup) hence the device (with statistics) goes down every once in a while. It compiles on ARM.

qole 2009-09-25 21:49

Re: Widget Proposal: Cellular Bandwidth Monitor
 
no such package as "iproute" or "iproute2" in the repositories.

EDIT: checked gronmayer; nothing for Diablo either. Debian has it, maybe I can steal it from there.


All times are GMT. The time now is 05:34.

vBulletin® Version 3.8.8