petrockblog / powerblock Goto Github PK
View Code? Open in Web Editor NEWDriver for petrockblock.com PowerBlock
Driver for petrockblock.com PowerBlock
I upgraded to LE12 and since then the button doesn´t work.
I get this message (I have pin 12 for shutdown):
Shutdown is ACTIVATED
Shutdown Pin is 12
Status Pin is 17
bash: write error: Invalid argument
bash: write error: Invalid argument
/storage/powerblock.sh: line 37: can't create /sys/class/gpio/gpio17/direction: nonexistent directory
/storage/powerblock.sh: line 43: can't create /sys/class/gpio/gpio12/direction: nonexistent directory
Setting RPi status signal to HIGH
/storage/powerblock.sh: line 50: can't create /sys/class/gpio/gpio17/value: nonexistent directory
cat: can't open '/sys/class/gpio/gpio12/value': No such file or directory
bash: 1: unknown operand
while trying to setup my system. and found myself in a restart loop. i discovered that the powerblock and the hifiberry dac+ pro share GPIO pin 18. as soon as i unpluged the dac hat. the restart loop was gone.
i hope this is the right place to put this. im sorry if it isnt
I’m trying to change the pins used for status + shutdown as I need one of them for i2s audio output.
I’ve cut the traces for S1 and S2 on the underside of the board next to the header and have changes the config file to use pins 6 and 12, however when I check my log file the powerblockservice reports the pins as 31 and 32 and the pins don’t seem to work. The led just remains slow flashing and toggling the button doesn’t shut down.
I can’t understand why it’s outputting different pin values than configured 🤔
Hi,
Trying to install the driver on Retropie 4.9.35-v7 / Raspberry Pi 3, i have this error at the 63% step ::
[ 63%] Building CXX object CMakeFiles/powerblock.dir/src/powerblock/main.cpp.o
/root/PowerBlock/src/powerblock/main.cpp:30:17: error: ‘sig_atomic_t’ does not name a type
static volatile sig_atomic_t doRun = 1;
^
/root/PowerBlock/src/powerblock/main.cpp: In function ‘void sig_handler(int)’:
/root/PowerBlock/src/powerblock/main.cpp:35:19: error: ‘SIGINT’ was not declared in this scope
if ((signo == SIGINT) | (signo == SIGQUIT) | (signo == SIGABRT) | (signo == SIGTERM))
^
/root/PowerBlock/src/powerblock/main.cpp:35:39: error: ‘SIGQUIT’ was not declared in this scope
if ((signo == SIGINT) | (signo == SIGQUIT) | (signo == SIGABRT) | (signo == SIGTERM))
^
/root/PowerBlock/src/powerblock/main.cpp:35:60: error: ‘SIGABRT’ was not declared in this scope
if ((signo == SIGINT) | (signo == SIGQUIT) | (signo == SIGABRT) | (signo == SIGTERM))
^
/root/PowerBlock/src/powerblock/main.cpp:35:81: error: ‘SIGTERM’ was not declared in this scope
if ((signo == SIGINT) | (signo == SIGQUIT) | (signo == SIGABRT) | (signo == SIGTERM))
^
/root/PowerBlock/src/powerblock/main.cpp:38:9: error: ‘doRun’ was not declared in this scope
doRun = 0;
^
/root/PowerBlock/src/powerblock/main.cpp: In function ‘void register_signalhandlers()’:
/root/PowerBlock/src/powerblock/main.cpp:46:16: error: ‘SIGINT’ was not declared in this scope
if (signal(SIGINT, sig_handler) == SIG_ERR)
^
/root/PowerBlock/src/powerblock/main.cpp:46:35: error: ‘signal’ was not declared in this scope
if (signal(SIGINT, sig_handler) == SIG_ERR)
^
/root/PowerBlock/src/powerblock/main.cpp:46:40: error: ‘SIG_ERR’ was not declared in this scope
if (signal(SIGINT, sig_handler) == SIG_ERR)
^
/root/PowerBlock/src/powerblock/main.cpp:50:16: error: ‘SIGQUIT’ was not declared in this scope
if (signal(SIGQUIT, sig_handler) == SIG_ERR)
^
/root/PowerBlock/src/powerblock/main.cpp:50:36: error: ‘signal’ was not declared in this scope
if (signal(SIGQUIT, sig_handler) == SIG_ERR)
^
/root/PowerBlock/src/powerblock/main.cpp:50:41: error: ‘SIG_ERR’ was not declared in this scope
if (signal(SIGQUIT, sig_handler) == SIG_ERR)
^
/root/PowerBlock/src/powerblock/main.cpp:54:16: error: ‘SIGABRT’ was not declared in this scope
if (signal(SIGABRT, sig_handler) == SIG_ERR)
^
/root/PowerBlock/src/powerblock/main.cpp:54:36: error: ‘signal’ was not declared in this scope
if (signal(SIGABRT, sig_handler) == SIG_ERR)
^
/root/PowerBlock/src/powerblock/main.cpp:54:41: error: ‘SIG_ERR’ was not declared in this scope
if (signal(SIGABRT, sig_handler) == SIG_ERR)
^
/root/PowerBlock/src/powerblock/main.cpp:58:16: error: ‘SIGTERM’ was not declared in this scope
if (signal(SIGTERM, sig_handler) == SIG_ERR)
^
/root/PowerBlock/src/powerblock/main.cpp:58:36: error: ‘signal’ was not declared in this scope
if (signal(SIGTERM, sig_handler) == SIG_ERR)
^
/root/PowerBlock/src/powerblock/main.cpp:58:41: error: ‘SIG_ERR’ was not declared in this scope
if (signal(SIGTERM, sig_handler) == SIG_ERR)
^
/root/PowerBlock/src/powerblock/main.cpp: In function ‘int main(int, char**)’:
/root/PowerBlock/src/powerblock/main.cpp:69:12: error: ‘doRun’ was not declared in this scope
while (doRun)
^
CMakeFiles/powerblock.dir/build.make:62: recipe for target 'CMakeFiles/powerblock.dir/src/powerblock/main.cpp.o' failed
make[2]: *** [CMakeFiles/powerblock.dir/src/powerblock/main.cpp.o] Error 1
CMakeFiles/Makefile2:165: recipe for target 'CMakeFiles/powerblock.dir/all' failed
make[1]: *** [CMakeFiles/powerblock.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
Error during installation of binary
Scanning dependencies of target installservice
[100%] Installing service.
[100%] Built target installservice
~/PowerBlock
[ERROR] The PowerBlock driver binary is not installed
[ERROR] The PowerBlock service is not running
Do you have any advice for this ?
Thanks
While installing PowerBlock (via RetroPie) i've noticed the following message:
make: *** No rule to make target 'uninstallservice'. Stop.
It seems this is caused by the following:
https://github.com/petrockblog/PowerBlock/blob/release/2.0.0/install.sh#L26
which is probably left-over from the "bash-only implementation" between 1.6.3 and 2.0.0:
Full log:
Reading package lists...
Building dependency tree...
Reading state information...
git is already the newest version (1:2.11.0-3+deb9u4).
0 upgraded, 0 newly installed, 0 to remove and 7 not upgraded.
Cloning into 'PowerBlock'...
make: *** No rule to make target 'uninstallservice'. Stop.
Starting powerblock (via systemctl): powerblock.service.
Installation of PowerBlock service done.
[SUCCESS] The PowerBlock driver binary is installed
[SUCCESS] The PowerBlock service is running
You can find the configuration file at /etc/powerblockconfig.cfg.
I try use PowerBlock with ARMBIAN 5.27.170421 nightly Ubuntu 16.04.2 LTS 4.10.11-sun8i what uses systemd.
Could you consider add native (an unit file) support for systemd too?
Currently powerblock service is handled by
root@orangepiplus2e:/etc/systemd# systemctl status powerblock
● powerblock.service - LSB: powerblock init script
Loaded: loaded (/etc/init.d/powerblock; bad; vendor preset: enabled)
Active: active (running) since Thu 2017-04-20 21:51:03 UTC; 21min ago
Docs: man:systemd-sysv-generator(8)
Process: 1916 ExecStop=/etc/init.d/powerblock stop (code=exited, status=0/SUCCESS)
Process: 1937 ExecStart=/etc/init.d/powerblock start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/powerblock.service
└─1944 /usr/bin/powerblock
Apr 20 21:51:03 orangepiplus2e systemd[1]: Starting LSB: powerblock init script...
Apr 20 21:51:03 orangepiplus2e systemd[1]: Started LSB: powerblock init script.
Add a module to the RetroPie-Setup that installs and configured the PowerBlock driver.
This is reproducible every time in my testing.
Take a clean install of the latest Raspbian Jessie Lite, (in this case on a 64GB card) run:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install -y cmake g++-4.9
git clone git://github.com/petrockblog/PowerBlock.git
cd PowerBlock
make
sudo make install
sudo make installservice
From here the Pi will either reboot automatically or you do a sudo reboot.
Either way what you end up with is a Pi in an endless reboot loop
Had this up and running forever, rebuilt a rpi2 and 3 tonight and neither would work (light continuously flashing and switch did nothing. Also noticed that after the install neither pi shutdown.
Noticed changes were made a couple days ago, I ran the uninstall script, rebooted, made the following reversions, re-installed and everything is working fine now.
file /PowerBlock/install.sh
comment line 'updateBootConfig'
file /PowerBlock/scripts/powerblockservice
- change as follows
setPinValue() {
echo $2 > $BASE_GPIO_PATH/gpio$1/value
#- gpioset $chip $1=$2
}
getPinValue() {
echo $(cat $BASE_GPIO_PATH/gpio$1/value)
#- echo $(gpioget $chip $1)
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.