Jump to content

andreygoncalves

Validating
  • Posts

    1
  • Joined

  • Last visited

Community Answers

  1. andreygoncalves's post in armbian in orange Pi creates script process in rc-local.service but don't executes correctly was marked as the answer   
    Hello guys.

    Could you help me resolv a problem with orange pi (armbian)?

    The problem is the following:
    I created a small script in Python that read a I/O of orange Pi, that is read the state of a button(switch). If I execute it on terminal It works fine... But my problem is when I put in inicialization of SO(/lib/systemd/system/rc-local.service ), the linux created a process correctly but when a press the button not happen anything.
     
    root@orangepizero:~# ps -aux|grep press
    root      1306 83.7  1.9  11268  4852 ?        Rs   18:54   0:38 /usr/bin/python /usr/local/sbin/press_button.py
     
    SO of Orange Pi Zero:
    Linux orangepizero 5.10.21-sunxi #21.02.3 SMP Mon Mar 8 00:28:04 UTC 2021 armv7l GNU/Linux
     
    Obs: I tried put the script in rc.local, used crontab too, put in init.d.... but always the same problem, the linux created the process but dont happen anything when I pressed the button... But if I execute on bash the script It read the button correctly.
     
    Script python:

     
    import os
    import sys
    from pyA20.gpio import gpio
    from pyA20.gpio import port
    from time import sleep
    #initialize the linphonecsh
    os.system("linphonecsh init")
    os.system("linphonecsh register --username 8000 --host 10.100.14.210 --password 8000")
    os.system("linphonecsh soundcard playback 0")
    os.system("linphonecsh soundcard capture 0")
    os.system("linphonecsh soundcard ring 0")
    #initialize the gpio module / initialise le GPIO
    gpio.init()
    button = port.PA12
    #setup the port
    gpio.setcfg(button, gpio.INPUT)
     
    while True:
    if gpio.input(button)==0:
    sleep(1)
    print("button pressed")                                                                                                                                                                                                                                                                                                                                                                                                  os.system("./test_autodial.sh")
     
    I'm already suspecting that it's a problem with this OS version.
    Hope someone can help me.
    Thank you very much.
     
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines