Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I am using BunsenLabs Linux, which, as you may know, uses the OpenBox window manager.
It happens that i cannot change the brightness of the screen either through the xfce-power-manager or xbacklight. xrandr only works for but a few seconds. However, there appears to be this specific file
which contains within it a number which specifies the screen brightness. I decided to create 2 C programs, which read the number on the file, calculate a new value, and replace the previous value with the more recent one. One program increases the value, while the other decreases it.
However, i found out something interesting. I tried running the programs not from within the folder in which they're contained, but from my home folder, like so:
It returned "Segmentation fault".
I imagine that this is precisely what's happening when I issue the command through a keybind. Must have something to do with file pointers and the like. As things are now, I can only run the programs from within the folder in which they are contained, which is also the folder which contains the brightness file itself. I guess if I could write a program which specifies the location of the file to edit I could fix this.
I'll try to solve this on my own, although any suggestions are very much welcome.
I didn't know this was possible, but i specified the path to the file that was to be read and written in the C programs. I thought it would just write out the name of the file as its whole path, but it doesn't. Everything is working wonderfully now
...but I was apparently wrong. I get permission denied wether as normal user or root. Strange, I could have sworn that way worked in the past. At least it doesn't now (currently in front of my Debian 8 system).
So it was a clever approach to write your own program in C!
despite the fact that you are running the echo command as root, doesn't the file permission remain the same? Maybe changing the file permission will do the trick.
Yep. It probably would, but I'd rather not change those permissions. My guess is that they are there for a reason, and since I don't need to, I will refrain. But yes, the permissions stay the same after an echo.
Originally Posted by Johnny_Metal
I would have used the echo command if I knew how to make it add or subtract to the current value of brightness. Does the code you posted do that? The way I understand it, it simply writes 22.
Yes. That was just an example. But you can use bash to subtract or add to a value. Like this:
By the way, there is a flaw with the way i'm trying to change the brightness. I need to change the file permissions everytime i start a session, because at every restart they go back to their defaults. Would you happen to know of a way to make the changes permanent? Or perhaps create a script to change the permissions every session startup?