Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[TIP] Dual monitor, intel e xrandr versione 2!!!
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian) Risorse italiane (documentazione e tools)
View previous topic :: View next topic  
Author Message
fbcyborg
Advocate
Advocate


Joined: 16 Oct 2005
Posts: 3056
Location: ROMA

PostPosted: Sun Oct 04, 2009 9:53 am    Post subject: [TIP] Dual monitor, intel e xrandr versione 2!!! Reply with quote

Ciao a tutti,

posto questo TIP sperando che possa essere d'aiuto a tutti quelli che come me hanno penato e stanno penando per l'utilizzo del tasto Fn del proprio portatile con lo scopo di switchare la visualizzazione fra lo schermo del notebook e quello di un proiettore e viceversa.
Per cominciare un po' di References:


Facendo un merge dei precedenti thread, sono finalmente giunto ad una soluzione funzionante su una scheda intel (945GM/GMS/GME, 943/940GML) di un Sony Vaio serie SZ (mod. SZ330P).
Premesso che ho letto e riletto il TIP [2] ma non sono riuscito a trovare una soluzione per la mia esigenza, sebbene sia stato fondamentale per giungere alla conclusione di questo TIP.

Come prima cosa installate app-misc/i810switch.

Ebbene, supponiamo di voler associare al tasto Fn+F7 (che sul sony vaio ha l'icona LCD->VGA) la seguente funzione ciclica: Cambio risoluzione -> mando l'output su VGA e LCD -> output solo su VGA -> cambio di nuovo risoluzione e mando output solo su LCD.
Il mio LCD ha una risoluzione 1280x800, quindi prenderò questa come esempio.

Ora, per prima cosa dobbiamo modificare lo script /usr/bin/i810rotate da così:
Code:
#!/bin/sh -

dev=`i810switch`
dev=`echo $dev`

if [ "$dev" = "CRT: off LCD: on" ] ; then
        i810switch crt on lcd on  > /dev/null
elif [ "$dev" = "CRT: on LCD: off" ] ; then
        i810switch crt off lcd on > /dev/null
else
        i810switch crt on lcd off > /dev/null
fi

A così:
Code:
#!/bin/sh -

export XAUTHORITY=/home/username/.Xauthority
export DISPLAY=:0.0

dev=`i810switch`
dev=`echo $dev`

if [ "$dev" = "CRT: off LCD: on" ] ; then
        xrandr --output LVDS --mode 1024x768 --same-as VGA --mode 1024x768
        i810switch crt on lcd on  > /dev/null
elif [ "$dev" = "CRT: on LCD: off" ] ; then
        xrandr --output LVDS --mode 1280x800 --same-as VGA --mode 1280x800
        i810switch crt off lcd on > /dev/null
else
        xrandr --output VGA --mode 1024x768 --same-as LVDS --mode 1024x768
        i810switch crt on lcd off > /dev/null
fi


Fate attenzione alla riga export XAUTHORITY=/home/username/.Xauthority, dove dovete sostituire username con il vostro nome utente.
(Grazie oRDeX per la dritta!) :)

Se provate lo script a mano già dovrebbe funzionare.

Ora vediamo come intercettare la pressione della combinazione di tasti Fn+F7.
Aprite una shell e digitate
Code:
tail -0f /var/log/messages

Alla pressione di Fn+F7 otterrete qualcosa come:
Code:
Oct  4 11:46:05 SZ330P logger: ACPI event unhandled: sony/hotkey SPIC 00000001 00000012
Oct  4 11:46:05 SZ330P logger: ACPI event unhandled: sony/hotkey SPIC 00000001 0000003b


OK, a questo punto avete il codice del tasto.

Create il file /etc/acpi/events/screen_rotate e inserite il seguente codice all'interno:
Code:
event=sony/hotkey SPIC 00000001 00000012
action=/usr/bin/i810rotate


Restartate acpid e i giochi dovrebbero funzionare.

Chiaramente è necessario che i moduli del kernel siano compilati per avere questo supporto. Ad esempio nel caso dei sony, c'è il modulo SONYPI e SONY_LAPTOP.
Ma per questo rimando ad altre guide che sono in giro sul web.
_________________
[HOWTO] Come criptare la /home usando cryptsetup e luks
[HOWTO] Abilitare il supporto al dom0 XEN su kernel 3.X
Help answer the unanswered
Back to top
View user's profile Send private message
maurs
Tux's lil' helper
Tux's lil' helper


Joined: 16 Oct 2005
Posts: 85

PostPosted: Sun Oct 04, 2009 9:14 pm    Post subject: Reply with quote

Complimenti, ottimo how-to! :D
_________________
MaUrS
[HOW-TO] Gentoo su PC datati (aka Portatile Felice)
Maurs' Blog
VDD Project
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian) Risorse italiane (documentazione e tools) 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