Problem with Blinky

Under development: PCMCIA, wireless, etc.
Message
Author
User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

Problem with Blinky

#1 Post 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

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#2 Post 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

jcoder24-guest

#3 Post by jcoder24-guest »

With your ifconfig I believe blinky is most likely using the ppp0 interface instead of the eth0.

GuestToo
Puppy Master
Posts: 4083
Joined: Wed 04 May 2005, 18:11

#4 Post 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

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#5 Post by MU »

oh yes, you are right... My fault :oops:
I use adsl-start , that uses /etc/ppp/pppoe.conf.

Mark

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#6 Post 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.

User avatar
jcoder24
Posts: 604
Joined: Fri 06 May 2005, 12:33
Location: Barbados

#7 Post by jcoder24 »

Where can I get jwm 1.3? I tried searching but the forum search is not working.

jc

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#8 Post by BarryK »


lior2b

Got it to work! :)

#9 Post 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

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#10 Post 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?

User avatar
lior2b
Posts: 97
Joined: Sat 04 Feb 2006, 12:15
Location: The Holy Land
Contact:

#11 Post 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!

User avatar
jcoder24
Posts: 604
Joined: Fri 06 May 2005, 12:33
Location: Barbados

#12 Post 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.

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#13 Post 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

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#14 Post 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.

User avatar
lior2b
Posts: 97
Joined: Sat 04 Feb 2006, 12:15
Location: The Holy Land
Contact:

#15 Post 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?

User avatar
lior2b
Posts: 97
Joined: Sat 04 Feb 2006, 12:15
Location: The Holy Land
Contact:

#16 Post 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 :)

User avatar
lior2b
Posts: 97
Joined: Sat 04 Feb 2006, 12:15
Location: The Holy Land
Contact:

#17 Post 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

User avatar
tronkel
Posts: 1116
Joined: Fri 30 Sep 2005, 11:27
Location: Vienna Austria
Contact:

Blinky

#18 Post 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?
Life is too short to spend it in front of a computer

User avatar
lior2b
Posts: 97
Joined: Sat 04 Feb 2006, 12:15
Location: The Holy Land
Contact:

#19 Post 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!

User avatar
tronkel
Posts: 1116
Joined: Fri 30 Sep 2005, 11:27
Location: Vienna Austria
Contact:

Blinky

#20 Post by tronkel »

Yeah that seems to work now OK on this system i.e Puppy 1.07. Well done! lior2b
Life is too short to spend it in front of a computer

Post Reply