LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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!

Notices


Reply
  Search this Thread
Old 06-01-2014, 10:15 AM   #1
maples
Member
 
Registered: Oct 2013
Location: IN, USA
Distribution: Arch, Debian Jessie
Posts: 810

Rep: Reputation: 264Reputation: 264Reputation: 264
xbacklight not working on Dell Inspiron laptop


Hi,
I was working with xbacklight today. To adjust my brightness, I previously had a really simple script that 'echo'ed a number into /sys/class/backlight/intel_backlight/brightness. But that required root privleges, and I wanted to try to do it using my window manager's keybindings. So I installed xorg-xbacklight and ran this in a teminal emulator:
Code:
xbacklight -set 100
It returned no output, and the backlight didn't change. I tried to set it to 10, and I got the same result.

I opened up tty2 and tried again. This time, it said
Code:
RANDR Query Version returned error -1
but the backlight still didn't change.

Any ideas?

EDIT: on the 2 other laptops I've used Arch on, the hardware buttons for backlight (Fn + F4 and F5) worked out-of-the-box, but on this laptop they don't do a thing.

EDIT 2: I looked up the error, and found a bug report for Ubuntu about xbacklight not working...could that problem apply to Arch, too?

Last edited by maples; 06-01-2014 at 09:01 PM.
 
Old 06-03-2014, 12:13 PM   #2
dijetlo
Senior Member
 
Registered: Jan 2009
Location: RHELtopia....
Distribution: Solaris 11.2/Slackware/RHEL/
Posts: 1,307
Blog Entries: 2

Rep: Reputation: Disabled
Bug report here sounds similar however it's for Ubuntu

Quote:
xrandr --verbose lists outputs and shows the main screen has backlight property,
and "xrandr --output LVDS-0 --set backlight 50" changes the backlight
brightness.

And

"cat /sys/class/backlight/psb-bl/actual_brightness" shows the current
brightness, and
"echo 50 >/sys/class/backlight/psb-bl/brightness" changes the brightness.
Though I imagine he's doing that as root....

Your problem might be the D-Buss --session which has to hand that off to the D-Buss --system for that to work, I've tried to fix something similar (system bell) with another user but without root access the best we could manage was intermittent functionality.
 
Old 06-03-2014, 04:09 PM   #3
maples
Member
 
Registered: Oct 2013
Location: IN, USA
Distribution: Arch, Debian Jessie
Posts: 810

Original Poster
Rep: Reputation: 264Reputation: 264Reputation: 264
Thanks for the reply!

Unfortunately, the 'xrandr' command in the bug report fails to work as well. And yes, I checked to see if it was a different display name than the one in the example.

So I guess I'll just have to deal with it until there's a bugfix? Or will one even come, since that bug report is almost 2 years old?

Thanks!
 
Old 06-03-2014, 06:43 PM   #4
dijetlo
Senior Member
 
Registered: Jan 2009
Location: RHELtopia....
Distribution: Solaris 11.2/Slackware/RHEL/
Posts: 1,307
Blog Entries: 2

Rep: Reputation: Disabled
Well, it seems all we need is the ability to have your script run with elevated privileges.
 
Old 06-03-2014, 09:58 PM   #5
maples
Member
 
Registered: Oct 2013
Location: IN, USA
Distribution: Arch, Debian Jessie
Posts: 810

Original Poster
Rep: Reputation: 264Reputation: 264Reputation: 264
Yes, and I've been using sudo to run it, and it works jsut fine. However, if possible, I'd like to write a backlight-up script and a backlight-down script that I could give a keybinding with xbindkeys. If I'm correctly understanding the question you refrenced, the final script still requires the user to type the password. I'd prefer not to give myself sudo rights without the password prompt. Is there a way around this?

Thanks!
 
Old 06-03-2014, 11:09 PM   #6
maples
Member
 
Registered: Oct 2013
Location: IN, USA
Distribution: Arch, Debian Jessie
Posts: 810

Original Poster
Rep: Reputation: 264Reputation: 264Reputation: 264
OK, I've written the script (with the exception of the root privleges, I still need to run it with sudo). I've run into a few problems that don't make sense to me.

Code:
#!/bin/bash

#absolute path: 
#/sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-eDP-1/intel_backlight/max_brightness

cd /sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-eDP-1/intel_backlight/

declare -i max_bright
declare -i current_bright
declare -i new_bright
declare -i ten

max_bright=$(cat max_brightness)
current_bright=$(cat brightness)
new_bright=0
ten=10

function max
{
    echo $max_bright > brightness
}

function min
{
    echo 10 > brightness
}

function higher
{
    new_bright=$(calc $current_bright + 10)
    if [ $new_bright > $max_bright ]
      then
        new_bright=$(echo $max_bright)
    fi
    echo $new_bright > brightness
}

function lower
{
    new_bright=$(calc $current_bright - 10)
    if [ $ten > $new_bright ]
      then
        new_bright=10
    fi
    echo $new_bright > brightness
}

$1
When I run 'sudo ./backlight max' and 'sudo ./backlight min' I get the results that I'm looking for: a change in the backlight.

When I run 'sudo ./backlight higher' and 'sudo ./backlight lower' the brightness changes, but it returns a "permission denied" error on the line with the "if" statement. As a result, the "if" statement doesn't run, and if my brightness is at 10 and I run 'lower' it turns the backlight off, which I do NOT want to do. Sorry if this is a really basic question, this is one of my first attempts at bash scripting, and I just can't see why I have permission errors with variables.

Thanks!
 
Old 06-04-2014, 12:09 AM   #7
dijetlo
Senior Member
 
Registered: Jan 2009
Location: RHELtopia....
Distribution: Solaris 11.2/Slackware/RHEL/
Posts: 1,307
Blog Entries: 2

Rep: Reputation: Disabled
Quote:
Is there a way around this?
The sudo password question is kinda "is you is or is you aint", though a possible avenue is to create a user <scriptname> and give him passwordless sudo and no login
*effectively making your script a daemon*
 
Old 06-04-2014, 12:38 AM   #8
dijetlo
Senior Member
 
Registered: Jan 2009
Location: RHELtopia....
Distribution: Solaris 11.2/Slackware/RHEL/
Posts: 1,307
Blog Entries: 2

Rep: Reputation: Disabled
Quote:
/sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-eDP-1/intel_backlight/max_brightness
max_bright=$(cat max_brightness)
if [ $new_bright > $max_bright ]
My guess would be that session D-Bus, which is where your elevated user rights are being applied can't touch the firmware controls because that falls to system D-Bus and I suspect there is some secret GTK voodoo we are unfamiliar with that controls the hand off.
Still, the X11 server has direct access to the hardware, can you pipe it through there?
 
Old 06-04-2014, 09:40 AM   #9
maples
Member
 
Registered: Oct 2013
Location: IN, USA
Distribution: Arch, Debian Jessie
Posts: 810

Original Poster
Rep: Reputation: 264Reputation: 264Reputation: 264
Quote:
Originally Posted by dijetlo View Post
My guess would be that session D-Bus, which is where your elevated user rights are being applied can't touch the firmware controls because that falls to system D-Bus and I suspect there is some secret GTK voodoo we are unfamiliar with that controls the hand off.
Still, the X11 server has direct access to the hardware, can you pipe it through there?
Well, it looks like I'm in way farther than I expected. That's not a bad thing, though.

I know next to nothing about D-bus, so I'll take your word for it

How would I pipe it through X11? I'm somewhat familiar with pipes on the command line, is it similar to that?

Thanks!
 
Old 06-04-2014, 11:28 AM   #10
dijetlo
Senior Member
 
Registered: Jan 2009
Location: RHELtopia....
Distribution: Solaris 11.2/Slackware/RHEL/
Posts: 1,307
Blog Entries: 2

Rep: Reputation: Disabled
Quote:
How would I pipe it through X11?
X11 has some CLI commands, I'm just not familiar with them. I'll try to take a minute tonight and see if I can find a reference document for you.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] startx not working on Arch on Dell Inspiron 14R laptop maples Linux - Newbie 8 04-19-2014 05:58 PM
when using RHE 5.1 runlevel 5 not working in my INSPIRON 1100 (DELL) laptop. rafirhce Linux - Hardware 1 05-31-2010 10:11 AM
Brightness keys not working in Dell Inspiron Laptop with Fedora 12 OS vinaytp Linux - Newbie 5 04-26-2010 05:28 PM
Problem getting wireless working in Fedora Core 4 (FC4) on Dell Inspiron 510m laptop nickleus Linux - Wireless Networking 1 01-13-2006 07:31 PM
Ethernet NIC (Broadcom4400) not working on Dell Inspiron 5150 laptop, Slackware10.2 EtherGhost Slackware - Installation 1 12-11-2005 05:44 PM


All times are GMT -5. The time now is 03:56 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration