Reply
Thread Tools
qole's Avatar
Moderator | Posts: 7,109 | Thanked: 8,820 times | Joined on Oct 2007 @ Vancouver, BC, Canada
#21
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...
__________________
qole.org --- twitter --- Easy Debian wiki page
Please don't send me a private message, post to the appropriate thread.
Thank you all for your donations!
 
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#22
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.

Last edited by qwerty12; 2009-09-25 at 06:28.
 

The Following User Says Thank You to qwerty12 For This Useful Post:
Posts: 2,802 | Thanked: 4,491 times | Joined on Nov 2007
#23
Originally Posted by qole View Post
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") :-)

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"
 

The Following 5 Users Say Thank You to lma For This Useful Post:
qole's Avatar
Moderator | Posts: 7,109 | Thanked: 8,820 times | Joined on Oct 2007 @ Vancouver, BC, Canada
#24
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...
__________________
qole.org --- twitter --- Easy Debian wiki page
Please don't send me a private message, post to the appropriate thread.
Thank you all for your donations!
 
thp's Avatar
Posts: 1,391 | Thanked: 4,272 times | Joined on Sep 2007 @ Vienna, Austria
#25
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.

 

The Following 3 Users Say Thank You to thp For This Useful Post:
zerojay's Avatar
Posts: 2,669 | Thanked: 2,555 times | Joined on Apr 2007 @ Halifax, Nova Scotia, Canada
#26
Originally Posted by thp View Post
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.

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.
 
Posts: 547 | Thanked: 1,383 times | Joined on Sep 2009 @ Stockholm, Sweden
#27
Originally Posted by zerojay View Post
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.


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...
__________________

Problem with fMMS? Run in x-terminal: cp /tmp/fmms.log /home/user/MyDocs/
After that you'll see fmms.log in filemanager or when you connect the device to your desktop as a mass storage device.
E-mail the log to me, if you don't have the email address, drop me a PM. Thanks!

fMMS - MMS for your N900
fAPN - GUI for adding a new GPRS APN
If you like this post, don't be shy to thank me -->
 
qole's Avatar
Moderator | Posts: 7,109 | Thanked: 8,820 times | Joined on Oct 2007 @ Vancouver, BC, Canada
#28
Originally Posted by lma View Post
... 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?
__________________
qole.org --- twitter --- Easy Debian wiki page
Please don't send me a private message, post to the appropriate thread.
Thank you all for your donations!
 
allnameswereout's Avatar
Posts: 3,397 | Thanked: 1,212 times | Joined on Jul 2008 @ Netherlands
#29
Originally Posted by qole View Post
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.
__________________
Goosfraba! All text written by allnameswereout is public domain unless stated otherwise. Thank you for sharing your output!

Last edited by allnameswereout; 2009-09-25 at 18:49.
 
qole's Avatar
Moderator | Posts: 7,109 | Thanked: 8,820 times | Joined on Oct 2007 @ Vancouver, BC, Canada
#30
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.
__________________
qole.org --- twitter --- Easy Debian wiki page
Please don't send me a private message, post to the appropriate thread.
Thank you all for your donations!

Last edited by qole; 2009-09-25 at 21:57.
 
Reply

Tags
cellular, data, widget proposal


 
Forum Jump


All times are GMT. The time now is 13:12.