raspbian

Shutting down computer from a python script in apache

半腔热情 提交于 2019-12-24 09:18:27
问题 I have a headless Raspberry Pi which I want to have an easy means for my child to power down. I tried the following script in the apache web server: import os sss = os.popen('echo password | sudo -S shutdown -hP now') print sss.read() But nothing happens. Then I tried: from subprocess import Popen, PIPE, STDOUT p = Popen('echo password | sudo -S shutdown -hP now', shell=True, stdOUT=PIPE, stderr=STDOUT) print p.stdout.read() Also, nothing was output and no work appears to have been done. How

phpseclib not works with php5-cli from terminal

左心房为你撑大大i 提交于 2019-12-24 08:38:38
问题 I installed php5-cli package on my raspbian (debian OS) and I downloaded phpseclib in /cli/ directory. I created a test file to encrypt text with a public key (generated within my apache server on which I have the same library) in this way: include('libs/Crypt/RSA.php'); $rsa = new Crypt_RSA(); $rsa->loadKey($myPublicKey); $encrypted = $rsa->encrypt("my text"); echo "result: " .$encrypted; If I try to type php test.php the result variable is empty. Why? It's due to the fact I execute the file

Getting IOError: [Errno Invalid number of channels] -9998 when using mic with PyAudio on Raspberry Pi

流过昼夜 提交于 2019-12-23 04:28:55
问题 Bad news, everyone! I try to use a microphone on my Raspberry Pi through PyAudio but without success. The microphone is connected to a USB sound card. The microphone works when I go through 'arecord' : pi@raspberrypi ~ $ arecord -D plughw:0,0 -f cd test2.wav Recording WAVE 'test2.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo However, when I do the test record.py in PyAudio, I got an error. The error is the same for all programs in Python that uses PyAudio : pi@raspberrypi /usr/src

Configure MySQL for local and remote access

陌路散爱 提交于 2019-12-22 09:58:15
问题 I'm using MySQL server version: 10.1.23-MariaDB-9+deb9u1 Raspbian 9.0 on a Raspberry Pi. This is my /etc/mysql/my.cnf : # The MariaDB configuration file # # The MariaDB/MySQL tools read configuration files in the following order: # 1. "/etc/mysql/mariadb.cnf" (this file) to set global defaults, # 2. "/etc/mysql/conf.d/*.cnf" to set global options. # 3. "/etc/mysql/mariadb.conf.d/*.cnf" to set MariaDB-only options. # 4. "~/.my.cnf" to set user-specific options. # # If the same option is

Prevent usbhid from autoloading when USB HID device is plugged in

回眸只為那壹抹淺笑 提交于 2019-12-22 09:04:19
问题 I'm trying to (reversibly) disable USB HID support on a Raspbian Jessie install, kernel version 4.4.16-v7+. We need to have the Raspberry Pi in a semi-public space and display stuff on a TV, and we'd like to make it at least somewhat hard to mess with it. So far I've managed to make the usbhid module removable from the kernel via rmmod. After rmmod'ing the module, tt seems, though, that each time I plug in a USB keyboard or mouse, the device driver gets loaded back into the Kernel. Is there

Sqlite4java on Raspberry Pi

空扰寡人 提交于 2019-12-22 08:06:48
问题 I want to use my java project on Raspberry Pi. This code depends on sqlite4java which uses native implementations for many platforms including arm processors link. The problem is that java can't load required sqlite wrapper for arm processor. I was doing the follows: Copied all version (tried one by one) of precompiled libraries ( libsqlite4java-linux-armv5te.so , libsqlite4java-linux-armv7a.so , libsqlite4java-linux-arm.so ) which I renamed to libsqlite4java-linux-arm.so . Command java

Segmentation fault with opencv, in python on Raspberry

倖福魔咒の 提交于 2019-12-22 05:37:07
问题 I'm making a really simple program which capture a video from a Raspberry pi camera, using opencv in python. I'm using Raspbian as OS. I've already made a few programs with the version 2.4.5 of opencv and now i've installed opencv 2.4.9. All the programs that i used to run on the previous version of opencv are not working now, and i think i found the point in which the programs gives me errors. Just trying to launch the following code: import cv2 import numpy as np cap = cv2.VideoCapture(0)

Raspberry-pi docker error: standard_init_linux.go:178: exec user process caused “exec format error”

Deadly 提交于 2019-12-22 01:45:25
问题 I've installed docker in rapsbian according to the official instructions (i.e., running curl -sSL https://get.docker.com | sh ) but I'm not able to run the hello-world example (I've also tried other examples without success). This is the error I'm getting: pi@raspberrypi2:~ $ docker run hello-world standard_init_linux.go:178: exec user process caused "exec format error" My environment is Raspberry Pi 2 Model B with Raspbian GNU/Linux 8 (jessie) and Docker version 17.03.0-ce, build 60ccb22.

Unable to autolaunch a dbus-daemon without a $DISPLAY for X11. NetBeans. Pi as remote host

为君一笑 提交于 2019-12-22 00:34:10
问题 I am trying to run the following example code using my NetBeans IDE: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <dbus/dbus.h> int main() { DBusConnection *connection = NULL; DBusError error; char buffer[1024]; dbus_error_init(&error); connection = dbus_bus_get(DBUS_BUS_SESSION, &error); if (dbus_error_is_set(&error)) { fprintf(stderr, "%s", error.message); abort(); } puts("This is my unique name"); puts(dbus_bus_get_unique_name(connection)); fgets(buffer, sizeof

Soft-float version of Raspbian does not boot

亡梦爱人 提交于 2019-12-21 02:51:11
问题 I downloaded the hard float image of Raspbian here: http://www.raspberrypi.org/downloads I copied the recommended hard-float image on an SD card and the Raspberry Pi boots fine with it. Then I downloaded the soft-float version of Raspbian because I need it to get some software running that does not work on the hard-float version. I formatted the SD card again, copied the soft-float image onto it and tried to boot the Raspberry Pi with it. Problem: the Raspbery Pi doesn't boot with the soft