Change hearbeat led on beaglebone black with device tree overlay - overlay

I am using the Debian wheezy filesystem with Robert Nelson's latest kernel.
I want to disable the heartbeat led using a device tree overlay.
I understand there are easier ways of doing this but I am only interested in answers using overlays to disable the heartbeat led.
One way I can achieve this is by changing the gpio-leds,led0 leaf in am335x-boneblack.dts
from:
linux,default-trigger = "heartbeat";
to
linux,default-trigger = "none";
then compiling the device tree and rebooting.
However if I try to implement the same thing using the following overlay the heartbeat led continues to flash after I successfully apply the overlay with echo > $SLOTS.
What am I doing wrong?
/dts-v1/;
/plugin/;
/
{
compatible = "ti,beaglebone", "ti,beaglebone-black";
part-number = "pru";
version = "00A0";
fragment#0
{
target = <&ocp>;
__overlay__
{
gpio-leds
{
compatible = "gpio-leds";
pinctrl-names = "default";
pinctrl-0 = <0x3>;
led0
{
label = "beaglebone:green:usr0";
gpios = <0x5 0x15 0x0>;
linux,default-trigger = "none";
default-state = "off";
};
};
};
};
};

There's a systemd service, leds.service, that overrides the device tree settings for this one led (who knows why).
To see the status of the service, run
root#beaglebone:~# systemctl status leds.service
which gives the output
leds.service - Angstrom LED config
Loaded: loaded (/lib/systemd/system/leds.service; enabled)
Active: active (exited) since Sat 2000-01-01 18:33:24 UTC; 13 years 7 months ago
Process: 125 ExecStart=/usr/bin/led-config start (code=exited, status=0/SUCCESS)
CGroup: name=systemd:/system/leds.service
By looking at the "Loaded" field you can see that the service script is located at /lib/systemd/system/leds.service, and the "Process" field says the this service runs the command "/usr/bin/led-config start".
Looking at this file "/usr/bin/led-config" you'll see that it's a shell script that loads defaults from the file "/etc/default/leds":
#file format: name trigger
beaglebone::usr0 heartbeat
So, you can leave the device tree file alone and set the defaults here, or disable this service with
systemctl disable leds.service

To disable the heartbeat with an overlay is very inefficient in my opinion! How about instead try typing in the bash command: "echo none > /sys/devices/ocp.3/gpio-leds.8/beaglebone\:green\:usr0/trigger" and then to turn them back on 'echo "heartbeat" > trigger' (check the file path first) - tested on Debian Wheezy A5A

Related

Program and Run PIC18 with pickit4 on linux

I am on linux ubuntu and target is a PIC18F47J53.
I basically want to program the chip and then let it run, using command lines and using pickit4.
using ipecmd (from mplab x ide v5.45), this is my command:
/opt/microchip/mplabx/v5.45/sys/java/zulu8.40.0.25-ca-fx-jre8.0.222-linux_x64/bin/java -jar /opt/microchip/mplabx/v5.45/mplab_platform/mplab_ipe/ipecmd.jar -TPPK4 /P18F47J53 -M -F"/path_to_myfile.hex" -W
This is my output
DFP Version Used : PIC18F-J_DFP,1.4.41,Microchip
*****************************************************
Connecting to MPLAB PICkit 4...
Currently loaded versions:
Application version............00.06.66
Boot version...................01.00.00
Script version.................00.04.17
Script build number............db473af2f4
Tool pack version .............1.6.961
PICkit 4 is supplying power to the target (3.25 volts).
Target device PIC18F47J53 found.
Device Revision Id = 0x1
*****************************************************
Calculating memory ranges for operation...
Erasing...
The following memory area(s) will be programmed:
program memory: start address = 0x0, end address = 0x3ff
program memory: start address = 0x1fc00, end address = 0x1fff7
configuration memory
Programming/Verify complete
Program Report
30-Jan-2021, 12:54:41
Device Type:PIC18F47J53
Program Succeeded.
Operation Succeeded
All good, and takes about 12 seconds, however, after that the pickit4 turns off the power target, and the pickit LED is BLUE (I guess state "ready")
The main question is how can I let the pickit4 powering the boards? any specific parameter? (I cannot find on the readme.html)
If I use MPLAB X IPE GUI to program, the programming is much quicker (3 or 4 seconds), the pickit LED is YELLOW and the target is left powered on. (I selected "release from reset")
I have tried to get the log out with as many details as possible, but I cannot see the commands sent to the pickit4.
Any idea? thanks
I realize that it's been a while since you asked, but i put the answer here for anyone who needs it. Add -OL to your command line options.

