Android kernel LED control - button

Im new to this forum so be nice ;) i have followed rules :)
I am helping the dev for my kernel that I use. Since the mod I want is mainly only for me i figured its my duty to get it working myself.
The problem:
I have edited my *.kl files to disable the five front facing hardware buttons from waking the device and only allow the volume up / down buttons to wake the device as the front facing buttons get pressed when its in my pocket.
However, even though the front facing buttons no longer turn on the device , when they get pressed they light up adding an extra 6mA drain .
What I've tried:
I wrote an apk to change the permissions of the /sys/class/leds/button-backlight/brightness file to keep them off. Despite the program working , permissions allow the file be edited, causing them to light up.
What i need help on:
I downloaded my dev's kernel using git and I want to edit the kernel myself to keep the button lights off during sleep . However kernel code is not my comfort zone .. so i need help .
Thanks everyone for helping and simply just reading !

1) Messing with code is a bad idea (especially if you lack skill and don't know C and UNIX).
2) what you are probably looking for is script that will run on startup (initrc) and there you need to set it and change permissions using chmod command.
Thus you need to Setup what you want (with echo command presumably) -> change permissions so file can not be rewritten (chmod) -> put two commands in initrc.
Kernel can be like any other configured using make menuconfig and then compiling it, in that case you just disable stuff that you don't like.
[OT] I may be off though, your (original) question (there was no question mark) did not make too much sense here and there. Read this howto: How To Ask Questions The Smart Way from Eric Steven Raymond. Thanks.

Related

VSCode : mvbasic extension on editing Unidata code with MV marks in code, ie CHAR(253), CHAR(254)

I have searched for a setting within the mvbasic extension within VSCode but I may have hit a dead end. I am new to using VSCode with the rocket mvbasic extension and still in the learning process, so please bear with me.
Our development for the most part has always been directly on the server using the editor within it to code and develop on a Unix/Aix platform with Unidata. Some of our code has array assignments with CHAR(253)/CHAR(254) characters within them. See the link to the image that shows how its done. Now I didn't do this code, the original software developer did this many many years ago and we just aren't going to go and change it all.
How code looks on actual server
The issue is when pulling the code to edit in VSCode, the extension is changing it, and I uploaded it back and didn't pay attention and it was implemented in our production incorrectly, which created a few bugs.
ALIST="H�V�P�R�M�D"
How code looks in VSCode
How code looks after uploaded back to server from VSCode
Easy to fix, no biggie, but now to my question.
Does anyone have this issue, or has a direction to point me into that maybe I need to create a setting to keep the characters in the correct ASCII format so that this doesn't happen again by mistake?
VSCode defaults to the sane choice for character encoding in 2022: utf-8, but sometimes you have to deal with legacy stuff.
https://code.visualstudio.com/docs/editor/codebasics#_file-encoding-support
If you click on the UTF-8 in the bottom right corner you can choose "Reopen with Encoding":
After that, you can select a different encoding. I chose DOS (CP437) at a guess and literal MV characters are displayed as superscript 2 (²), and for me I can save to the server and confirm those characters remain as #VM after a round trip (though for my terminal emulator they appear as } which is useful).
You can edit preferences and set "files.encoding": "cp437". One other thing that can be helpful if your programs don't have a standard extension (like .bas) as most don't is to set the default mode to basic so most of what you're editing will identify as MVbasic, and you can do a quick CTRL-K M to switch to any other modes if you're just pasting in something else like SQL.
Some useful links - the Rocket forums are helpful and the folks there are always super nice
https://community.rocketsoftware.com/forums/multivalue?CommunityKey=521bce2e-71d5-4d32-b560-dfa95e950eb5
The MV Extensions Community extension is a good group and always has been helpful when I've had issues. I've made some small contributions - they're very open. I prefer this extension, but honestly haven't done a deep comparison.
https://github.com/mvextensions

How to set up node-red on rasbian to get information from a ble-energy-harvesting button?

at first: I'm not a BLE expert so I try to describe my problem as good as I can and I apologize in advance if I don't use the right terms or definitions.
I've bought a BLE-Energy-Harvesting button of type PTM 215B (1).
I've installed node-red on Raspberry-Pi 2b (2)
Locally on node-red the package node-red-contrib-generic-ble was install with npm (3)
when node-red is started I can see the elements of generic-ble-package and so I tried to configure the "Generic Ble In"-Item.
When I scan for devices, I have to push and release the button several times till it is shown in the list - that's no wonder because without these actions the button has no energy.
But then it gets complicated. When I click on "Apply", the item tries to get the GATT(ributes) from the button.The problem is - as far as I understood - the button doesn't have any.
From the CLI I've used bluetoothctl to scan for devices and I've seen that the button is always recognized by the system (on-button-pressed and on-button-released).
I've also tried with different other node-red packaged but they had even more problems ( e.g. noble (4) could not be installed properly and it looks like abandoned )
I assume the problem is sitting in front of the screen but this is the second Saturday I'm trying to "install a button" and I really don't know how to proceed.
I've read (somewhere) that one of the strength of BLE is the possible usage of energy-harvesting -sensors. But does the "general-ble"-package do the job?
-If yes, how?
-If no, which package should I use?
I'd really like to use a node-red-package because I want to expand an already existing flow.
I appreciate any help and/or link.
Thank you in advance.
Regards,
Mr P
Additional info:
Raspbian: VERSION="10 (buster)"
npm --version: 6.14.8
node-red: 1.2.6: Maintenance Release
Ref.
(1) https://www.enocean.com/en/products/enocean_modules_24ghz_ble/ptm-215b/
(2) https://nodered.org/docs/getting-started/raspberrypi
(3) https://flows.nodered.org/node/node-red-contrib-generic-ble
(4) https://flows.nodered.org/node/node-red-contrib-noble
I found the way to do the job:
I installed the ble-beacon-scanner (1) and that works fine for my purpose.
As I understood: Beacons use ble-notifications, which don't share attributes and don't need a continuous connectivity.
The generic library unfortunately doesn't offer this part of the ble-protocol.
Thank you all.
Regards,
Mr P
(1) https://flows.nodered.org/node/node-red-contrib-blebeacon-scanner

KDE Taskbar Progress

I am trying to show a progress in the taskbar of the plasma desktop using the KDE Frameworks. In short, it want to do the same thing as dolphin, when it copies files:
I'm kinda stuck, because I don't even know where to get started. The only thing I found that could be useful is KStatusBarJobTracker, but I don't know how to use it. I could not find any tutorials or examples how to do this.
So, after digging around, and thanks to the help of #leinir, I was able to find out the following:
Since Plasma 5.6 KDE supports the Unitiy DBus Launcher-API, which can be used, for example, to show progress
I found a post on AskUbuntu that explains how to use the API with Qt
The real problem is: This only works, if you have a valid desktop file in one of the standard locations! You need to pass the file as parameter of the DBus message to make it work.
Based on this information, I figured out how to use it and created a GitHub repository, that supports cross platform taskbar progress, and uses this API for the linux implementation.
However, here is how to do it anyways. It should work for KDE Plasma and the Unity desktop, maybe more (haven't tried any others):
Create a .desktop file for your application. For test purpose, this can be a "dummy" file, that could look like this:
[Desktop Entry]
Type=Application
Version=1.1
Name=MyApp
Exec=<path_to>/MyApp
Copy that file to ~/.local/share/applications/ (or wherever user specific desktop files go on your system)
In your code, all you need to do is execute the following code, to update the taskbar state:
auto message = QDBusMessage::createSignal(QStringLiteral("/com/example/MyApp"),
QStringLiteral("com.canonical.Unity.LauncherEntry"),
QStringLiteral("Update"));
//you don't always have to specify all parameters, just the ones you want to update
QVariantMap properties;
properties.insert(QStringLiteral("progress-visible"), true);// enable the progress
properties.insert(QStringLiteral("progress"), 0.5);// set the progress value (from 0.0 to 1.0)
properties.insert(QStringLiteral("count-visible"), true);// display the "counter badge"
properties.insert(QStringLiteral("count"), 42);// set the counter value
message << QStringLiteral("application://myapp.desktop") //assuming you named the desktop file "myapp.desktop"
<< properties;
QDBusConnection::sessionBus().send(message);
Compile and run your application. You don't have to start it via the desktop file, at least I did not need to. If you want to be sure your application is "connected" to that desktop file, just set a custom icon for the file. Your application should show that icon in the taskbar.
And thats basically it. Note: The system remembers the last state when restarting the application. Thus, you should reset all those parameters once when starting the application.
Right, so as it turns out you are right, there is not currently a tutorial for this. This reviewboard request, however, shows how it was implemented in KDevelop, and it should be possible for you to work it out through that :) https://git.reviewboard.kde.org/r/127050/
ps: that there is no tutorial now might be a nice way for you to hop in and help out, by writing a small, self contained tutorial for it... something i'm sure would be very much welcomed :)

A way to chart CPU Usage by application using top -u

I am trying to really diagnose an awful battery consumption issue with my jailbroken iOS device and I believe a random spike in CPUis causing this. Is there a way to chart/graph out the output from top -u in MobileTerminal so I can analyze to see if anything is causing that spike?
Appreciate the input here or if anyone has another tool. I have used iCleaner Pro to disable tweaks as well as run a semi-restore. I would like to be able to troubleshoot this without loosing my jailbreak.
Thanks!

QFile: cannot retrieve size from PHYSICALDRIVE

I wrote a tool which was originally thought for analyzing hard disc images. Now I'm trying to use this tool for live analyzis of computer systems, means my tool tries to access the physical drive.
I implemented my tool in QT accessing the images using the QFile class. Instead of images I hand over the physical drive, under windows it is \.\PHYSICALDRIVE0.
I was wondering first I didnt get any errors, I can open the device, I can seek, get the position, almost everything. The only thing I have problems with is retrieving the drive size with size().
Some code example:
QFile file( "\\.\PHYSICALDRIVE0" );
file.open( QIODevice::ReadOnly );
file.size(); //returns 0
I'm not too deep into QT, probably this is some easy thing. I would like to thank everybody who has an idea what is the reason.
thanks in advance!
QFileInfo may be able to help you out. It sounds like opening a read only file at that part of windows partition is allowed maybe even if it doesn't exist. There might be a chance that the call of GetLastError() may give more information why a file size of zero was returned.
With QFileInfo, you can check to make sure it exists before it opens.
You may end up needing some platform specific calls to be able to work with Physical Drives:
Volume to physical drive
It looks like there may be some example code of looking at partitions with PartMod on SourceForge.
As a side note of querying sizes of file folders, I thought it had to be cached somewhere by the operating system, or had to be calculated at the time of the query in many cases. I know it seems like that happens when looking at folder properties in Windows or Get Info on OSX.
Also, looking at the Volume to physical drive answers, there is a field there for the extent length. I think this is what you are looking for.
Hope that helps.

Resources