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)

zerojay 2009-09-24 19:29

Widget Proposal: Cellular Bandwidth Monitor
 
Since the N900 now has a cellular modem and it's an internet tablet, users are very likely to use a lot of bandwidth. It would be nice to have a small widget that displays your current amounts of transmitted and received data that can be placed anywhere on your Maemo 5 desktop. Some of us can't get those fancy unlimited data plans. ;)

Because I'm such a great ASCII artist, here's how I imagine it.

Code:

+--------------------------+
| Cellular Data Connection |
| Transmitted:    45.43MB |
| Received:      443.92MB |
+--------------------------+

While yes, you can just look at a dialog box buried within the Control Panel to see the info needed, it's just much simpler this way.

Potential programmers/widget makers, you can retrieve the data for the phone's data connection through /proc/net/dev. The connection name whose data we are interested in is named phonet0 within /proc/net/dev and is accessible without root.

What do you guys think? Does it need anything? Is there something I forgot about? Anyone interested in helping make this a reality? It would probably take you only an afternoon. ;)

Brainstorm Link: http://maemo.org/community/brainstor...users_to_find/

qole 2009-09-24 19:36

Re: Widget Proposal: Cellular Bandwidth Monitor
 
I think its a great idea. Please implement!

Also, I want the homeIP widget in Maemo 5.

edgar2 2009-09-24 19:39

Re: Widget Proposal: Cellular Bandwidth Monitor
 
if this was a brainstorm idea, and the problem was "hard to keep track of data transfer in cases where it costs by the byte", i would add another 'solution': create a possibility to get notifications when x, y, & z amount of bytes have been transferred.

that would have saved me nearly 500e this summer when roaming.

jandmdickerson 2009-09-24 19:57

Re: Widget Proposal: Cellular Bandwidth Monitor
 
Can we get a reset button (like an odometer trip A and B button?) so we can start counting at the beginning of our next billing cycle?

eiffel 2009-09-24 20:02

Re: Widget Proposal: Cellular Bandwidth Monitor
 
Great idea! I would also like to see it display the date of the last reset. Maybe even an option to automatically keep track of the consumption from the start of each day or month, since many data plans have daily or monthly limits.

pelago 2009-09-24 20:03

Re: Widget Proposal: Cellular Bandwidth Monitor
 
Yes, a widget is a great idea, but even better if it's combined with a more full-featured app, with notifications, graphs of usage over time, and so on.

zerojay 2009-09-24 20:04

Re: Widget Proposal: Cellular Bandwidth Monitor
 
Quote:

Originally Posted by jandmdickerson (Post 333120)
Can we get a reset button (like an odometer trip A and B button?) so we can start counting at the beginning of our next billing cycle?

That's a function I would be too worried I'd hit accidentally if it's just on the desktop... but it could be in the widget configuration as an option. Also, resetting the number is supported from the control panel.

Quote:

Originally Posted by pelago (Post 333122)
Yes, a widget is a great idea, but even better if it's combined with a more full-featured app, with notifications, graphs of usage over time, and so on.

I can agree with you, but let's start with something smaller first and see how it goes from there. I'd much rather have this ready ASAP for release than have to wait for a full app to be written first.

Saturn 2009-09-24 20:04

Re: Widget Proposal: Cellular Bandwidth Monitor
 
For OS2008 there is TrafficCounter applet. I find it quite nice.
It has reset buttons for both total and current session counters and at the moment checks the wifi and the bluetooth.

Maybe someone could help the developer find where to check for this info too?

timsamoff 2009-09-24 20:15

Re: Widget Proposal: Cellular Bandwidth Monitor
 
Zerojay, please add this to the Brainstorm! :D

Tim

zerojay 2009-09-24 20:18

Re: Widget Proposal: Cellular Bandwidth Monitor
 
Quote:

Originally Posted by timsamoff (Post 333127)
Zerojay, please add this to the Brainstorm! :D

Tim

I wasn't sure if I should because it seems Brainstorm is more for overarching problems and solutions to them whereas this sort of thing is so small that any competent programmer - which I am not - can knock out in a night, easily.

But if you insist... adding it now.

See the first post in the thread for the link to Brainstorm.

allnameswereout 2009-09-24 20:45

Re: Widget Proposal: Cellular Bandwidth Monitor
 
Keep in mind not every MB is a MB. As in, if you have a FUP, you care less for a MB than when you are roaming. Ideally, an application knows the roaming costs of the provider you are. BTW, as of now this info should be easy to get from /sbin/ifconfig ppp0 there are some Linux software for this too but they basically poll /sbin/ifconfig ppp0 every X minutes and calculate the difference. My S60 phone keeps track of this by itself. Maybe Maemo does too. Then you'd only have to parse that data.

zerojay 2009-09-24 21:23

Re: Widget Proposal: Cellular Bandwidth Monitor
 
Quote:

Originally Posted by allnameswereout (Post 333157)
Keep in mind not every MB is a MB. As in, if you have a FUP, you care less for a MB than when you are roaming. Ideally, an application knows the roaming costs of the provider you are. BTW, as of now this info should be easy to get from /sbin/ifconfig ppp0 there are some Linux software for this too but they basically poll /sbin/ifconfig ppp0 every X minutes and calculate the difference. My S60 phone keeps track of this by itself. Maybe Maemo does too. Then you'd only have to parse that data.

ifconfig is inaccessable unless you are root and that's not a good idea. /proc/net/dev gives you the same info for free.

qole 2009-09-24 21:30

Re: Widget Proposal: Cellular Bandwidth Monitor
 
Quote:

Originally Posted by jandmdickerson (Post 333120)
Can we get a reset button (like an odometer trip A and B button?) so we can start counting at the beginning of our next billing cycle?

Quote:

Originally Posted by zerojay (Post 333123)
That's a function I would be too worried I'd hit accidentally if it's just on the desktop...

I can vouch for the fact that it is a problem.

Tip to designers: Don't put a big "Reset" button beside your data counter, and if you do, at least have a second "Are you sure?" dialogue.

qole 2009-09-24 21:31

Re: Widget Proposal: Cellular Bandwidth Monitor
 
zerojay: In Brainstorm, you phrase your initial post as a problem, and then you have to post a solution to your problem, otherwise we can't vote on it.

zerojay 2009-09-24 21:38

Re: Widget Proposal: Cellular Bandwidth Monitor
 
Quote:

Originally Posted by qole (Post 333177)
zerojay: In Brainstorm, you phrase your initial post as a problem, and then you have to post a solution to your problem, otherwise we can't vote on it.

And that's why I didn't post it there from the start. ;)

I'll fix it in a bit.

code177 2009-09-24 21:43

Re: Widget Proposal: Cellular Bandwidth Monitor
 
As a resident of Canada I'm subjected to our telco's bankrupting data rates. I'm sure I speak for everyone in this country when I say this widget isn't just a great idea, it should come with the device as standard...

lma 2009-09-24 22:28

Re: Widget Proposal: Cellular Bandwidth Monitor
 
Quote:

Originally Posted by zerojay (Post 333169)
ifconfig is inaccessable unless you are root

Only because it's not in user's $PATH in Maemo (but one can always use the full pathname, or "busybox ifconfig"), it doesn't require any special privileges

Quote:

/proc/net/dev gives you the same info for free.
and that's exactly where ifconfig gets the stats from too.

qole 2009-09-24 23:07

Re: Widget Proposal: Cellular Bandwidth Monitor
 
I've already voted (thumbs up!) on the new idea.

zerojay 2009-09-24 23:11

Re: Widget Proposal: Cellular Bandwidth Monitor
 
I have also added an alternative solution to the idea that you may want to check out. I've also added the proper link to the brainstorm in the first post.

Jack6428 2009-09-24 23:14

Re: Widget Proposal: Cellular Bandwidth Monitor
 
i guess you should give it a shot

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.

allnameswereout 2009-09-25 22:09

Re: Widget Proposal: Cellular Bandwidth Monitor
 
