Recalbox Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • recalbox.com
    • Gitlab repository
    • Documentation
    • Discord

    Problème power script

    Recalbox Général
    script
    4
    35
    8070
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • lainbebop
      lainbebop @supernature2k last edited by lainbebop

      Voilà ce que j'obtiens avec le ps :

      PID   USER     COMMAND
          1 root     init [3]
          2 root     [kthreadd]
          3 root     [ksoftirqd/0]
          4 root     [kworker/0:0]
          5 root     [kworker/0:0H]
          6 root     [kworker/u8:0]
          7 root     [rcu_sched]
          8 root     [rcu_bh]
          9 root     [migration/0]
         10 root     [migration/1]
         11 root     [ksoftirqd/1]
         12 root     [kworker/1:0]
         13 root     [kworker/1:0H]
         14 root     [migration/2]
         15 root     [ksoftirqd/2]
         16 root     [kworker/2:0]
         17 root     [kworker/2:0H]
         18 root     [migration/3]
         19 root     [ksoftirqd/3]
         20 root     [kworker/3:0]
         21 root     [kworker/3:0H]
         22 root     [kdevtmpfs]
         23 root     [netns]
         24 root     [perf]
         25 root     [khungtaskd]
         26 root     [writeback]
         27 root     [crypto]
         28 root     [bioset]
         29 root     [kblockd]
         30 root     [kworker/0:1]
         31 root     [rpciod]
         32 root     [kswapd0]
         33 root     [vmstat]
         34 root     [fsnotify_mark]
         35 root     [nfsiod]
         44 root     [kthrotld]
         45 root     [bioset]
         46 root     [bioset]
         47 root     [bioset]
         48 root     [bioset]
         49 root     [bioset]
         50 root     [bioset]
         51 root     [bioset]
         52 root     [bioset]
         53 root     [bioset]
         54 root     [bioset]
         55 root     [bioset]
         56 root     [bioset]
         57 root     [bioset]
         58 root     [bioset]
         59 root     [bioset]
         60 root     [bioset]
         61 root     [bioset]
         62 root     [bioset]
         63 root     [bioset]
         64 root     [bioset]
         65 root     [bioset]
         66 root     [bioset]
         67 root     [bioset]
         68 root     [bioset]
         69 root     [VCHIQ-0]
         70 root     [VCHIQr-0]
         71 root     [VCHIQs-0]
         72 root     [iscsi_eh]
         73 root     [dwc_otg]
         74 root     [kworker/1:1]
         75 root     [DWC Notificatio]
         76 root     [kworker/u8:1]
         77 root     [irq/92-mmc1]
         78 root     [VCHIQka-0]
         79 root     [SMIO]
         80 root     [deferwq]
         81 root     [kworker/u8:2]
         82 root     [bioset]
         83 root     [mmcqd/0]
         84 root     [kworker/2:1]
         85 root     [jbd2/mmcblk0p2-]
         86 root     [ext4-rsv-conver]
         87 root     [kworker/2:1H]
         88 root     [kworker/1:2]
         91 root     [kworker/0:1H]
         92 root     [kworker/3:1]
        114 root     /sbin/syslogd -n
        117 root     /sbin/klogd -n
        155 root     dbus-daemon --fork --print-address 5 --print-pid 6 --session
        162 root     [kworker/3:1H]
        165 root     [kworker/1:1H]
        166 root     [kworker/0:2]
        167 root     /sbin/udevd -d
        204 root     [cfg80211]
        206 root     [brcmf_wq/mmc1:0]
        207 root     [brcmf_wdog/mmc1]
        210 root     [kworker/3:2]
        242 dbus     dbus-daemon --system
        255 root     /usr/sbin/connmand -n
        310 root     [ipv6_addrconf]
        317 root     /usr/sbin/wpa_supplicant -u
        319 root     [kworker/3:3]
        411 root     [jbd2/mmcblk0p3-]
        412 root     [ext4-rsv-conver]
        531 root     /usr/sbin/lircd -n --driver=default --device=/dev/lirc0 --output
        921 root     {emulationstatio} /usr/bin emulationstation
       1009 root     /usr/libexec/bluetooth/bluetoothd --noplugin=sixaxispair
       1093 root     /usr/sbin/ntpd -g
       1099 avahi    avahi-daemon: running [RECALBOX.local]
       1109 root     /usr/sbin/dropbear -R
       1122 root     smbd -D --configfile=/etc/samba/smb.conf
       1124 root     {smbd-notifyd} smbd -D --configfile=/etc/samba/smb.conf
       1125 root     {cleanupd} smbd -D --configfile=/etc/samba/smb.conf
       1140 root     nmbd -D --configfile=/etc/samba/smb.conf
       1154 root     {powerswitch.sh} /bin/bash /recalbox/scripts/powerswitch.sh star
       1164 root     python /recalbox/scripts/rpi-pin356-power.py -m push
       1170 root     node virtualgamepads.js
       1189 root     {S94manager} /bin/sh /etc/init.d/S94manager start
       1191 root     node dist/server.js
       1207 root     /sbin/getty 38400 tty2
       1209 root     [kworker/u9:0]
       1210 root     [hci0]
       1211 root     [hci0]
       1213 root     [kworker/u9:1]
       1214 root     /usr/bin/hciattach /dev/serial1 bcm43xx 921600 noflow -
       1215 root     [kworker/u9:2]
       1216 root     /usr/bin/node server.js
       1320 root     /usr/sbin/dropbear -R
       1357 root     -sh
       1369 root     ps
      

      TEST 1

      J'ai réinstallé RECALBOX sur une autre SD, sans support externe (j'ai débranché ma clé usb), pour tester.
      Donc install propre, sans jeux si ce n'est ceux déjà présents dans RECALBOX.

      Et bien c'est pareil !

      • Appui court : rien
      • Appui long : rien ou coupure du courant
      • Appuis répétés : coupure du courant

      TEST 2

      J'ai débranché mon bouton du GPIO et j'ai mis un couteau (en métal) entre les 2 PIN 5 et 6 : même comportement qu'avec le bouton, coupure du courant du Pi

      T_T

      1 Reply Last reply Reply Quote 0
      • lainbebop
        lainbebop last edited by

        ( @supernature2k )

        supernature2k 1 Reply Last reply Reply Quote 0
        • supernature2k
          supernature2k @lainbebop last edited by

          @lainbebop

          try this please:

          import RPi.GPIO as GPIO
          import time
          import os
          import thread
          import datetime
          import socket
          import sys
          import argpa**e
          from datetime import datetime
          from configgen import recalboxFiles
          # this last one retrieves emulators bin names
          
          pa**er = argpa**e.ArgumentPa**er(description='power manager')
          pa**er.add_argument("-m", help="mode onoff or push", type=str, required=True)
          args = pa**er.pa**e_args()
          
          mode = args.m
          
          IPADDR = "127.0.0.1"
          PORTNUM = 55355
          # IP and port for retroarch network commands
          
          POWERPLUS = 3
          RESETPLUS = 2
          LED = 14
          
          GPIO.setwarnings(False)		# no warnings
          GPIO.setmode(GPIO.BCM)		# set up BCM GPIO numbering 
           
          GPIO.setup(RESETPLUS, GPIO.IN, pull_up_down=GPIO.PUD_UP)
          # GPIO on pin 3 is the GPIO 2 in BCM mode
          #to Reset+
          
          GPIO.setup(POWERPLUS, GPIO.IN, pull_up_down=GPIO.PUD_UP)
          # GPIO on pin 5 is the GPIO 3 in BCM mode
          #to Power+
          
          GPIO.setup(LED, GPIO.OUT)
          GPIO.output(LED, True)
          # GPIO on pin 8 is the GPIO 14 in BCM mode
          #to LED+
          
            
          # Define a threaded callback function to run in another thread when events are detected  
          def button_pressed(channel):
          	if channel == POWERPLUS:
          		speed=0.15
          		shutdownstring="shutdown -h now"
          		nwcommand="QUIT"
          		
          	elif channel == RESETPLUS:
          		speed=0.05
          		shutdownstring="shutdown -r now"
          		nwcommand="RESET"
          		
          	timer = 0
          	flag = True
          	while flag:
          		if GPIO.input(channel) == False:
          			timer += 1
          			print "Button pressed"
          		elif GPIO.input(channel) == True:
          		
          			print "Button released"
          			print timer
          		
          			#timer adds 1 each 0.1 seconds if timer = 10, button is pressed for 1s
          			if (timer > 10):
          				offreset(speed, shutdownstring)
          				print "shutdown"
          			elif (timer >=1):
          				print "retroarch"
          				killthats**t(channel)
          				
          			timer = 0
          			flag = False
          		time.sleep(0.1)
          		
          	
          #	on power short press, trying to kill all listed emus 
          def killthats**t(channel):
          	if channel == POWERPLUS:
          		for bin in recalboxFiles.recalboxBins:
          				print bin
          				proc = os.path.basename(bin)
          				print proc
          				os.system("killall -9 "+proc)
          
          # 	on long button press clean stop	of ES then shutdown -h or -r		
          def offreset(speed, shutdownstring):
          	thread.start_new_thread( blink, (speed, ))
          	flag=True
          	pids = [pid for pid in os.listdir('/proc') if pid.isdigit()]
          	os.system("/etc/init.d/S31emulationstation stop")
          	while flag:
          		flag = False
          		for pid in pids:
          				try:
          					print pid
          					commandpath = open(os.path.join('/proc', pid, 'cmdline'), 'rb').read()
          					if "emulationstation" in commandpath:
          						flag = True
          				except IOError:
          					continue
          	os.system(shutdownstring)
          
          # threaded blinking function for LED	
          def blink(speed):
          	while True:  
          			GPIO.output(LED, False)
          			time.sleep(speed)
          			GPIO.output(LED, True)
          			time.sleep(speed)
          
          
          # 	sending network command to retroarch (only exit and reset atm)		
          def retroarch(nwcommand):
          	try:
          		s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
          	except socket.error:
          		print 'Failed to create socket'
          		sys.exit()
          	s.sendto(nwcommand, (IPADDR, PORTNUM))
          		
          
          GPIO.add_event_detect(RESETPLUS, GPIO.BOTH, callback=button_pressed, bouncetime=2)
          GPIO.add_event_detect(POWERPLUS, GPIO.BOTH, callback=button_pressed, bouncetime=2)
          while True:
          	time.sleep(0.2)
          

          Pi powered NES | Gameboy HD | RecalStation | RecalDrive
          Upvote messages if it has been useful ;)

          lainbebop 2 Replies Last reply Reply Quote 0
          • lainbebop
            lainbebop @supernature2k last edited by lainbebop

            @supernature2k

            J'ai remplacé le contenu du fichier rpi-pin356-power.py par ton code :

            Pression longue :

            Sous ES : écran noir et petit logo en bas puis extinction : ça marche ?
            Sous Emulateur : délai de 2sec puis coupure (sans écran noir?) : c'est normal ?

            Pression courte :

            sous ES : Pas de réaction (normal ?)
            sous émulateur : pas de réaction (pas normal ?)

            1 Reply Last reply Reply Quote 0
            • lainbebop
              lainbebop @supernature2k last edited by

              This post is deleted!
              1 Reply Last reply Reply Quote 0
              • supernature2k
                supernature2k last edited by

                mount -o remount, rw /
                

                Pi powered NES | Gameboy HD | RecalStation | RecalDrive
                Upvote messages if it has been useful ;)

                lainbebop 1 Reply Last reply Reply Quote 0
                • lainbebop
                  lainbebop @supernature2k last edited by

                  @supernature2k
                  Oui merci j’ai fini par trouver !
                  Voir mon post au dessus j’ai réussi 🙂 mais appui court ne fonctionne pas 😕

                  supernature2k 1 Reply Last reply Reply Quote 0
                  • supernature2k
                    supernature2k @lainbebop last edited by

                    @lainbebop pression courte sous ES, rien ne doit se passer

                    sous emul:

                    • pression courte (genre 1,2 secondes): QUIT de l'emul
                    • pression longue: shutdown

                    Pi powered NES | Gameboy HD | RecalStation | RecalDrive
                    Upvote messages if it has been useful ;)

                    lainbebop 1 Reply Last reply Reply Quote 0
                    • lainbebop
                      lainbebop @supernature2k last edited by

                      @supernature2k
                      Oui donc la pression courte ne fonctionne pas, et la pression longue je ne sais pas trop si le comportement est normal : on passe de l’image du jeu à rien (coupure) donc difficile de dire si c’est le script ou une coupure...

                      supernature2k 1 Reply Last reply Reply Quote 0
                      • supernature2k
                        supernature2k @lainbebop last edited by

                        @lainbebop franchement moi je ne sais plus. Tout fonctionne comme prévu sur mes 3 recalbox en version 18.03.30

                        Pi powered NES | Gameboy HD | RecalStation | RecalDrive
                        Upvote messages if it has been useful ;)

                        lainbebop 1 Reply Last reply Reply Quote 0
                        • lainbebop
                          lainbebop @supernature2k last edited by

                          @supernature2k
                          😞
                          Quel est le comportement « normal » lors de l’appui long ? Le jeux quitte puis écran noir puis arrêt ou alors le Pi se coupe avec le jeux encore à l’image ?

                          supernature2k 1 Reply Last reply Reply Quote 0
                          • supernature2k
                            supernature2k @lainbebop last edited by

                            @lainbebop

                            durée/bouton sous ES En jeu
                            RESET court rien reset du system (RetroArch only)
                            RESET long reset propre du système reset propre du système
                            POWER court rien quit du system et retour à ES
                            POWER long shutdown propre du système reset propre du système

                            Maintenant peux-tu essayer en ayant en même temps une console ouverte?
                            Il y a des output sur la console

                            Pi powered NES | Gameboy HD | RecalStation | RecalDrive
                            Upvote messages if it has been useful ;)

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post

                            Want to support us ?

                            81
                            Online

                            99.6k
                            Users

                            28.1k
                            Topics

                            187.1k
                            Posts

                            Copyright © 2021 recalbox.com