Page 1 of 3

Problem with Blinky

Posted: Fri 03 Feb 2006, 08:59
by BarryK
I've started this thread so hacking Blinky can be coordinated.
Anyone who wants to fix the problem can let the rest of us know, so we don't get 3 or 4 people simultaneously working on the same problem.
(well, I hope we do get one volunteer!)

The problem is described in the Developer News page for Jan. 3:
http://www.puppylinux.com/news.htm

Posted: Fri 03 Feb 2006, 09:10
by MU
I use adsl, and your blinky-binary works.
It blinks blue and green.
I run it from a xterm in Fluxbox.

Code: Select all

# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:50:EB:0B:95:AD  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:33952 errors:0 dropped:0 overruns:0 frame:0
          TX packets:35465 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:18134355 (17.2 MiB)  TX bytes:5764284 (5.4 MiB)
          Interrupt:11 Base address:0xcc00 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:208229 errors:0 dropped:0 overruns:0 frame:0
          TX packets:208229 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:85177618 (81.2 MiB)  TX bytes:85177618 (81.2 MiB)

ppp0      Link encap:Point-Point Protocol  
          inet addr:213.39.230.56  P-t-P:213.191.84.196  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1492  Metric:1
          RX packets:32299 errors:0 dropped:0 overruns:0 frame:0
          TX packets:33812 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3 
          RX bytes:17324510 (16.5 MiB)  TX bytes:4970757 (4.7 MiB)

# dmesg |grep eth
eth0: Realtek RTL8201 PHY transceiver found at address 1.
eth0: Using transceiver found at address 1 as default
eth0: SiS 900 PCI Fast Ethernet at 0xcc00, IRQ 11, 00:50:eb:0b:95:ad.
eth0: Media Link On 100mbps full-duplex 
# 
Mark

Posted: Fri 03 Feb 2006, 11:27
by jcoder24-guest
With your ifconfig I believe blinky is most likely using the ppp0 interface instead of the eth0.

Posted: Fri 03 Feb 2006, 11:40
by GuestToo
it seems to work ok with my adsl ... it blinks green and blue, anyway

i am connecting directly using Roaring Penguin, so my interface is ppp0

if i were connecting using adsl through a router, my interface would be eth0, and it would be setup in the network wizard using dhcp

Posted: Fri 03 Feb 2006, 11:42
by MU
oh yes, you are right... My fault :oops:
I use adsl-start , that uses /etc/ppp/pppoe.conf.

Mark

Posted: Fri 03 Feb 2006, 12:38
by BarryK
Yeah, I get the problem when only eth0 is up.

The info is definitely there in /proc/net/dev, the C file that parses it is not picking up the active eth0 line.

Posted: Sat 04 Feb 2006, 02:32
by jcoder24
Where can I get jwm 1.3? I tried searching but the forum search is not working.

jc

Posted: Sat 04 Feb 2006, 03:53
by BarryK

Got it to work! :)

Posted: Sat 04 Feb 2006, 11:44
by lior2b
It didn't really use the /proc/net/dev file, it had some issues inserting new interfaces...
I'm attaching both files I've changed, let me know if it works for you!

http://lior.f2o.org/puppy/usage-proc.c
http://lior.f2o.org/puppy/ifa.c

Posted: Sat 04 Feb 2006, 12:53
by BarryK
lior2b,
No, with my eth0 interface up, blinky displays blue LEDs, meaning that it has
found the interface, but they don't flash green. Hovering the mouse pointer over displays 0 bytes sent, 0 bytes received.

I only briefly looked at your mods. I saw the comment that it quits if no interface.
Blinky will run in the taskbar, and must not quit. If there are no active interfaces,
Blinky is supposed to display dark-red LEDs, then if an interface becomes active,
the LEDs become blue. This is great for dialup people as they can see at a glance
if their line has dropped out... I think maybe that's the idea? -- it depends how /proc/net/dev really works. I guess -- can't ppp0 be up even after the line has dropped out/disconnected?

Posted: Sat 04 Feb 2006, 13:04
by lior2b
Barry, it doesn't quit blinky, it skips the specific line in the /proc/net/dev file,
that's the terminology the original authour used :)

I'll research about /proc/net/dev to see how i can figure out if the interface is disconnected. Now blinky displays all interfaces listed in /proc/net/dev, and blinks upon activity. If an interface isn't listed anymore, blinky hides it.

Anyways, I'll work on it!

Posted: Sat 04 Feb 2006, 13:08
by jcoder24
lior2b,
I successfully tested your changes with:

- eth0 only active
- ppp0 only active
- eth0 + ppp0 both active

maybe we could omit displaying the lo0 interface.

I was looking at the code before your changes but got stuck at what look (only did begginers c) liked an uninitialised variable.

Posted: Sat 04 Feb 2006, 13:57
by BarryK
I wonder why mine isn't blinking.
I have an active eth0, but just have two blue LEDs.

I just looked at /proc/net/dev, the eth0 line is definitely functioning.
Here's a snapshot:

Code: Select all

Inter-|   Receive                                                |  Transmit
 face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed
    lo:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
  eth0: 1669215    2616    0    0    0     0          0         0   248945    2205    0    0    0     0       0          0

Posted: Sat 04 Feb 2006, 14:05
by BarryK
Ha ha, now I know!

As I have two interfaces active, eth0 and lo, running blinky from the commandline displays two rows of LEDs.
However running blinky in the taskbar I only see the top row, which is the lo interface.

So, we need to get it to ignore the lo interface.

But that still leaves a problem, as the taskbar can only display the one row of
LEDs. If someone has both eth0 and ppp0 active, there's a problem.
Unless both interfaces are combined into the one row of LEDs?
-- that is, blinky only displays two adjacent LEDs regardless how many
interfaces, the Tx and Rx figures are just summed together.

However, a per interface breakdown could be displayed when the mouse is
hovered over the LEDs.
Note, we need to increase the timeout on the info display -- when mouse
pointed moves over the LEDs the info window pops up but disappears
too quickly.

Posted: Sat 04 Feb 2006, 14:14
by lior2b
I made it ignore the lo interface, and i have some ideas:
(*) If no bytes ever recieved mark the interface as inactive (red)
(*) Show all intrefaces (except lo) that exist in /proc/net/dev, if anything disappears from /proc/net/dev mark it as inactive
(*) List all interfaces horizontally, not vertically

What do you say?

Posted: Sat 04 Feb 2006, 14:23
by lior2b
Better idea:
List only active interfaces, don't use the red color thing...
IMO it's the best solution, design-wise and /proc/net/dev-wise :)

Posted: Sat 04 Feb 2006, 16:06
by lior2b
Got some updates!
The "lo" interface is now omitted, the interfaces are now shown in a row, only active interfaces are shown, no red color...

Tell me what you think :)

Edit: I forgot to mention that right click now displays the information shown in the tooltip, hence the tooltip problem is solved...

http://lior.f2o.org/puppy/blinky_rev2/usage-proc.c
http://lior.f2o.org/puppy/blinky_rev2/blinky.c
http://lior.f2o.org/puppy/blinky_rev2/ifa.c

Blinky

Posted: Sat 04 Feb 2006, 20:56
by tronkel
I'm lookiing at the C code in the usage.proc. c source file . Look at this:
get_usage_all (void)
{
int fd;
static char buf[2048];
char *pos;

if ((fd = open("/proc/net/dev", O_RDONLY)) == -1) {
perror ("opening /proc/net/dev");
exit(1);
}

memset (buf, 0, sizeof(buf));

if (read (fd, buf, sizeof(buf)) == -1) {
perror ("reading /proc/net/dev");
exit(1);
}

close (fd);

pos = buf;

// what is this? Can this store the second line in the /proc/net/dev file so that it can be parsed? I doubt it unless I'm missing something here!
while (*(pos++) != '\n' ) ;
while (*(pos++) != '\n' ) ;


/* parse each line */
while (pos != NULL)
pos = parse_line (pos);



return;
}

I doubt if the 2 successive while loops can ever store the second string line in the /proc/net/dev file so that it can be parsed. This is the line that accesses the eth0 interface. I'll try to hack this later. Would explain why a live eth0 is not recognised?

How do I install Blinky so that it starts up by default at boot time?

Posted: Sat 04 Feb 2006, 21:09
by lior2b
I'm not sure what you are asking... The two while loops skip the two first lines in the /proc/net/dev file, because they are not important...

Code: Select all

Inter-|   Receive                                                |  Transmit
 face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed
    lo:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
  eth0: 1669215    2616    0    0    0     0          0         0   248945    2205    0    0    0     0       0          0
Have you complied blinky with my mods? It works great for me!

Blinky

Posted: Sat 04 Feb 2006, 21:55
by tronkel
Yeah that seems to work now OK on this system i.e Puppy 1.07. Well done! lior2b