Not available for Fremantle, only Diablo... :(

http://repository.maemo.org/pool/mae...ree/i/iproute/
http://repository.maemo.org/extras/p...free/i/iptraf/

qole 2009-09-25 22:22

Re: Widget Proposal: Cellular Bandwidth Monitor
 
maemo4.1.2? That's an odd repository path. SDK, maybe? Hmm.

Also, will iptraf do the job?

allnameswereout 2009-09-25 23:39

Re: Widget Proposal: Cellular Bandwidth Monitor
 
4.1.2 is just last SSU.

I just tried IPtraf together with BlueTooth DUN (ppp0), and while the last update of software is from 2005 I believe IPtraf will work.

By default its ncurses but you can run it in background. You can let it monitor ppp0 only, and it will save its logs, until you say it should ignore it.

But that other piece of software is maintained and can save for day/week/month.

All what this software does is check /proc/net/dev ppp0 Rx bytes and Tx bytes and write this to log file. Then you only need a parser, and keep into account there is sometimes a reboot or reset because counters are 32 bit. So if new value is less than old you add old + new. Thats all.

What is also interesting is a userspace accounting daemon (example), but then you use IPTables, and thats overkill. However people are probably going to use QoS on their N900, and using this you can do accounting per process.

lma 2009-09-25 23:42

Re: Widget Proposal: Cellular Bandwidth Monitor
 
Quote:

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

Hm, it seems to have come from the official repository here:

Code:

Nokia-N810-43-7:~# dpkg -S /bin/ip
iproute: /bin/ip
Nokia-N810-43-7:~# apt-cache policy iproute
iproute:
  Installed: 20070313-1ubuntu1-osso3
  Candidate: 20070313-1ubuntu1-osso3
  Version table:
 *** 20070313-1ubuntu1-osso3 0
        500 http://catalogue.tableteer.nokia.com ./ Packages
        100 /var/lib/dpkg/status

It probably won't show up in application manager, but try apt-get install-ing it.

lma 2009-09-25 23:46

Re: Widget Proposal: Cellular Bandwidth Monitor
 
Quote:

Originally Posted by allnameswereout (Post 333897)
Not available for Fremantle, only Diablo... :(

True, but there was no real compelling reason to have it in alpha/beta releases. I think we may still get it (or the busybox equivalent) in the release version.

zerojay 2009-09-29 12:46

Re: Widget Proposal: Cellular Bandwidth Monitor
 
Good news. I've found a developer that's interested in making the Cell use widget for us. Initially being very simple so that it could be ready in time for the N900's release, potentially growing to having more features later on down the line.

zerojay 2009-09-30 14:13

Re: Widget Proposal: Cellular Bandwidth Monitor
 
Further good news... he's pushed a first version of the widget to me. It works with a few minor changes needed. There's little doubt in my mind that the widget will be completely ready for primetime and within Maemo Extras soon.

I'll keep you all posted.

zerojay 2009-09-30 18:00

Re: Widget Proposal: Cellular Bandwidth Monitor
 
First release has been put out by fiferboy a few minutes ago: http://talk.maemo.org/showthread.php...895#post336895

r0eladn 2009-10-03 03:51

Re: Widget Proposal: Cellular Bandwidth Monitor
 
1. great idea
2. could combine this and cell phone minutes use in one widget?
3. next to the reset option, make it adjustable at what day of the month the new cycle begins. (f.e. currently my cycle begins the 14th, so the phone could reset the stuff/update the new amount automatically.
4. be able to set up stuff like minutes that you can take with you to the next month
or bandwitdth to take to the next month
(my provider lets me take my old minutes, and maybe some providers let you take you old unused bandwidth to the next month(or sometimes even 2 or more))
5. amount of $/euros you are over your 'bundle')

just my thoughts

qole 2009-10-03 06:18

Re: Widget Proposal: Cellular Bandwidth Monitor
 
Looks great. And I'm having a hard time making it to 250MB in a month (half of my 500 MB plan limit), so I think I'll start streaming Internet radio on the bus...


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

vBulletin® Version 3.8.8