Rechercher dans ce blog

Affichage des articles dont le libellé est xrandr. Afficher tous les articles
Affichage des articles dont le libellé est xrandr. Afficher tous les articles

samedi 12 juillet 2014

SONY VAIO VGN-CS21S UBUNTU 14.04 TOUCHPAD KEYBOARD SLEEP HIBERNATION PROBLEMS SOLUTIONS

Voici ce que j'ai dû faire pour que l'hibernation et la mise en veille fonctionnent sur mon sony vaio vgn-cs21s ainsi que le touchpad.




J'ai essayé toutes les solutions proposées pour réactiver le clavier au réveil mais aucune n'a fonctionné.



#GRUB_CMDLINE_LINUX_DEFAULT="quiet splash noacpi nolapic atkbd.reset"
#GRUB_CMDLINE_LINUX="atkbr.reset i8042.reset i8042.nomux=1 i8042.nopnp i8042.noloop"
#GRUB_CMDLINE_LINUX="i8042.reset i8042.nomux=1 i8042.nopnp i8042.noloop"

Pour explications commandes atkbr voir ci-dessous

J'ai essayé de passer des paramètres comme

options nvidia modeset=1 et ce genre de trucs mais rien n'a donné de bons résultats.

dans /etc/modprobe.d/nvidia-331_hybrid.conf

Solutions

Suppression du module sony-laptop

#rmmod sony-laptop

Grub < atkbr.reset

Il faut quand même passer l'option atkbr.reset au kernel

/etc/default/grub

GRUB_CMDLINE_LINUX_DEFAULT="quiet atkbd.reset"


Il faut installer le driver propriétaire NVIDIA car le driver NOUVEAU ne fonctionne pas avec la mise en veille. 

Installation pilote NVIDIA


Dans "Paramètres système..." / "Logiciels et mises à jour"

Onglet "Pilotes additionnels" 

"Utilisation de NVIDIA binary driver - version 331.38 depuis nvidia-331 (propriétaire, testé)"

Script pour réinitialiser psmouse lors du réveil

Attention la commande "sleep 6" est nécessaire. Le timing a été trouvé expérimentalement. Sans ce délai d'attente ça ne fonctionne pas (je ne sais pas pourquoi). 6 secondes est le minimum qui fonctionne sur ma machine.

Dans /usr/lib/pm-utils/sleep.d




root@lunix:/usr/lib/pm-utils/sleep.d# cat 0000resetpsmouse

#!/bin/sh

resume_modules()
{
    sleep 6
    /sbin/rmmod psmouse
    /sbin/modprobe psmouse
    echo "Reloaded unloaded psmouse module."
}

case "$1" in
    thaw|resume)
        resume_modules
        ;;
    *) exit $NA
        ;;
esac


fichier : 0000resetpsmouse



Réinitialisation du touchpad en cours de session

Quelques fois en cours de session le touchpad ne répond plus correctement ou bien le clic gauche ne fonctionne plus, etc. Pas trouvé de solution très rationnelle à ce problème. J'ai bricolé un script associé à un raccourci clavier pour reloader le driver psmouse.

Script pour réinitialiser la souris : resetmouse.sh

Pour que le script fonctionne avec les droits utilisateur, il faut suid /bin/kmod

#chmod a+s /bin/kmod

rmmod et modprobe sont des soft links vers kmod.

root@lunix:/usr/local/bin# cat resetmouse.sh
#!/bin/bash
/sbin/rmmod psmouse >> /home/moi/resetmouse.log 2>&1;/sbin/modprobe psmouse >> /home/moi/.resetmouse.log 2>&1

J'ai associé le script à un raccourci clavier : Ctrl + Maj + Sterling

Les trois touches forment un alignement. Si le touchpad débloquent, je presse le raccourci et tout rendre dans l'ordre.

J'ai constaté que le touchpad devient fou lorsque je touche les touches de commandes multimédia au-dessus du clavier et également la touche "Menu".

Je n'ai pas réussi à désactiver durablement la touche "Menu", la seule solution / bricolage que j'ai trouvé est de l'utiliser comme raccourci vers une commande qui ne fait rien genre /bin/true.

Réglage de la luminosité

Avec le driver NOUVEAU le réglage de la luminosité ne fonctionnait pas.

Gnome faisait varier de 0 à 7 la valeur de

/sys/class/backlight/sony/brightness

Alors que ce qui réglait effectivement la luminosité était de 0 à 100

/sys/class/backlight/nv_backlight/brightness

Avec le pilote propriétaire NVIDIA il n'y a plus du tout de fichier dans

/sys/class/backlight

J'ai contourné le problème de la façon suivante :

Le pilote crée dans le home directory un fichier : .nvidia-settings-rc

J'ai écrit un script qui modifie les settings du pilote pour faire varier la luminosité. J'ai ensuite associé ce script à des raccourcis clavier

Script : sony_brightness.pl

root@lunix:/usr/local/bin# cat sony_brightness.pl
#!/usr/bin/perl
# Script pour ajuster la luminosité de l'écran du Sony VGN-CS21S
# L'installation du pilote propriétaire NVIDIA rend inopérant le
# dispositif de réglage basé sur /sys/class/backlight
# Je contourne le problème en modifiant le fichier de configuration
# du pilote dans $HOME
# Le pilote libre "nouveau" ne fonctionne pas avec la mise en veille.
# fmc - 2014 06
# Version 1.0

$A = shift @ARGV;
$HOME="/home/elsa-louise";
$GREP="/bin/grep";
$SED="/bin/sed";
$AWK="/usr/bin/awk";
$FILE=".nvidia-settings-rc";

if ( $A ne "+" && $A ne "-" && $A ne "0" ) {

    print "Paramètre invalide ou manquant (+ ou -) \n";
    exit 1;
}

$CURRED=`$GREP RedBrightness $HOME/$FILE | $AWK -F "=" '{print \$2}'`;
$CURGREEN=`$GREP GreenBrightness $HOME/$FILE | $AWK -F "=" '{print \$2}'`;
$CURBLUE=`$GREP BlueBrightness $HOME/$FILE | $AWK -F "=" '{print \$3}'`;
$CUR=$CURRED;
chomp $CUR;
$MAX="1";
$MIN="-1";


if ( $A eq "+" ) {
    if ( $CUR < $MAX ) {

    $CUR=$CUR + 0.1;
}
}

if ( $A eq "-" ) {
    if ( $CUR > $MIN ) {

    $CUR=$CUR - 0.1;
}

}

if ( $A eq "0" ) {

    $CUR=0;
}

`$SED -i -r -e 's/Brightness.*/Brightness=$CUR/' $HOME/$FILE`;
`/usr/bin/nvidia-settings -l`;


Trois raccourcis clavier

Ctrl + Maj + F6 /usr/local/bin/sony_brightness.pl + Pour augmenter
Ctrl + Maj + F5 /usr/local/bin/sony_brightness.pl -   Pour diminuer
 Ctrl + Maj + F7 /usr/local/bin/sony_brightness.pl 0 Pour remettre à 0 = au milieu


Utils...

nvidia-settings --query all|more
nvidia-settings --query [DPY:LVDS-0]/RedBrightness
nvidia-settings --assign "[DPY:LVDS-0]/RedBrightness=1,1"

Commandes diverses


Pour lister infos sur module chargé
modinfo psmouse

cd /sys/module/psmouse/
lister les paramètres...

Liste les inputs...
cat /proc/bus/input/devices


Pour afficher les options que le kernel a reçu au démarrage
less /proc/cmdline


xrandr

xrandr permet de faire varier la luminosité de l'écran sous X

xrandr --output LVDS-0 --brightness "N"

Commande atkbr et i8042


#GRUB_CMDLINE_LINUX_DEFAULT="quiet splash noacpi nolapic atkbd.reset"
#GRUB_CMDLINE_LINUX="atkbr.reset i8042.reset i8042.nomux=1 i8042.nopnp i8042.noloop"
#GRUB_CMDLINE_LINUX="i8042.reset i8042.nomux=1 i8042.nopnp i8042.noloop"


atkbd.extra= [HW] Enable extra LEDs and keys on IBM RapidAccess,
EzKey and similar keyboards

atkbd.reset= [HW] Reset keyboard during initialization

atkbd.set= [HW] Select keyboard code set
Format: (2 = AT (default) 3 = PS/2)

atkbd.scroll= [HW] Enable scroll wheel on MS Office and
similar
keyboards

atkbd.softraw= [HW] Choose between synthetic and real raw mode
Format: (0 = real, 1 = synthetic
(default))



This is an arcane option, only necessary on some rare devices (one of which you have). The only documentation is one line in the kernel parameters list.

The i8042 controller controls PS/2 keyboards and mice in PCs. It seems that on your laptop, both the keyboard and the touchpad are connected through that chip.

From what I understand from the option name and a brief skim of the source code (don't rely on this to write an i8042 driver!), some i8042 chips are capable of multiplexing data coming from multiple pointing devices. The traditional PS/2 interface only provides for one keyboard and one mouse; modern laptops often have a two or more of a touchpad, a trackstick and an external PS/2 plug. Some controllers follow the active PS/2 multiplexing specification, which permit up to 4 devices; the data sent by each device carries an indication of which device it comes from.

The Linux driver tries to find out whether the i8042 controller supports multiplexing, but sometimes guessing wrongly. With the i8042.nomux=1 parameter, the driver does not try to detect whether the controller supports multiplexing and assumes that it doesn't. With the i8042.reset parameter, the driver resets the controller when starting, which may be useful to disable multiplexing mode if the controller does support it but in a buggy way.
shareimprove this answer

mercredi 9 décembre 2009

configurer X-server

Pour récupérer le fichier xorg.conf sur les systèmes qui n'en ont pas. Quand X est lancé et tourne correctement, je fais un

#X :1 -configure qui me donne en retour un xorg.conf.new que je peux ensuite customiser.

Pour lister et ajouter des modes j'utilise xrandr

et pour définir des modelines j'utilise : cvt

Je peux coller ensuite les modelines voulus dans le xorg.conf

(ce qui est utile quand la détection dcc du moniteur se fait mal)

Pour les intel915 qu'on trouve sur les P4 j'utilise aussi 915resolution pour patcher à la volée le bios.

Pour généner des modelines il y a aussi : videogen (mais jamais utilisé)

Il y a aussi un script que l'on trouve parfois installé : displayconfig-gtk

---

II. Use xrandr to enable/disable/move/resize multiple outputs

II.1. Basics

Once the configuration file (xorg.conf) is updated, starting the server should enable some outputs by default. Their top-left corners will be at the same part of the image, but their modes will probably be different.

All outputs may be configured through xrandr (or the grandr graphic tool). To see the available outputs, just run xrandr:

  $ xrandr

  Screen 0: minimum 320 x 200, current 1400 x 1050, maximum 2048 x 1152

  VGA-0 disconnected (normal left inverted right x axis y axis)

  DVI-0 disconnected (normal left inverted right x axis y axis)

  LVDS connected 1400x1050+0+0 (normal left inverted right x axis y axis) 0mm x 0mm

   1400x1050 60.2*+

   1280x800 60.0

   1280x768 60.0

   1024x768 60.0 75.0

   800x600 60.3

   640x480 59.9

  S-video disconnected (normal left inverted right x axis y axis)

It shows that this board supports 4 outputs, names VGA-0, DVI-0, LVDS (the internal panel) and S-video (the TV output). Only LVDS is connected and it supports 6 modes at 60 Hz, and one at 75.

The mode marked with a star is the current mode.

The one marked with a plus is the preferred one. Most monitor report a preferred mode to the driver. And the server/driver will generally choose it by default.

II.2. Outputs naming convention

There are no standard naming convention as of today, it just depends on the driver, but it could change in the future.

At least the RadeonHD driver will print out a list of outputs as part of the /var/log/Xorg.0.log file generated by trying to start X. An example of output from the RadeonHD driver is

(II) RADEONHD(0): Output DVI-I_1/digital connected

(II) RADEONHD(0): Output DVI-I_1/analog disconnected

(II) RADEONHD(0): Output TV_7PIN_DIN disconnected

(II) RADEONHD(0): Output DVI-I_2/digital connected

(II) RADEONHD(0): Output DVI-I_2/analog disconnected

Where for example "DVI-I_1/digital" is the name of the digital output of the first DVI port.

For the internal laptop panel, external VGA, external DVI and TV, the drivers currently use:

the Intel driver uses LVDS, VGA, TMDS-1 (TMDS-2, ...), TV

the ATI driver uses LVDS, VGA-0 (VGA-1, ...), DVI-0 (DVI-1, ...), S-video

the RadeonHD driver uses PANEL, VGA_1 (VGA_2, ...), DVI-I_1/digital or DVI-I_1/analog (DVI-I_2/digital or DVI-I_1/analog, ...), TV_7PIN_DIN

the NV driver uses LVDS, VGA0 (VGA1, ...), DVI0 (DVI1, ...), ???

the MGA driver uses ???, VGA (or VGA1, VGA2, ...), DVI (or DVI1, DVI2, ...), ???

the Nouveau driver uses ???, Analog-0 (Analog-1, ...), Digital-0 (Digital-1, ...), ???

When manipulating VGA-0 output properties as below, you should use:

  $ xrandr --output VGA-0 <options>

II.3. Adding/removing heads dynamically

The old days where you had to restart X when plugging a new monitor are gone. With RandR 1.2, you can plug/unplug monitors whenever you want. Running the following line will query all outputs and enable them with their default mode:

  $ xrandr --auto

You may also disable one output using:

  $ xrandr --output LVDS --off

This may be useful for some buggy application that don't support multiple outputs well. Also, due to CRTC limitations (see the Caveats section below), it is often required to disable one output before enabling another since most hardware only support 2 at the same time.

II.4. Changing the mode

With the above xrandr output, you may change the LVDS mode to 1024x768 using:

  $ xrandr --output LVDS --mode 1024x768

The refresh rate may also be changed, either at the same time or independently:

  $ xrandr --output LVDS --mode 1024x768 --rate 75

II.5. Placing outputs in a virtual screen

Randr 1.2 provides the ability to create a large virtual screen and place multiple output in it, either with or without overlapping zones. To reduce memory consumption, drivers will often create a default virtual screen with small dimensions, for instance 1600x1200. Look at the output of xrandr to know your virtual screen dimensions. It would be 2048x1152 if xrandr reports:

  $ xrandr

  Screen 0: minimum 320 x 200, current 1400 x 1050, maximum 2048 x 1152

If you plan to use multiple outputs displaying different zones, you should configure your xorg.conf by adding a Virtual line to subsection Display in the Screen section.

  Section "Screen"

   ...

   SubSection "Display"

   Depth 24

   Virtual 3000 2000

   EndSubSection

  EndSection

Then you place outputs using xrandr and the --right-of/--left-of/--above/--below options. For instance, to place your VGA output virtually-right of your internal panel, run:

  $ xrandr --output VGA --right-of LVDS

Note that hardware and memory limitations may severely restrict the size of your virtual screen, see the Caveats section below.

II.6. Adding new modes

Under some circumstances, some modes might be missing. For instance, if the monitor does not report correct EDID information. Or if the output didn't have a CRTC available at startup because another output was using it and you disabled it in th meantime.

If a mode exist, you may add it to one output with:

  $ xrandr --addmode S-video 800x600

If the mode does not exist, you may first create it by passing a modeline:

  $ xrandr --newmode <ModeLine>

You may create a modeline using the gtf or cvt utility.

III. xorg.conf based configuration

Running xrandr is convenient for dynamic configuration, but it may be annoying if you have to run it after every startup of your X server. Section III.6 summarizes all this by showing an example of modern configuration.

III.1. Per Output Config

Before configuring an output, you need to know how to specify it in the config file. To do so, you may add a Monitor-FOO option to the Device section to identify the monitor section for output FOO. For instance:

  Section "Device"

   Identifier "My Graphic Board"

   ...

   Option "Monitor-LVDS" "Internal Panel"

   Option "Monitor-VGA" "External VGA Monitor"

  EndSection

  Section "Monitor"

   Identifier "Internal Panel"

   ...

  EndSection

  Section "Monitor"

   Identifier "External VGA Monitor"

   ...

  EndSection

Then, all output-specific options should go in the corresponding Monitor section.

III.2. Placing outputs

Add the following line to place one monitor on the right of another one as xrandr --output FOO --right-of BAR would do:

  Section "Monitor"

   Identifier "FOO"

  EndSection

  Section "Monitor"

   Identifier "BAR"

   Option "RightOf" "FOO"

  EndSection

III.3. Changing DPI and DisplaySize

If your monitor size isn't detected correctly and thus generates a wrong DPI, you need to add a DisplaySize option to the corresponding monitor section. For output FOO, use:

  Section "Monitor"

   Identifier "MyMonitor"

   DisplaySize 304 228

  EndSection

  Section "Device"

   ...

   Option "Monitor-FOO" "MyMonitor"

  EndSection

III.4. Forcing outputs off or on

If for some reason one output of your graphic board is enabled while it should not, you might want to disable it (for instance because the number of CRTCs available is limited). To do so, add:

   Option "Ignore" "true"

If for some reason one output is disabled by the driver (for instance VGA-0 on Radeon Xpress 200 because load detection is not reliable in the driver yet), you might want to enable it by force. To do so, add:

   Option "Enable" "true"

Then, you might need to add modes since such an output may not query modes correctly. See "Forcing a preferred mode" to do so.

III.5. Forcing a preferred mode

This is one of rare cases where the ModeLine open is still useful these days. If the preferred mode reported by your monitor isn't the one you want by default, or if there is no preferred mode and the driver does not choose the right one, you might want to force another mode on an output.

Assuming you want to force 1280x1024 at 75Hz at startup, add something like the following to the Monitor section:

   Modeline "1280x1024_75.00" 138.54 1280 1368 1504 1728 1024 1025 1028 1069 -HSync +Vsync

   Option "PreferredMode" "1280x1024_75.00"

The ModeLine line may be obtained by looking at your current Xorg.0.log if the mode is already detected (when it appears in the output of xrandr). Or you may generate a new one using:

  $ gtf 1280 1024 75

  Modeline "1280x1024_75.00" 138.54 1280 1368 1504 1728 1024 1025 1028 1069 -HSync +Vsync

III.6. Example of modern configuration

Here's an example of xorg.conf for a ATI board with DVI-0 (with DisplaySize and preferred mode forced), LVDS (placed on the right of DVI-0) and VGA-0 (disabled) outputs.

Section "InputDevice"

   Identifier "Generic Keyboard"

   Driver "keyboard"

   Option "CoreKeyboard"

   Option "XkbRules" "xorg"

   Option "XkbModel" "pc101"

   Option "XkbLayout" "us"

EndSection

Section "InputDevice"

   Identifier "Configured Mouse"

   Driver "mouse"

   Option "CorePointer"

   Option "Device" "/dev/input/mice"

   Option "Protocol" "ImPS/2"

   Option "Emulate3Buttons" "true"

   Option "ZAxisMapping" "4 5"

EndSection

# external DVI with DisplaySize and preferred mode overriden

Section "Monitor"

   Identifier "External DVI"

   DisplaySize 304 228

   Modeline "1280x1024_60.00" 108.88 1280 1360 1496 1712 1024 1025 1028 1060 -HSync +Vsync

   Option "PreferredMode" "1280x1024_60.00"

EndSection

# internal laptop panel to place on the right of DVI-0

Section "Monitor"

   Identifier "Integrated LCD"

   Option "RightOf" "External DVI"

EndSection

# disable VGA by default

Section "Monitor"

   Identifier "VGA-0"

   Option "Ignore" "true"

EndSection

Section "Device"

   Identifier "ATI Technologies, Inc. M22 [Radeon Mobility M300]"

   Driver "ati"

   BusID "PCI:1:0:0"

   Option "AccelMethod" "EXA"

   Option "Monitor-DVI-0" "External DVI"

   Option "Monitor-LVDS" "Integrated LCD"

   # no need to specific Monitor-VGA-0, it uses the "VGA-0" identifier automatically

EndSection

Section "Screen"

   Identifier "Default Screen"

   Device "ATI Technologies, Inc. M22 [Radeon Mobility M300]"

   DefaultDepth 24

   SubSection "Display"

   Depth 24

   # big virtual screen to place

   Virtual 3072 1200

   EndSubSection

EndSection

Section "ServerLayout"

   Identifier "Default Layout"

   Screen "Default Screen"

   InputDevice "Generic Keyboard"

   InputDevice "Configured Mouse"

EndSection