VcXsrv WSL X server closes unexpectedly. Do I need to disable GPU?

I am trying to run some code with pybullet. I am on windows 10, have the latest vscode, and I am using WSL remote on vscode with ubuntu 18.04 LTS. I have a GTX 2070 graphics card. I just want to see this work, I've been trying to fix it for the last 3 hours.
First, here is the code I am trying to run in WSL:
import numpy as np
import pybullet as pb
physicsClient = pb.connect (pb.GUI)
#load plane
import pybullet_data
pb.setAdditionalSearchPath(pybullet_data.getDataPath())
planeId = pb.loadURDF('plane.urdf')
#load visual shape
visualShapeId = pb.createVisualShape(
shapeType=pb.GEOM_MESH,
fileName='random_urdfs/000/000.obj',
rgbaColor=None,
meshScale=[0.1, 0.1, 0.1])
collisionShapeId = pb.createCollisionShape(
shapeType=pb.GEOM_MESH,
fileName='random_urdfs/000/000_coll.obj',
meshScale=[0.1, 0.1, 0.1])
multiBodyId = pb.createMultiBody(
baseMass=1.0,
baseCollisionShapeIndex=collisionShapeId,
baseVisualShapeIndex=visualShapeId,
basePosition=[0, 0, 1],
baseOrientation=pb.getQuaternionFromEuler([0, 0, 0]))
I get no errors, but the X server window will pop up (black) and close immediately. I read that you need to disable your GPU with WSL, but I am scared of messing up my PC. I would only want to disable it for when I need to see graphics / use the X server, not for all WSL applications.
Here is what shows in my bash script:
user#DESKTOP-######:~/program$ python3 openAI.py
pybullet build time: Sep 22 2020 00:54:31
startThreads creating 1 threads.
starting thread 0
started thread 0
argc=2
argv[0] = --unused
argv[1] = --start_demo_name=Physics Server
ExampleBrowserThreadFunc started
X11 functions dynamically loaded using dlopen/dlsym OK!
X11 functions dynamically loaded using dlopen/dlsym OK!
Creating context
Failed to create GL 3.3 context ... using old-style GLX context
Indirect GLX rendering context obtained
Making context current
GL_VENDOR=NVIDIA Corporation
GL_RENDERER=GeForce RTX 2070 SUPER/PCIe/SSE2
GL_VERSION=1.4 (4.6.0 NVIDIA 451.67)
GL_SHADING_LANGUAGE_VERSION=(null)
pthread_getconcurrency()=0
Version = 1.4 (4.6.0 NVIDIA 451.67)
Vendor = NVIDIA Corporation
Renderer = GeForce RTX 2070 SUPER/PCIe/SSE2
Segmentation fault (core dumped)
user#DESKTOP-######:~/program$
#Emilio, I have got this working without any changes to the GPU, using the following process:
I used the VcXsrv application set up in the same way as this tutorial : https://jack-kawell.com/2020/06/12/ros-wsl2/ where crucially Native openGL is unchecked.
Export your ip address as in the tutorial, however instead of 'export DISPLAY={your_ip_address}:0.0', go to the VcXsrv window (which should be blank at this point) and replace :0.0 with whatever number of display is given. So for Display DESKTOP-1234AB:1.0 you would enter 'export DISPLAY={your_ip_address}:1.0'
In the linux terminal enter: export LIBGL_ALWAYS_INDIRECT=0
You can check that this has made an effect by entering: glxinfo
Which should print out:
direct rendering: yes
When you run your python program it should open up in the VcXsrv window. For me there was no cursor visible but I could still interact with the object as if I did have a cursor.

EasyPHP Webserver - Dashboard - http://127.0.0.1:10000 No longer loading

I am running EasyPHP Webserver 14.1 on Win Server 2012.
When I first installed it the dashboard loaded fine.
Now that I have built up my PHPbb3 forum it no longer loads. The browser continuously states
Waiting for response from 172.0.0.1...
but nothing happens, it just keeps spinning trying to load.
Is there any way I can fix /restore / reinstall the dashboard without affecting any work I've done on PHPbb3?
If it helps after some searching on this forum I created a .bat file containing:
ews-dashboard.exe -S 127.0.0.1:10000 -c ews-dashboard.ini cmd /k
This opens a CMD window containing the following:
C:\Program Files (x86)\EasyPHP-Webserver-14.1b2\dashboard>ews-dashboard.exe -S 127.0.0.1:10000 -c ews-dashboard.ini
PHP 5.4.30 Development Server started at Tue Nov 14 14:33:33 2017
Listening on http://127.0.0.1:10000
Document root is C:\Program Files (x86)\EasyPHP-Webserver-14.1b2\dashboard
Press Ctrl-C to quit.
But this doesn't seem to change anything.
it will work if you change the current port.
start-ews.bat
ews-dashboard.exe -S 127.0.0.1:1000 -c ews-dashboard.ini cmd /k
ews-dashboard.ini
[ServiceEx]
ServiceExeFullPath = "D:/Program Files/EasyPHP-Webserver\dashboard\ews-dashboard.exe"
; program arguments to be sent to executable
options = "-S 127.0.0.1:1000"
; can program interact with desktop [true | false] (default: true)
desktop = false
; start type (valid values: Auto Manual Disabled) (default: auto)
Start=Auto
; start the service upon installation [true | false] (default: no)
StartNow=true

kdmf pnp driver cannot find device when installing

I am trying to create a pnp driver but when I run sc start driver-name I get an System error 1058 (disable disabled or no enabled device associated). However if I modify the code for nonpnp WDF_DRIVER_CONFIG_INIT(&config, WDF_NO_EVENT_CALLBACK); and config.DriverInitFlags |= WdfDriverInitNonPnpDriver; the service starts and I am able to debug.
I have tried different hwid values for the device verified through device manager. The DriverEntry runs fine, I've used windbg but the device add function is never called.
Driver Entry Code for pnp.
// prototype for add device function
EVT_WDF_DRIVER_DEVICE_ADD QDeviceAdd;
NTSTATUS DriverEntry(
IN OUT PDRIVER_OBJECT DriverObject,
IN PUNICODE_STRING RegistryPath
)
{
NTSTATUS status = STATUS_SUCCESS;
WDF_DRIVER_CONFIG config;
WDFDRIVER hDriver;
PWDFDEVICE_INIT pInit = NULL;
WDF_OBJECT_ATTRIBUTES attributes;
KdPrint(("enabling wpp tracing\n"));
WPP_INIT_TRACING(DriverObject, RegistryPath);
WDF_DRIVER_CONFIG_INIT(
&config,
QDeviceAdd // WDF_NO_EVENT_CALLBACK This is a non-pnp driver.
);
WDF_OBJECT_ATTRIBUTES_INIT(&attributes);
attributes.EvtCleanupCallback = QEvtDriverContextCleanup;
status = WdfDriverCreate(DriverObject,
RegistryPath,
&attributes,
&config,
&hDriver);
if (!NT_SUCCESS(status)) {
KdPrint(("NonPnp: WdfDriverCreate failed with status 0x%x\n", status));
WPP_CLEANUP(DriverObject);
return status;
}
return status;
}
Apparently previous copies of the inf file remained in the store and registry wasn't being updated so after some digging I ended doing the following:
checking in C:\Windows\Inf\setupapi.dev.log and copying the the missing file.
Then deleted the driver from store using pnputil
pnputil -d oemXX.inf
manually removed the key
HKLM\SYSTEM\CurrentControlSet\Control\Class{your-class-id}
pnputil -i /path/to/inf
Thanks to this site and this post

How to detect chroot on illumos/solaris?

How can a running C-program detect if it is running in "chroot" on illumos/solaris?
There is a Debian utility [1] which uses some tricks on linux, freebsd, hurd.
How to do it on illumos/solaris?
[1] http://anonscm.debian.org/gitweb/?p=users/clint/debianutils.git;a=blob;f=ischroot.c;h=bed67f9f655d26906e3d65fd290698dce5402a89;hb=HEAD
There's this thread on comp.unix.solaris which details various methods to find out whether Solaris runs inside a zone (container / chroot-on-lots-of-steroids) or a VM. Particularly extensive is the list in this posting (seems to have come from this blog post. I'll recreate some of the items relating to zones here - those that are available to non-root users.
The /usr/bin/zonename command tells you something different than "global"
The Solaris kernel "process" is called sched in a non-zoned (or inside the "global" / admin zone) environment but zsched inside a zone.
The Solaris prstat command (similar to top on other UN*Xes) has -z / -Z command line options to restrict reporting to specific zones (-z) or give statistics for all zones (-Z); inside a zone, these options don't work / only show you the zone you're running inside.
Hope that helps a little.
I used this way:
#elif defined (__sun__)
/* Similar to Linux
* XXX: check zone?
* XXX: illumos kernel automatically mounts /proc on boot
*/
static int ischroot()
{
struct stat st1, st2;
if (stat("/", &st1))
return 2;
if (stat("/proc/1/root", &st2))
return 2;
if ((st1.st_dev == st2.st_dev) && (st1.st_ino == st2.st_ino))
return 1;
return 0;
}
#else