Go to advanced search

by DarkElvenAngel
Mon Apr 22, 2019 4:01 am
Forum: C/C++
Topic: C/C++ Memory Usage Code
Replies: 22
Views: 2131

Re: C/C++ Memory Usage Code

Okay he is the code. This code on its own will not do anything it is part of my GUI project. (I forgot I copied it from my system monitor because I needed to see how much CPU I was using.) since I wanted to share something that works I stripped out all the functions that weren't needed to get it goi...
by DarkElvenAngel
Thu Apr 18, 2019 1:26 am
Forum: C/C++
Topic: C/C++ Memory Usage Code
Replies: 22
Views: 2131

Re: C/C++ Memory Usage Code

sysmon2.png sysmon1.png Screen shots from lxTerminal connected over ssh. I was going to post the unedited mess of my system monitor's cpustat.c , But it looks like I was not as concerned with comments, or naming conventions as I am now. I'd only started learning C last year for use on the raspberry...
by DarkElvenAngel
Wed Apr 17, 2019 10:49 pm
Forum: C/C++
Topic: C/C++ Memory Usage Code
Replies: 22
Views: 2131

Re: C/C++ Memory Usage Code

I can post my code but I'll have to modify it first so it will compile and run as I have used hard coded links for my framework that will not be present. As well as a custom library.

I tried posting screenshots but they didn't work properly. I'll have time this weekend to post the code.
by DarkElvenAngel
Wed Apr 17, 2019 11:37 am
Forum: C/C++
Topic: C/C++ Memory Usage Code
Replies: 22
Views: 2131

Re: C/C++ Memory Usage Code

For ease of use and production speed, it's a great function; however, in my tests it was much slower at retrieving values, and it costs an extra library and memory usage. Do you have numbers on that I'm interested if I can trim down my system monitor to be more efficient right now pulling CPU data ...
by DarkElvenAngel
Tue Apr 16, 2019 3:21 am
Forum: C/C++
Topic: C/C++ Memory Usage Code
Replies: 22
Views: 2131

Re: C/C++ Memory Usage Code

I've been working on a system monitor and had I been paying attention to my threads I would have seen this sooner. Memory usage is easy to get you use #include <sys/sysinfo.h> Here is the struct it defines struct sysinfo { long uptime; /* Seconds since boot */ unsigned long loads[3]; /* 1, 5, and 15...
by DarkElvenAngel
Wed Jan 02, 2019 2:53 am
Forum: C/C++
Topic: How to get CPU load in C
Replies: 15
Views: 1285

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: 15
Views: 1285

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: 15
Views: 1285

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: 357

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: 247

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: 247

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: 357

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: 247

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: 212

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: 247

[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: 899

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: 899

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: 2207

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: 1583

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: 899

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: 574

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: 899

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: 307

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: 277

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: 916

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.

Go to advanced search