Technologic Systems Logo
Search Icon
Customer Area | Contact Us |Cart Icon
  16525 East Laser Drive
Fountain Hills, AZ 85268
Phone (480) 837-5200
Results 1 to 3 of 3

Thread: how to use leds

  1. #1
    Junior Member
    Join Date
    Nov 2016
    Posts
    15

    how to use leds

    What is the correct way to control the LEDs from a C program?

    Here is the gist what I am doing now:

    Open once:

    Code:
    int green_fd = open ("/sys/class/leds/green-led/brightness", O_RDWR);
    Write as needed:

    Code:
    write (green_fd, "1", 1);
    or
    Code:
    write (green_fd, "0", 1);
    This does work fine and is quite fast.

    However, running top I noticed a process called systemd-udevd is taking up 100% CPU, even if I stop my program. Using strace I can see it is in a tight loop opening "/sys/devices/soc0/leds.16/leds/green-led/uevent" over and over.

    Please advise.

    Thank you,

    Elwood Downey
    Steward Observatory
    Tucson AZ

  2. #2
    Which distribution/board are you running? I'd like to reproduce this here.

  3. #3
    Junior Member
    Join Date
    Nov 2016
    Posts
    15
    Code:
    root@ts-imx6:~/sbc# uname -a
    Linux ts-imx6 3.10.53-1.1.0-technologic+gfc2d17f #1 SMP PREEMPT Mon Dec 21 14:53:23 MST 2015 armv7l GNU/Linux
    TS-4900-2048-4096F-Q10S-RTC-E on KIT-8550-4900

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •