LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware > Slackware - ARM
User Name
Password
Slackware - ARM This forum is for the discussion of Slackware ARM.

Notices


Reply
  Search this Thread
Old 10-03-2016, 09:06 PM   #1
justwantin
Member
 
Registered: Aug 2003
Location: Melbourne, Australia
Distribution: Slackware, Slackwarearm
Posts: 896

Rep: Reputation: 123Reputation: 123
BananaPro sysfs pin numbers


I have previously used lemakers modified wiring pi on a bananapro but have decided now that I have slackwarearm hard float up and running that I will just use sysfs pin numbers. Seemed a bit silly to compile and run a program that assigns a number to something that already has a number. I have attached a .png with the pin numbering. All sysfs pin numbers have been confirmed correct with the script that follows below. These pin numbers will not work on a bananapi but sysfs pin numbers for the bananapi could be calculated using the same method described for the mainline kernel at: http://http://linux-sunxi.org/GPIO
Code:
#!/bin/bash
##############################################################
# /usr/local/bin/test-gpio.sh RM20160728
#
# Used to test GPIO sysfs numbering on a Lemaker Banana Pro
# as per: https://linux-sunxi.org/GPIO
# This script is run as root
# Usage: /path/test-gpio.sh [pin number] [1] on [2] off
# Refer to: https://www.kernel.org/doc/Documentation/gpio/sysfs.txt
# for usage in mainline kernels
##############################################################

POWER_PIN=$1
ON_OFF=$2

echo "$POWER_PIN" > /sys/class/gpio/export 2> /dev/null

case "$2" in
    '1') # on
        echo "$POWER_PIN" > /sys/class/gpio/export 2> /dev/null
        echo "out" > /sys/class/gpio/gpio$POWER_PIN/direction
        echo "1" > /sys/class/gpio/gpio$POWER_PIN/value
    ;;

    '0') # off
        echo "0" > /sys/class/gpio/gpio$POWER_PIN/value
        echo "$POWER_PIN" > /sys/class/gpio/unexport 2> /dev/null
    ;;
esac
Attached Thumbnails
Click image for larger version

Name:	bpro-gpio-sysfs-no.png
Views:	54
Size:	94.3 KB
ID:	23170  

Last edited by justwantin; 10-03-2016 at 09:08 PM.
 
  


Reply

Tags
bananapro, gpio sysfs, pin numbers


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
BananaPro, WiringLMK, i2c and GPIO pins justwantin Slackware - ARM 3 01-18-2016 02:35 AM
Could please tell me the pin numbers of d'sub-9 and d'sub-25 adapter. vectrum Linux - Networking 12 02-13-2013 11:39 AM
[SOLVED] find the total of numbers that are higher than x in a text file with numbers (using awk??) Mike_V Programming 12 11-24-2010 09:51 AM
my PSU socket & connector have different pin numbers newbiesforever General 2 06-28-2008 12:14 AM
CPU 12-V power supply: 4-pin or 8-pin? michapma Linux - Hardware 3 07-23-2007 10:13 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware > Slackware - ARM

All times are GMT -5. The time now is 07:32 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration