Liudh
Liudh

Reputation: 21

How open gpio in embedded linux?

According to the gpio documentation of openwrt, I entered the following command in the console:

echo "26" > /sys/class/gpio/export

The console prompts " write error: Device or resource busy". This gpio is a led pin. How should I drive this gpio?

Upvotes: 1

Views: 683

Answers (1)

Liudh
Liudh

Reputation: 21

GPIOs already defined in the device tree cannot be exported. Fortunately, LEDs can be controlled in another file:

echo "100" > /sys/class/leds/<device>:<color>:<func>/brightness
sleep 1
echo "0" > /sys/class/leds/<device>:<color>:<func>/brightness

LED will flash.

Upvotes: 1

Related Questions