Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[ati-driver] ctrl+alt+plus/minus doesn't work
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
Dominique_71
Veteran
Veteran


Joined: 17 Aug 2005
Posts: 1869
Location: Switzerland (Romandie)

PostPosted: Thu Jan 17, 2013 8:42 pm    Post subject: [ati-driver] ctrl+alt+plus/minus doesn't work Reply with quote

With an AMD Radeon HD7400M/HD6320, video mode switching is not working with Ctrl-Alt-+ and Ctrl-Alt--, but it is working with "xrandr -s ...". So I suspect a xorg configuration problem, but I don't understand what.

Also, as with xrandr, it work fine with the catalyst control center running as root. But xrandr is working fine as user. So it must be possible to get this key combination to work.

Code:
xrandr
Screen 0: minimum 320 x 200, current 1600 x 900, maximum 1600 x 1600
LVDS connected 1600x900+0+0 (normal left inverted right x axis y axis) 382mm x 214mm
   1600x900       60.3*+
   1440x900       60.3 
   1280x768       60.3 
   1280x720       60.3 
   1024x768       60.3 
   1024x600       60.3 
   800x600        60.3 
   800x480        60.3 
   640x480        60.3 
DFP1 disconnected (normal left inverted right x axis y axis)
CRT1 disconnected (normal left inverted right x axis y axis)


Code:


Section "ServerLayout"
   Identifier     "aticonfig Layout"
   Screen      0  "amdcccle-Screen[0]-0" 0 0
EndSection

Section "Module"
EndSection

Section "ServerFlags"
   Option       "DefaultServerLayout" "aticonfig Layout"
   Option       "DontZap" "off" # control Ctrl+Alt+BackSpace
   Option       "DontZoom" "off" # control Ctrl+Alt+Plus/Minus
EndSection

Section "Monitor"
   Identifier   "aticonfig-Monitor[0]-0"
   Option       "VendorName" "ATI Proprietary Driver"
   Option       "ModelName" "Generic Autodetecting Monitor"
   Option       "DPMS" "true"
EndSection

Section "Monitor"
   Identifier   "1-LVDS"
   Option       "VendorName" "ATI Proprietary Driver"
   Option       "ModelName" "Generic Autodetecting Monitor"
   Option       "DPMS" "true"
   Option       "PreferredMode" "1600x900"
   Option       "TargetRefresh" "60"
   Option       "Position" "0 0"
   Option       "Rotate" "normal"
   Option       "Disable" "false"
EndSection

Section "Device"
   Identifier  "aticonfig-Device[0]-0"
   Driver      "fglrx"
   BusID       "PCI:1:0:0"
EndSection

Section "Device"
   Identifier  "amdcccle-Device[0]-0"
   Driver      "fglrx"
   Option       "Monitor-LVDS" "1-LVDS"
   BusID       "PCI:0:1:0"
EndSection

Section "Screen"
   Identifier "aticonfig-Screen[0]-0"
   Device     "aticonfig-Device[0]-0"
   Monitor    "aticonfig-Monitor[0]-0"
   DefaultDepth     24
   SubSection "Display"
      Viewport   0 0
      Depth     24
      Modes    "1600x900" "1440x900" "1280x768" "1280x720" "1024x768" "1024x600" "800x600" "800x480" "640x480"
   EndSubSection
EndSection

Section "Screen"
   Identifier "amdcccle-Screen[0]-0"
   Device     "amdcccle-Device[0]-0"
   DefaultDepth     24
   SubSection "Display"
      Viewport   0 0
      Depth     24
   EndSubSection
EndSection


xorg.conf.d/30-keyboard.conf
Code:
Section "InputClass"
   Identifier "evdev keyboard  catchall"
   MatchIsKeyboard "on"
   MatchDevicePath "/dev/input/event*"
   Driver "evdev"
   Option "XkbLayout" "ch"
   Option "XkbVariant" "fr"
   Option "XkbRules" "xorg"
   Option "XkbOptions" "terminate:ctrl_alt_bksp"
EndSection


It done also a xorg.conf.d/50-synaptics.conf file, but I think it is not relevant here.
This is on an ~amd64 system with gentoo-sources-3.7.1, xorg-server 1.13.1.901 and ati-drivers 12.11_beta11
_________________
"Confirm You are a robot." - the singularity


Last edited by Dominique_71 on Sat May 18, 2013 8:05 pm; edited 2 times in total
Back to top
View user's profile Send private message
cord
Guru
Guru


Joined: 28 Apr 2007
Posts: 344

PostPosted: Fri Jan 18, 2013 2:31 pm    Post subject: Re: [ati-driver] ctrl+alt+plus/minus doesn't work Reply with quote

Dominique_71 wrote:
I suspect a xorg configuration problem

Is it working without xorg.conf?
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Fri Jan 18, 2013 5:09 pm    Post subject: Reply with quote

It might have been removed from xorg entirely - it doesn't work with the radeon driver either.
Back to top
View user's profile Send private message
Dominique_71
Veteran
Veteran


Joined: 17 Aug 2005
Posts: 1869
Location: Switzerland (Romandie)

PostPosted: Fri Jan 18, 2013 5:51 pm    Post subject: Re: [ati-driver] ctrl+alt+plus/minus doesn't work Reply with quote

cord wrote:
Dominique_71 wrote:
I suspect a xorg configuration problem

Is it working without xorg.conf?

No, I get a "No screen found" error and X fail to start.
_________________
"Confirm You are a robot." - the singularity
Back to top
View user's profile Send private message
Dominique_71
Veteran
Veteran


Joined: 17 Aug 2005
Posts: 1869
Location: Switzerland (Romandie)

PostPosted: Fri Jan 18, 2013 5:56 pm    Post subject: Reply with quote

Ant P. wrote:
It might have been removed from xorg entirely - it doesn't work with the radeon driver either.

It work on my tower with the nvidia driver.

If you are right about the radeon driver, and I think so because I don't see any difference between the config of the 2 computers that can cause this issue with the radeon driver, the only solution seam to use xrandr and make 2 wrapper scripts. And to assign them to keybindings.
_________________
"Confirm You are a robot." - the singularity
Back to top
View user's profile Send private message
Dominique_71
Veteran
Veteran


Joined: 17 Aug 2005
Posts: 1869
Location: Switzerland (Romandie)

PostPosted: Sat Jan 19, 2013 10:34 am    Post subject: Reply with quote

It work. I even get more modes than with my xorg.conf 8) So, another solution would be to hardcode the modes into the scripts.

videomodeswitch-
Code:
#!/bin/sh

LC_ALL=C

CURRENT_MODE=$(xrandr|grep '[0-9]\*'|sed -e 's:\(^ *\)\([0-9]*x[0-9]*\).*:\2:' )

ALL_MODES=($(xrandr|grep -E "^ *[0-9]"|sed -e 's:\(^ *\)\([0-9]*x[0-9]*\).*:\2:'|sort -grs ) )

index=${#ALL_MODES[@]}

i=0
n=$(($index-1))

while [ "$i" -lt "$index" ]
do
    if [ "${CURRENT_MODE}" == "${ALL_MODES[i]}" ]
    then
   m=$((i+1))
   if [ "$m" -eq "$n" ]
   then
      m=0
   fi
   NEXT_MODE="${ALL_MODES[m]}"
    fi
    let "i+=1"
done
xrandr -s "${NEXT_MODE}"


videomodeswitch+
Code:
#!/bin/sh

LC_ALL=C

CURRENT_MODE=$(xrandr|grep '[0-9]\*'|sed -e 's:\(^ *\)\([0-9]*x[0-9]*\).*:\2:' )

ALL_MODES=($(xrandr|grep -E "^ *[0-9]"|sed -e 's:\(^ *\)\([0-9]*x[0-9]*\).*:\2:'|sort -grs ) )

index=${#ALL_MODES[@]}

i=0

while [ "$i" -lt "$index" ]
do
    if [ "${CURRENT_MODE}" == "${ALL_MODES[i]}" ]
    then
   m=$((i-1))
   if [ "$m" -eq "-1" ]
   then
      m=$((${index}-1))
   fi
   NEXT_MODE="${ALL_MODES[m]}"
    fi
    let "i+=1"
done
xrandr -s "${NEXT_MODE}"


Any comment will be appreciated.
_________________
"Confirm You are a robot." - the singularity
Back to top
View user's profile Send private message
Dominique_71
Veteran
Veteran


Joined: 17 Aug 2005
Posts: 1869
Location: Switzerland (Romandie)

PostPosted: Sat May 18, 2013 8:04 pm    Post subject: Reply with quote

But that's very strange. Ctrl+Alt+KP_Add and CTRL+Alt+KP_Subtract are completely broken anyway. That script work with any binding I can try, at the exception of those 2 standard bindings which doesn't work.

xev give me
Code:
FocusOut event, serial 40, synthetic NO, window 0x9c00001,
    mode NotifyGrab, detail NotifyAncestor

FocusIn event, serial 40, synthetic NO, window 0x9c00001,
    mode NotifyUngrab, detail NotifyAncestor

KeymapNotify event, serial 40, synthetic NO, window 0x0,
    keys:  0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0

for kp +, and
Code:
KeyPress event, serial 40, synthetic NO, window 0x9c00001,
    root 0xc9, subw 0x0, time 470691012, (-10,436), root:(1052,498),
    state 0x0, keycode 82 (keysym 0xffad, KP_Subtract), same_screen YES,
    XLookupString gives 1 bytes: (2d) "-"
    XmbLookupString gives 1 bytes: (2d) "-"
    XFilterEvent returns: False

KeyRelease event, serial 40, synthetic NO, window 0x9c00001,
    root 0xc9, subw 0x0, time 470691230, (-10,436), root:(1052,498),
    state 0x0, keycode 82 (keysym 0xffad, KP_Subtract), same_screen YES,
    XLookupString gives 1 bytes: (2d) "-"
    XFilterEvent returns: False

for kp -.

Last, if I make bindings to Alt+Shift+KP_Add or Alt+Shift+KP_Subtract, they work.
_________________
"Confirm You are a robot." - the singularity
Back to top
View user's profile Send private message
steveL
Watchman
Watchman


Joined: 13 Sep 2006
Posts: 5153
Location: The Peanut Gallery

PostPosted: Sat Jun 28, 2014 6:01 pm    Post subject: Reply with quote

Dominique_71 wrote:

Any comment will be appreciated.

Code:
LC_ALL=C

export this if you intend it to affect other commands like grep or sort.
Code:
CURRENT_MODE=$(xrandr|grep '[0-9]\*'|sed -e 's:\(^ *\)\([0-9]*x[0-9]*\).*:\2:' )

You can replace the grep | sed combination with a single sed call:
Code:
xrandr | sed -n '/[0-9]\*/s:\(^ *\)\([0-9]*x[0-9]*\).*:\2:p'

Also, don't use ALL_CAPS variables for script-locals:
Code:
<greybot> By convention, environment variables (PATH, EDITOR, SHELL, ...) and internal shell variables (BASH_VERSION, RANDOM, ...) are fully capitalized. All other variable names should be lowercase. Since variable names are case-sensitive, this convention avoids accidentally overriding environmental and internal variables.

Code:
ALL_MODES=($(xrandr|grep -E "^ *[0-9]"|sed -e 's:\(^ *\)\([0-9]*x[0-9]*\).*:\2:'|sort -grs ) )

index=${#ALL_MODES[@]}

Arrays don't work in sh, so there's no point labelling the script with /bin/sh if you must use them. It'll only break for some of your users.

I have to say I'd just do this in awk, and grab the next item from there. Though you should know about break since you keep looping when you've found the item you want.

Also are you sure you need the sort? On my machine, it comes out ordered as we want them, from highest to lowest res. For sake of explication, I'll show the base command without sorting first. So, assuming we have high to low, to find next higher res we'd use:
Code:
xrandr | awk '/^ +[0-9]/ { mode[n++] = $1; if (/[0-9]\*/) curr = n } END { if (! curr) exit(1); if (--curr > 0) print(mode[curr - 1]) }'

And to get next lower:
Code:
xrandr | awk '/^ +[0-9]/ { mode[n++] = $1; if (/[0-9]\*/) curr = n } END { if (! curr) exit(1); if (--curr < n) print(mode[curr + 1]) }'

This would be used as:
Code:
next_mode=$(xrandr | awk ..) || exit # no current mode
[ -z "$next_mode" ] && exit  # exit true (cannot go higher/lower)
exec xrandr -s "$next_mode"

The "no current mode" case "cannot happen" but equally we cannot function if our assumptions are so broken. It is better to bail out and return an error (false) status.

If we truly need to sort, then I'd bring grep back in to the mix (for robustness), and sort before we get to awk:
Code:
xrandr | grep '^  *[0-9]' | sort -grs -k1 | awk '{ mode[n++] = $1; .. # rest as above

Thus the action is run unconditionally since we already know we have only the correct data. Otherwise it's usually more efficient to filter in awk, unless you are working with very large datasets. (You know if that's the case; ime it's not the case for most uses of awk.)

HTH
steveL
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum