prushik on 7 Nov 2016 17:42:35 -0800
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: [PLUG] LINUX LOW LEVEL PROGRAMMING QUESTION
- From: prushik <firstname.lastname@example.org>
- To: PhiladelphiaLinuxUser'sGroupDiscussionList <email@example.com>
- Subject: Re: [PLUG] LINUX LOW LEVEL PROGRAMMING QUESTION
- Date: Mon, 7 Nov 2016 20:42:25 -0500 (EST)
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:subject:to:message-id:mime-version; bh=Ly9qWrO+3hp6Kj9t9+W9eiJpPm+TkhfvRsEgpvDIU5E=; b=yhOYfEXp5n0rAcaDCcaRVjnA5biLGjfes4/rWlVkeauTuKacl3xQZ+tRBTv6G2KBEb NRsdK3p5DLEsqHndqwAnZfmmet6mASw3FqcdgdJhAuL5i9+GNLZvcVRHbk3h/shQhddv 0PMT+vSj8EgjUS9+Jbmf76+QxxSDQYf0zslv1a0TTMqSTSpx+gZXwqe43wne3n7CoTr/ f2qfI3v8ldau25akIKbgz11rPkUv2XgmfAyHoyQcikxhDcHfq+y4kwetQj4Kk8GWLs79 ZjFOE2AEEwrZkwLS8jW7n7oTgKfQKU3eSNk0zs1/rFpdtHSL+S8Pz15ZmkwJ+WgweAQk l4zA==
- Reply-to: Philadelphia Linux User's Group Discussion List <firstname.lastname@example.org>
- Sender: "plug" <email@example.com>
---- Original message ----
From: JP Vossen <firstname.lastname@example.org>
Sent: 11/07/2016 20:18:09
To: Philadelphia Linux User's Group Discussion List <email@example.com>
Subject: Re: [PLUG] LINUX LOW LEVEL PROGRAMMING QUESTION
On 11/07/2016 07:59 PM, Ronald P Guilmet wrote:
> The problem:
> I have a Dell laptop that I cannot adjust the screen brightness via the
> settings shown to me. I can however change them by echoing a value to
> the /sys/class/.... file. This is not distro specific, it doesn't work
> in Ubuntu or Fedora. I am currently using Fedora 24.
> suid is disabled in Bash for security reasons. I can execute an echo
> <value> > /file/path and it works. If I put that in a bash script and
> run it from the root command line, it will not execute. No errors, it
> just won't change the values.
Note that bash is not in charge of suid. Also, note that everything in /sys/ is not a real file, its more of an interface to the kernel. An arbitrary node in sysfs will only change if the kernel tells it to e.g. if your write is accepted and processed by the kernel.
> My programming experience has not been low level, and this seems to be
> low level programming. I have a familiarity with C, and I'm thinking I
> will try that.
The only really low-ish level programming needed for this would be if you wanted to take advantage of seteuid (suid). Otherwise its just opening a "file" and writing to it.
> I've looked up solutions in the past, but they don't seem to work anymore.
> To fix this, and to satisfy my love of playing with Linux, I was
> thinking of writing a C program that either reads a config file, or a C
> program that will accept a parameter (screen value) giving at runtime.
> Anyone have any suggestions or comments?
I agree with JP, seems like your issue with your script is an issue with your either your syntax or the way you are calling it, and not an issue with how bash works. However, your idea of a c program that does what you want should be pretty simple to implement.
Philadelphia Linux Users Group -- http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug