to poll or not to poll? - Linux

This is a discussion on to poll or not to poll? - Linux ; Hi all, I am working on custom embedded linux-based machine (Geode SC1100 CPU) and I have two problems to solve: 1. I want to 'copy' LAN activity LED status to front panel LEDs. I can access front LED-s through /dev/gpioX ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: to poll or not to poll?

  1. to poll or not to poll?

    Hi all,

    I am working on custom embedded linux-based machine
    (Geode SC1100 CPU) and I have two problems to solve:

    1.
    I want to 'copy' LAN activity LED status to front panel LEDs. I can
    access front LED-s through /dev/gpioX devicebut the problem is how
    to catch network activity without polling the status.
    Currently I have implemeted that in loop by polling
    /sys/class/net/eth0/statistcs/tx_packets but it takes a lot of CPU
    time... Is there any other way to do it with some notifiers, events,
    interrupts or something?

    2.
    I have few switches connected to CPUs GPIO and I want to make some
    use of them Also, I don't want to poll the status always... Is
    it possible to do that some other way than polling?


    Regards,
    Troky



  2. Re: to poll or not to poll?

    Troky wrote:
    > ...
    > (Geode SC1100 CPU) and I have two problems to solve:
    >
    > 1.
    > I want to 'copy' LAN activity LED status to front panel LEDs. I can
    > access front LED-s through /dev/gpioX devicebut the problem is how
    > to catch network activity without polling the status.
    > ...


    two years ago I just added an interrupt handler for the gpio on my
    pxa255 cpu. the macros to handle the gpio and install the irq handler
    are defined somewhere in /usr/src/linux/include/asm-arm/arch-pxa/...
    and are called IRQ_GPIO(...) or something.
    I cant remember literally now but it worked and if your CPU has similar
    defines then I would use them.

+ Reply to Thread