Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
docs:guide-developer:add.new.device [2021/10/15 09:06] – ↷ Links adapted because of a move operation bobafetthotmaildocs:guide-developer:add.new.device [2022/03/23 12:00] (current) – adding filename for scripts, so that when users post their result they will be able to refer a specific output associated with which script aterik
Line 44: Line 44:
 To speed up testing all GPIOs one by one you can use following bash script. Please note you have to follow LEDs state and console output. If the USB LED turns on and the last console message is ''[GPIO12] Trying value 0'' it means USB LED uses GPIO 12 and is active low. To speed up testing all GPIOs one by one you can use following bash script. Please note you have to follow LEDs state and console output. If the USB LED turns on and the last console message is ''[GPIO12] Trying value 0'' it means USB LED uses GPIO 12 and is active low.
  
-<code>#!/bin/sh+<file bash gpio-test.sh>#!/bin/sh
 GPIOCHIP=0 GPIOCHIP=0
 BASE=$(cat /sys/class/gpio/gpiochip${GPIOCHIP}/base) BASE=$(cat /sys/class/gpio/gpiochip${GPIOCHIP}/base)
Line 66: Line 66:
  }  }
  gpio=$((gpio+1))  gpio=$((gpio+1))
-done</code>+done 
 +</file> 
 +  * Save the above content as a file ''gpio-test.sh'' & then transfer inside router's ''/tmp'' directory, or copy above content & paste inside ''vi'' editor in router & save as ''gpio-test.sh'' file. 
 +  * to make it executable, run: ''chmod +x /tmp/gpio-test.sh''
  
 ==== GPIO buttons ==== ==== GPIO buttons ====
Line 78: Line 81:
 For dumping GPIO values following script can be used: For dumping GPIO values following script can be used:
  
-<code>#!/bin/sh+<file bash gpio-dump.sh>#!/bin/sh
 GPIOCHIP=0 GPIOCHIP=0
 BASE=$(cat /sys/class/gpio/gpiochip${GPIOCHIP}/base) BASE=$(cat /sys/class/gpio/gpiochip${GPIOCHIP}/base)
Line 92: Line 95:
  }  }
  gpio=$((gpio+1))  gpio=$((gpio+1))
-done</code>+done 
 +</file> 
 +  * Save the above content as a file ''gpio-dump.sh'' & then transfer inside router's ''/tmp'' directory, or copy above content & paste inside ''vi'' editor in router & save as ''gpio-dump.sh'' file 
 +  * to make it executable, run: ''chmod +x /tmp/gpio-dump.sh''
  
 If GPIO value changes from 1 to 0 while pressing the button, it's active low. Otherwise it's active high. If GPIO value changes from 1 to 0 while pressing the button, it's active low. Otherwise it's active high.
  • Last modified: 2021/10/15 09:06
  • by bobafetthotmail