Hot answers tagged

11

First to shine a light on this mish/mash of different commands. On Raspbian there are three concurrent network environments installed: old style debian networking with ifupdown is configured in etc/network/interfaces but it is deprecated. The default networking environment of Raspbian is managed by dhcpcd and configured in /etc/dhcpcd.conf. Old style ...


9

First, if the script is run by a system daemon and that daemon is running with root privileges, you do not need to use sudo. This includes init (and systemd), which includes rc.local. If that daemon is not running with root privileges, then sudo will not work unless /etc/sudoers is configured to allow such (and without a password). Raspbian users may be ...


6

I'm not aware of any ready built solution for your needs. However you could write your own with not very much effort. How many different calls do you make to the gpio functions? You might find you use less than 10. Just create your own local Python module named the same as your target module and produce stubs for the functions you use. E.g. if you use ...


5

For reference here is a diagram of the GPIO for the Pi 2 and the Pi 3: The GPIO layout is the same, differences between the Pi 2 and Pi 3 include: The Pi 3 has on-board Wi-Fi and Bluetooth The Raspberry Pi 2 has a quad-core 900MHz CPU, the Pi 3 a quad-core 1.2GHz one. Both have 1GB RAM and both use a fourth-generation VideoCore CPU The Pi 2 uses a Cortex-...


4

This looks exactly the same as this issue: https://github.com/raspberrypi/linux/issues/766 Fixed four days ago.


4

GPIO Zero provides a mock pin interface, meaning you can run the same code on your PC and emulate the pins. See examples of how it's used in the test suite.


4

Redirect output and errors to a file: myscript.sh >> /home/pi/log.txt 2>&1 &


3

One important aspect people tend to forget when running scripts as daemons is shell environment, and $PATH variable in particular. In your example, the second line relies on $PATH: the full name of sudo is /usr/bin/sudo, and your user shell only knows that because it was told to search /usr/bin when looking for executables. The same is true for bar. ...


3

Well I found the solution for me - hopefully it helps you too! Found that /var/log/openvpn.log on the RPi had the line "VERIFY ERROR: depth=0, error=CRL has expired" Searching that gave several results saying to regenerate the Certificate Revocation List, but I couldn't find how to do this with pivpn. Found this workaround and it worked: use pivpn to add a ...


3

I would recommend taking a look at this site http://www.makeuseof.com/tag/emulate-raspberry-pi-pc/ which describes how to emulate the original raspberry pi on a pc. You then should be able to debug and run assembly code on the emulated raspberry pi that you created.


3

I was getting a pure virtual method called exception when cross-compiling. @JeremyBarnes's answer did not quite work for me. Instead I used: -U__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 -U__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 -U__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 Explaination: As @JeremyBarnes pointed out, to ensure ABI compatibility of your application with the ...


3

The easiest way to a binary compatible cross-compilation is to install the toolchain used by Raspbian developers. It can be found here. It's essential to use this toolchain if you want to build the kernel and drivers, as kernel objects require perfect ABI compatibility, but having perfect compatibility won't hurt if you're building userspace binaries as well....


3

I made this little library, fedeb95/pin that proved useful for me. Lacks some features, but if it suits you... it worked for me. Edit: pin is a RPi.GPIO wrapper. Instead of calling method x of RPi.GPIO you call method x of pin. You can specify in a configuration file if your program is running in test mode (wyere you read random values from pins, or values ...


2

Being a newbie to Python and the Pi I didn't understand Joan's answer and needed a simple (bot not elegant!) way of testing my program on the PC without error messages caused by missing GPIO calls. I simply choose what sections of code to run by checking what machine I'm running on. I can then emeluate a GPIO call - like a switch closing - from the PC ...


2

I suppose you could use mocking libraries like Mock. They are mostly used for Unit Testing, but I'm pretty it would work very well in your case. And you would probably be better of trying it by writting some unit tests. It replaces on-the-go an existing class, and you just have to write yourself the behaviour you're looking for. It allows you not to change ...


2

There's a library you can download here: https://roderickvella.wordpress.com/2016/06/28/raspberry-pi-gpio-emulator/ Or there's a simulator which lets you write and test the python code here: http://blog.withcode.uk/2016/10/rpi-gpio-python-simulator/


2

I had this same problem with several Model B's running Wheezy. Its only responsibility was to run WeeWx weather station software, so it was not doing all that much. Experiencing the same failure on multiple Pi's indicates either a poor IC design, or a driver issue. What I found was that the OS thought the LAN was up and running, but pings from other ...


2

Your Pi is not running. You don't give enough information to tell what is wrong, but the following link gives diagnostic information. http://elinux.org/R-Pi_Troubleshooting


2

Yes, the /boot/cmdline.txt gets read correctly and can be verified by checking: cat /proc/cmdline


2

FWIW, this can be fixed by adding -D__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 -D__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 -D__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 to the compiler flags. Why? In /usr/include/c++/4.{8,9}/bits/concurrency.h, the default lock policy depends upon these defines: #if (defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2) \ && defined(...


2

No need to spend money on a solution. Download and install the Visual C++ for Linux Development extension. This tool allows you to compile / build programs on your remote Linux device. You will be using your desktop Visual Studio as an editor, file manager and debugger. No need to download anything from VisualGDB.com. Instead you will be adding some ...


2

This is almost certainly a power issue. The recommended power supply is at least 1 amp and 2 amps is what is suggested for proper performance. Powering the mouse and WiFi via the Pi, might be possible with a better power supply, however, I would suggest a powered USB hub. A quick search of this site will show many WiFi related problems can be traced to ...


2

the annoyingly undetailed Segmentation fault error message If this is happening something is probably broken, and if you have really replaced the executable repeatedly, it is likely something it links to -- a library, but obviously not too critical a one or else you would be having this problem with other things as well (or, it could be the broken bit is in ...


2

You don't have node in your $PATH, only nodejs. That's a quirk of Debian-based systems due to a naming conflict. You need to install nodejs-legacy to fix. sudo apt-get install nodejs-legacy Or, if that does not work, symlink node to nodejs: sudo ln -s $(which nodejs) /usr/local/bin/node


2

The correct syntax to enable this is dtparam=sd_debug=on. After putting this in config.txt, debug information from the SD driver should show up in dmesg.


2

The debug messages you are asking about are on a stage where only the boot loader is running but not even the kernel is loaded. So there is no chance to have logging to a file because there is nothing what managed it. But you can enable the boot loader to output messages to the serial debug console. For this you need an USB to TTL (RS232) serial cable. An ...


1

The default route needs a Gateway where to send packages with a destination the kernel does not know. The Gateway must be a host (router) on the same network the RasPi is direct connected to with an interface. According to your routing table the RasPi is connected to two subnets: 10.0.0.0/24 with addresses from 10.0.0.1 to 10.0.0.254 on interface ...


1

on raspbian, you can access logs by typing dmesg, or dmesg>file to save the logs to a file, you can also look in /var/log, especially /var/log/syslog. not sure if this will work on your os, hopefuly it does! also, I think to get more logs on at startup you can install bootlogd with apt-get install bootlogd then look in /var/log


1

Yes, that should work. You could bit bang a serial link on other GPIO but as you say you would have to write your own drivers. Another alternative is to use a USB serial dongle. You could plug the USB end into the Pi.


1

The original answer can be found at this link Basically I was on XFCE and did not realize it. You must edit the lights.conf file to allow auto login. Instructions on that site.


Only top voted, non community-wiki answers of a minimum length are eligible