Go to advanced search

by DarkElvenAngel
Wed Jan 02, 2019 2:53 am
Forum: C/C++
Topic: How to get CPU load in C
Replies: 7
Views: 684

Re: How to get CPU load in C

Here is a code fragment from a program that I wrote. It is only a fragment because mine was a GTK graphical representation of load and that is more than you were asking for.... long a[9]; long up[5], up1[5], idle[5], idle1[5]; gint processors = 4; static gboolean one_second_timer_cb(gpointer data) ...
by DarkElvenAngel
Sun Dec 30, 2018 2:12 am
Forum: C/C++
Topic: How to get CPU load in C
Replies: 7
Views: 684

Re: How to get CPU load in C

Read /proc/stat, sleep for one second (say), and read it again, in a loop. Subtract each two values, and you have the time used in the interval. You may then convert that into a percentage. If USER_HZ is 1/100 sec, then you have your percentage directly! "lseek( fd, 0, SEEK_SET )" will do to repeat...
by DarkElvenAngel
Sat Dec 29, 2018 5:09 am
Forum: C/C++
Topic: How to get CPU load in C
Replies: 7
Views: 684

How to get CPU load in C

Hi, I'm rewriting my system monitor in C and I'm having trouble understand how to get a simple value for CPU load in a percentage. I looked at the /proc/stat file I know what I need is in there but I don't know how to get it. I fairly new to coding C for linux, I've been trying out conversations of ...
by DarkElvenAngel
Fri Dec 14, 2018 3:24 am
Forum: Advanced users
Topic: Need help making a deb package
Replies: 3
Views: 308

Re: Need help making a deb package

There are plenty of Debian guides on how to make a .deb file. I've made a few for local use myself. It's mostly a matter of building the file structure that the files will need to be installed to (with correct permissions and ownership set), then creating some files in a "DEBIAN" sub-directory whic...
by DarkElvenAngel
Thu Dec 13, 2018 10:55 pm
Forum: Troubleshooting
Topic: [TESTING] Upgrade fails, boot partition left full
Replies: 3
Views: 193

Re: Upgrade fails, boot partition left full

I've successfully created a deb package to replace the initramfs-tools 130 it executes an external script the deletes and rebuilds the initramfs image in the boot folder. apt install ./initramfs-tools.deb Reading package lists... Done Building dependency tree Reading state information... Done Note, ...
by DarkElvenAngel
Mon Dec 10, 2018 10:51 pm
Forum: Troubleshooting
Topic: [TESTING] Upgrade fails, boot partition left full
Replies: 3
Views: 193

Re: Upgrade fails, boot partition left full

So I have found the configuration script but when I change it to delete first it didn't work I downloaded and unpacked the initramfs-tools_0.130_all.deb package and edited this portion of the /DEBIAN/postinst file # Regenerate initramfs whenever we go to dpkg state `installed' if [ "x$1" != xtrigger...
by DarkElvenAngel
Mon Dec 10, 2018 3:31 am
Forum: Advanced users
Topic: Need help making a deb package
Replies: 3
Views: 308

Need help making a deb package

Hello I'm in need of help/advice, I've written a framework that runs on top of Raspbian and it's very difficult to move from my development system to my target machines. The framework includes services and scripts, it was originally designed to deploy on a kiosk and run a custom gui written in pytho...
by DarkElvenAngel
Mon Dec 10, 2018 1:21 am
Forum: Troubleshooting
Topic: [TESTING] Upgrade fails, boot partition left full
Replies: 3
Views: 193

Re: Upgrade fails, boot partition left full

UPDATE I've modified the /etc/initramfs-tools/update-initramfs.conf # # Configuration file for update-initramfs(8) # # # update_initramfs [ yes | all | no ] # # Default is yes # If set to all update-initramfs will update all initramfs # If set to no disables any update to initramfs beside kernel up...
by DarkElvenAngel
Mon Dec 10, 2018 1:09 am
Forum: Troubleshooting
Topic: [3B+] MAC problems
Replies: 2
Views: 165

Re: [3B+] MAC problems

Give this link a try https://raspberrypi.stackexchange.com/q ... ac-address
This will also give you a good idea of any google search terms to look for.
by DarkElvenAngel
Thu Dec 06, 2018 1:09 am
Forum: Troubleshooting
Topic: [TESTING] Upgrade fails, boot partition left full
Replies: 3
Views: 193

[TESTING] Upgrade fails, boot partition left full

Hello all, I've been attempting to solve this one for a while now. Straight to it, I've been investigating this issue for months it's hard to pin down because it doesn't happen with each upgrade. I've noticed it happens predictability with a kernel upgrade, however this last time there was no kernel...
by DarkElvenAngel
Fri Nov 23, 2018 7:48 pm
Forum: Troubleshooting
Topic: Running a script on kernel upgrade
Replies: 3
Views: 780

Re: Running a script on kernel upgrade [SOLVED]

I have solved the issue of running a sctipt durning a kernel update. This url was helpful https://kernel-team.pages.debian.net/kernel-handbook/ch-update-hooks.html Now basically you drop a script in the /etc/kernel/ hook / directory and set the execute bit. Tested that it works. The two existing scr...
by DarkElvenAngel
Thu Nov 22, 2018 4:16 am
Forum: Troubleshooting
Topic: Running a script on kernel upgrade
Replies: 3
Views: 780

Running a script on kernel upgrade

So I dug around and found some info Another problem Raspbian currently has no way to automatically update /boot/config.txt with new initrd.img file names. Every time you apply a kernel version update the install script hooks will generate a new initrd.img with a new file name. This will break our bo...
by DarkElvenAngel
Wed Nov 21, 2018 3:13 am
Forum: Advanced users
Topic: CGA Output from GERT666 (or other GPIO connection)
Replies: 6
Views: 1808

Re: CGA Output from GERT666 (or other GPIO connection)

Anything is possible, A level shifter is needed to take the 3.3v logic of the pi to 5v then you have the 4 signals for colour Red Green Blue Intensity, then the sync signals Vsync, Hsync You'd need to set the resolution to a maximum of 640x200 You most likely won't get true CGA out but 8 or 16(if yo...
by DarkElvenAngel
Wed Nov 21, 2018 2:54 am
Forum: Advanced users
Topic: Splash Screen
Replies: 4
Views: 1243

Re: Splash Screen

For splash screen, use this link that explain how to quickly show a splash screen : https://bootlin.com/blog/super-fast-linux-splashscreen/ I have a similar setup I've used this guide for a initrd boot splash. You need to install busybox and lzop's maximum compression is 6 not 9 like listed in The ...
by DarkElvenAngel
Wed Nov 21, 2018 1:56 am
Forum: Troubleshooting
Topic: Running a script on kernel upgrade
Replies: 3
Views: 780

Re: Upgrading Kernel brakes initrd img

Still stuck, I've tracked down two scripts # ls /etc/kernel/*/initramfs-tools /etc/kernel/postinst.d/initramfs-tools /etc/kernel/postrm.d/initramfs-tools However they look like they should work as is one deletes the old initrd and the other creates a new one. During an upgrade this doesn't happen. T...
by DarkElvenAngel
Mon Nov 19, 2018 8:25 pm
Forum: Troubleshooting
Topic: Drive Spin Down
Replies: 1
Views: 518

Re: Drive Spin Down

Yes there is a command to get the state of the drive

Code: Select all

hdparm -C /dev/sdX 
This will tell you if the drive is standby or active/idle
by DarkElvenAngel
Mon Nov 19, 2018 7:07 pm
Forum: Troubleshooting
Topic: Running a script on kernel upgrade
Replies: 3
Views: 780

Running a script on kernel upgrade

I've been having an issue whenever my pi upgrades the kernel and the initrd image needs upgrading as well... The problem is that even though a script runs and triggers this automatically as part of the the apt upgrade it fails almost everytime forcing me to do it manually. What I would like to do is...
by DarkElvenAngel
Wed Oct 17, 2018 1:29 am
Forum: Beginners
Topic: Rii MX3 airmouse and raspbian stretch
Replies: 2
Views: 239

Re: Rii MX3 airmouse and raspbian stretch

This device is USB not i2c. From the looks of things it's just a wireless keyboard, can you type on it and you get text on the screen?
by DarkElvenAngel
Sun Oct 14, 2018 3:06 am
Forum: Advanced users
Topic: Audio from RasPi to RasPi
Replies: 1
Views: 238

Re: Audio from RasPi to RasPi

Funny someone else is working on something similar to this.

Check this out it might be helpful

http://www.codingmama.io/tutorials/audi ... ts-i2s-mic
by DarkElvenAngel
Sat Oct 13, 2018 1:01 pm
Forum: Beginners
Topic: LED light for WIFI status - polling
Replies: 18
Views: 732

Re: LED light for WIFI status - polling

If you need help with read only let me know I have done it several times.

It can be especially tricky if you need space that is writable and your headless some of the error don't show up.
by DarkElvenAngel
Fri Oct 12, 2018 6:24 pm
Forum: Beginners
Topic: LED light for WIFI status - polling
Replies: 18
Views: 732

Re: LED light for WIFI status - polling

I just came across this this program for a wifi activity LED on the gpio. https://github.com/RagnarJensen/PiLEDlights Might be useful. I also found this http://www.codingmama.io/tutorials/audio-streaming-with-raspberry-pi-zero-w-and-adafruits-i2s-mic Is this like what you are trying to do? I can adv...
by DarkElvenAngel
Thu Oct 11, 2018 3:40 pm
Forum: Beginners
Topic: LED light for WIFI status - polling
Replies: 18
Views: 732

Re: LED light for WIFI status - polling

I've sorted it out. # light led while Wi-Fi is connected if [[ ! -d /sys/class/gpio/gpio17/ ]] then echo 17 > /sys/class/gpio/export echo out > /sys/class/gpio/gpio17/direction fi case "$reason" in CARRIER) echo 1 > /sys/class/gpio/gpio17/value ;; NOCARRIER) echo 0 > /sys/class/gpio/gpio17/value ;; ...
by DarkElvenAngel
Thu Oct 11, 2018 3:10 am
Forum: Troubleshooting
Topic: push button to trigger a 30 minute heating boost.
Replies: 5
Views: 237

Re: push button to trigger a 30 minute heating boost.

To answer your questions, Driving a gpio pin high like in the link you sent will not hurt anything and power loss is non-existent. Many electronics have jumpers that run pins high for the life time of the device with no ill effects, The Raspberry Pi Foundation has a great resource on their site that...
by DarkElvenAngel
Thu Oct 11, 2018 2:25 am
Forum: Beginners
Topic: How to check validity of WiFi?
Replies: 6
Views: 300

Re: How to check validity of WiFi?

You can use

Code: Select all

iw wlan0 info
you get output like this

Code: Select all

Interface wlan0
        ifindex 2
        wdev 0x1
        addr 12:34:56:78:90:ab
        ssid YOUR-SSID
        type managed
        wiphy 0
        channel 2 (2417 MHz), width: 20 MHz, center1: 2417 MHz
        txpower 31.00 dBm
by DarkElvenAngel
Thu Oct 11, 2018 2:14 am
Forum: Beginners
Topic: LED light for WIFI status - polling
Replies: 18
Views: 732

Re: LED light for WIFI status - polling

I am encoding with ARecord and FFserver at the source, with a Alesis Core 1 on USB and a Pi Zero W I decode at the other end with MPG123 and a pHAT DAC to output analogue audio again It's encode via mono mp3 over the network at around 64-128 kbps. It's mainly speech. I am still playing with getting...

Go to advanced search