Forum
[PROBLEM] Argon One case with 'power' button - config script fails to install - Printable Version

+- Forum (http://forum.xbian.org)
+-- Forum: Hardware (/forum-7.html)
+--- Forum: Peripherals (/forum-27.html)
+--- Thread: [PROBLEM] Argon One case with 'power' button - config script fails to install (/thread-4008.html)



Argon One case with 'power' button - config script fails to install - Dave400 - 27th Dec, 2018 11:15 PM

Morning, I've recently acquired one of the Argon One raspberry pi cases from Argon 40, neat bit of kit that provides a power button in a high quality case.

They provide a script to install to enable the power button functionality and also fan speed control, and whilst I did have to manually install curl in order to run the script, it fails with
Terminal
E: Unable to locate package raspi-gpio

The script I'm running is

Any ideas?


RE: Argon One case with 'power' button - config script fails to install - rikardo1979 - 28th Dec, 2018 10:34 PM

(27th Dec, 2018 11:15 PM)Dave400 Wrote:  Morning, I've recently acquired one of the Argon One raspberry pi cases from Argon 40, neat bit of kit that provides a power button in a high quality case.

They provide a script to install to enable the power button functionality and also fan speed control, and whilst I did have to manually install curl in order to run the script, it fails with
Terminal
E: Unable to locate package raspi-gpio

The script I'm running is

Any ideas?

you will need something to control your GPIO where the button is connected to and then appropriate to be executed when you press the button.
Have a look in my thread here for an example how is it done(different HW and different OS!)

The best place to ask would be the manufacturer of your case


RE: Argon One case with 'power' button - config script fails to install - Nachteule - 29th Dec, 2018 12:48 AM

(27th Dec, 2018 11:15 PM)Dave400 Wrote:  Morning, I've recently acquired one of the Argon One raspberry pi cases from Argon 40, neat bit of kit that provides a power button in a high quality case.

They provide a script to install to enable the power button functionality and also fan speed control, and whilst I did have to manually install curl in order to run the script, it fails with
Terminal
E: Unable to locate package raspi-gpio

The script I'm running is

Any ideas?

I looked into the script, and I don't believe that there is a chance to make it run under XBian without investigating what that script does.
This is written for Raspbian and is using a couple of packages coming from there (i.e raspi-config), it requires systemd (what we do not use) and creates links to graphical desktop (what XBian does not have).

Sorry Sad

Edit:

I looked a bit deeper into it:

1) seems that package raspi-gpio is not used
2) You can pick packages, which are provided by Raspbian only by adding a line to /etc/apt/sources.list like this
sudo echo "deb http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free rpi" >> /etc/apt/sources.list
and run sudo apt-get update
3) Finally, you have to port after running script argon1.sh systemd service file /lib/systemd/system/argononed.service to an upstart script (should be not so difficult)
And of course, you have to remove that line added in 2) again in /etc/apt/sources.list


RE: Argon One case with 'power' button - config script fails to install - Dave400 - 29th Dec, 2018 10:10 AM

Thanks both, both replies gives me a great starting point.. I have also made the same enquiry to Argon40 and found there are others in the same position, using Debian based builds and not pure Rasbian builds


RE: Argon One case with 'power' button - config script fails to install - Tayedore - 20th Dec, 2019 11:26 AM

Any luck on figuring this out? This is my first attempt at setting up any pi and I can't figure out my way around this. Any update would be appreciated.


RE: Argon One case with 'power' button - config script fails to install - ikem - 14th Jun, 2020 08:30 PM

(29th Dec, 2018 12:48 AM)Nachteule Wrote:  
(27th Dec, 2018 11:15 PM)Dave400 Wrote:  Morning, I've recently acquired one of the Argon One raspberry pi cases from Argon 40, neat bit of kit that provides a power button in a high quality case.

They provide a script to install to enable the power button functionality and also fan speed control, and whilst I did have to manually install curl in order to run the script, it fails with
Terminal
E: Unable to locate package raspi-gpio

The script I'm running is

Any ideas?

I looked into the script, and I don't believe that there is a chance to make it run under XBian without investigating what that script does.
This is written for Raspbian and is using a couple of packages coming from there (i.e raspi-config), it requires systemd (what we do not use) and creates links to graphical desktop (what XBian does not have).

Sorry Sad

Edit:

I looked a bit deeper into it:

1) seems that package raspi-gpio is not used
2) You can pick packages, which are provided by Raspbian only by adding a line to /etc/apt/sources.list like this
sudo echo "deb http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free rpi" >> /etc/apt/sources.list
and run sudo apt-get update
3) Finally, you have to port after running script argon1.sh systemd service file /lib/systemd/system/argononed.service to an upstart script (should be not so difficult)
And of course, you have to remove that line added in 2) again in /etc/apt/sources.list

I took the script and made a debian package out of it.

You can get them from gitlab.com.


RE: Argon One case with 'power' button - config script fails to install - Dave400 - 15th Jun, 2020 06:19 PM

(14th Jun, 2020 08:30 PM)ikem Wrote:  I looked into the script, and I don't believe that there is a chance to make it run under XBian without investigating what that script does.
This is written for Raspbian and is using a couple of packages coming from there (i.e raspi-config), it requires systemd (what we do not use) and creates links to graphical desktop (what XBian does not have).

Sorry Sad

Edit:

I looked a bit deeper into it:

1) seems that package raspi-gpio is not used
2) You can pick packages, which are provided by Raspbian only by adding a line to /etc/apt/sources.list like this
sudo echo "deb http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free rpi" >> /etc/apt/sources.list
and run sudo apt-get update
3) Finally, you have to port after running script argon1.sh systemd service file /lib/systemd/system/argononed.service to an upstart script (should be not so difficult)
And of course, you have to remove that line added in 2) again in /etc/apt/sources.list

Alas they built native support for the cooling system into OSMC and sorry to say I did permanently switch over after giving it a go...


RE: Argon One case with 'power' button - config script fails to install - jorgeblat - 5th Jul, 2020 05:30 PM

There is an alternative method using python3 from Cedric Meuter. I just got it working on Kali Linux 64 on a Pi 4.

https://github.com/meuter/argon-one-case-ubuntu-20.04

For Kali I had to make some extra modifications (modprobe, etc.) but I understand it works well on Ubuntu 20.04

I you don't want to bother about technicalities, just run:

curl https://raw.githubusercontent.com/meuter/argon-one-case-ubuntu-20.04/master/argon1.sh |bash

The installer should take care of the dependencies.

For the desktop shortcuts, the script has some references to home/pi so if your user is not pi, don't forget to change the references (install and uninstall portion of the script) before running the script.


RE: Argon One case with 'power' button - config script fails to install - Leodymium - 5th Nov, 2020 12:57 AM

Hello,

I am trying to install a power switch on a RP4 device and here is the list of the steps I took manually, if you wish to have a go. It is based on various instructions, mainly here to setup the switch and here to install the library. I have the switch detected and I can access it by the python console but I am still looking at an efficient way to start the script during the boot sequence, as systemd does not seem to work.
Anyway, to install the tool you need to access GPIO from python scripts you can do the following. Start by the packages:

Terminal

sudo apt-get install python-dev python3-dev
sudo apt-get install mercurial
sudo apt-get install python-pip python3-pip
sudo apt-get install python3-setuptools
sudo apt-get install gcc-arm-linux-gnueabihf

Then you should be able to install the GPIO library. The version in the repository does not work for the raspberry pi versions higher than 1 so you need to install from the source repo:

Terminal

python3 -m pip install wheel
python3 -m pip install hg+http://hg.code.sf.net/p/raspberry-gpio-python/code#egg=RPi.GPIO

Apparently there is a kernel bug that prevents accessing the GPIO library without being root (see here and here), so you need to create a rule.d config:

Quote:Create /etc/udev/rules.d/90-gpio.rules with:

KERNEL=="gpiomem", OWNER="root", GROUP="gpio"

Create the group itself and assign it to an existing user "pi":

Then add a new group to manage the GPIO port and add the user to it:

Terminal

sudo groupadd -f --system gpio
sudo usermod -a -G gpio $USER

Note that this worked to some extent for me but I still encountered some issues when not using root, so I still use sudo for all the rest.

Once you have these done you can write your python script to switch off the device, I got mine from there with some modifications to make it operate on the correct GPIO pin (pin 5, or equivalently GPIO3):

Code:
#!/usr/bin/env python3
import signal
import sys
import os
import RPi.GPIO as GPIO
BUTTON_GPIO = 3

def signal_handler(sig, frame):
    GPIO.cleanup()
    sys.exit(0)

def button_pressed_callback(channel):
    print("Button pressed!")
    os.system('poweroff')

if __name__ == '__main__':
    GPIO.setmode(GPIO.BCM)
    GPIO.setup(BUTTON_GPIO, GPIO.IN, pull_up_down=GPIO.PUD_UP)
    GPIO.add_event_detect(BUTTON_GPIO, GPIO.FALLING,
            callback=button_pressed_callback, bouncetime=100)
    signal.signal(signal.SIGINT, signal_handler)
    signal.pause()

When running this code from the terminal, the power switch operated correctly and switched off the device. Using pin 5 also makes it possible to use the same switch to power up the RP4.

I only need to put this script in the boot sequence now, I will try init.r (there are some instructions here).

I hope this helps.

Just to update, init.d seems to be working, the steps are here (method 3).

Add a header to the file:

Code:
#!/usr/bin/env python3
# /etc/init.d/shutdown_interrupt.py
### BEGIN INIT INFO
# Provides:          shutdown_interrupt.py
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start shutdown daemon at boot time
# Description:       Enable to shutdown the RP4 using the switch on GPIO5-6.
### END INIT INFO
import signal
import sys
import os
import RPi.GPIO as GPIO
BUTTON_GPIO = 3

def signal_handler(sig, frame):
    GPIO.cleanup()
    sys.exit(0)

def button_pressed_callback(channel):
    print("Button pressed!")
    os.system('poweroff')

if __name__ == '__main__':
    GPIO.setmode(GPIO.BCM)
    GPIO.setup(BUTTON_GPIO, GPIO.IN, pull_up_down=GPIO.PUD_UP)
    GPIO.add_event_detect(BUTTON_GPIO, GPIO.FALLING,
            callback=button_pressed_callback, bouncetime=100)
    signal.signal(signal.SIGINT, signal_handler)
    signal.pause()

then save it at /etc/init.d/, make it accessible and update the system:

Terminal

sudo cp ./shutdown_interrupt.py /etc/init.d/
sudo chmod +x sample.py
sudo update-rc.d sample.py defaults

It is now working for me, I have a start/stop switch on my RP4 Smile happy times....


RE: Argon One case with 'power' button - config script fails to install - Thundersun - 17th Mar, 2021 11:20 AM

Hello guys i have the same problem has you guys with the argon one case but in my case i have an argon one m.2 case and the problems aren't only the fan control and the power switch i'ts more then that...
I have raspberry pi 8gb ram and i can install xbian on that configuraction and the first time it runs ok and i can config it and it works fine and smooth but i cant get the argon script to work has it was supposed and then when a reboot i get a blanck screen with a blinking cursor.
I'm not a tech savie guy so please i need help and on an easy way. I've tried dietpi and almost everything work perfect at list when it comes to argon one m.2 because when active on there config menu the IC2 thing it pulls a bunch of python3 scripts and then when i use the original argon script everythings works has it is supported... So if any dev it's reading this take a look on dietpi an see what they are using to make the argon one m.2 case work has it is supposed. And about the blinking cursor on a white screen it only happens on the second boot just after reboot on the m.2 ssd with the sd card xbian works ...
Please fix it to bee simple and for everything to work fine because this xbian distro work almost perfect has a media center if it wasn't for this problems. And i really like it and so far can't use it...