Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[acpid] ne peut lancer synclient (résolu)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index French
View previous topic :: View next topic  
Author Message
Zoboulo
Tux's lil' helper
Tux's lil' helper


Joined: 07 Apr 2007
Posts: 97

PostPosted: Thu Oct 15, 2009 2:43 pm    Post subject: [acpid] ne peut lancer synclient (résolu) Reply with quote

Bonjour,

J'utilise acpid pour gérer le bouton qui active/désactive le touchpad de mon laptop. Cependant depuis quelques temps, ça ne fonctionne plus. J'ai un script dans /etc/acpid/actions qui est appelé lorsque j'appuie sur Fn+f9 :
Code:
#!/bin/sh

state=$(synclient -l | grep TouchpadOff | awk -F"= " '{print $2}')
if [ "$state" = "0" ]
        then synclient TouchpadOff=1
        else synclient TouchpadOff=0
fi

1) Ça fonctionne parfaitement en exécutant ce script directement depuis un shell en root
2) D'après les logs, le script est bien lancé par acpid lorsque j'appuie sur le bouton, mais renvoie "1" et ne fait rien
3) Après quelques recherches, ce sont les commandes "synclient TouchpadOff=1" et "synclient TouchpadOff=0" qui posent problème (en les remplaçant par autre chose ça retourne bien "0")

Peut-il s'agir d'un problème de droits ? Je ne sais pas avec quels privilèges acpid lance les scripts.


Last edited by Zoboulo on Wed Oct 28, 2009 12:00 pm; edited 1 time in total
Back to top
View user's profile Send private message
kernelsensei
Bodhisattva
Bodhisattva


Joined: 22 Feb 2004
Posts: 5619
Location: Woustviller/Moselle/FRANCE (49.07°N;7.02°E)

PostPosted: Thu Oct 15, 2009 4:13 pm    Post subject: Reply with quote

Salut,

j'avais le même problème. En lançant le script dans une console tu verras le message "Failed to connect to X server". Il y a du avoir du changement au niveau de synclient car avant ça fonctionnait via acpid. J'ai contourné le problème en assignant le script à un raccourci clavier sous xfce.
_________________
$ ruby -e'puts " .:@BFegiklnorst".unpack("x4ax7aaX6ax5aX15ax4aax6aaX7ax2aX5aX8 \
axaX3ax8aX4ax6aX3aX6ax3ax3aX9ax4ax2aX9axaX6ax3aX2ax4ax3aX4aXaX12ax10aaX7a").join'
Back to top
View user's profile Send private message
Zoboulo
Tux's lil' helper
Tux's lil' helper


Joined: 07 Apr 2007
Posts: 97

PostPosted: Tue Oct 27, 2009 6:25 pm    Post subject: Reply with quote

Merci, c'est bien ça !
Y a t'il un moyen d'arranger ça en continuant à passer par acpid ? Sinon, est-il possible d'attribuer des raccourcis claviers aux touches Fn sans passer par acpid, ou as-tu utilisé une autre combinaison ?
Back to top
View user's profile Send private message
guilc
Bodhisattva
Bodhisattva


Joined: 15 Nov 2003
Posts: 3326
Location: Paris - France

PostPosted: Tue Oct 27, 2009 9:04 pm    Post subject: Reply with quote

J'ai eu le même problème pour mon script qui fait du xrandr pour activer/désactiver l'écran externe du laptop.

Ceci règle le souci :
Code:
export DISPLAY=:0
export XAUTHORITY=/home/$(who | awk '{if ($2 == ":0") print $1}')/.Xauthority

_________________
Merci de respecter les règles du forum.

Mon site perso : https://www.xwing.info
Mon PORTDIR_OVERLAY : https://gentoo.xwing.info ou layman -a xwing
Back to top
View user's profile Send private message
kernelsensei
Bodhisattva
Bodhisattva


Joined: 22 Feb 2004
Posts: 5619
Location: Woustviller/Moselle/FRANCE (49.07°N;7.02°E)

PostPosted: Tue Oct 27, 2009 10:41 pm    Post subject: Reply with quote

Tiens chez moi ta commande avec who et awk ne retourne rien. Que donne un simple who chez toi ? Chez moi ça ressemble à ça :
Code:

% who
root     tty1         2009-10-27 17:11
boris    tty7         2009-10-27 17:16 (:0)
boris    pts/0        2009-10-27 17:16 (:0.0)
boris    pts/1        2009-10-27 17:22 (:0.0)
boris    pts/2        2009-10-27 17:25 (:0.0)
boris    pts/3        2009-10-27 17:29 (:0.0)
boris    pts/4        2009-10-27 18:29 (:0.0)
boris    pts/5        2009-10-27 23:34 (:0.0)


Ce qui explique pourquoi ta commande awk ne retourne rien chez moi vu que mon $2 c'est la colonne tty/pts

Un truc du genre serait plus adapté ici :
Code:
who | awk '{if ($0 ~ /[^0-9.]:0[^0-9.]/) print $1}'


T'en penses quoi ?
_________________
$ ruby -e'puts " .:@BFegiklnorst".unpack("x4ax7aaX6ax5aX15ax4aax6aaX7ax2aX5aX8 \
axaX3ax8aX4ax6aX3aX6ax3ax3aX9ax4ax2aX9axaX6ax3aX2ax4ax3aX4aXaX12ax10aaX7a").join'
Back to top
View user's profile Send private message
guilc
Bodhisattva
Bodhisattva


Joined: 15 Nov 2003
Posts: 3326
Location: Paris - France

PostPosted: Tue Oct 27, 2009 10:52 pm    Post subject: Reply with quote

A adapter alors oui.
En fait chez moi dans who j'ai ça :
Code:
casta    :0           2009-10-27 21:29
casta    pts/2        2009-10-27 21:29 (:0)
casta    pts/1        2009-10-27 21:29 (:0)
root     pts/3        2009-10-27 21:29 (:0:S.0)

Donc ça marche :)

Dans ce cas la, plutot ça alors :
Code:
who | awk '{if ($0 ~ /[^0-9.]:0[^0-9.:]/) print $1}' | head -n 1

Sinon il chope les screen (chez moi en tous cas, voir le who au dessus)
Et un petit head parce que sinon il sort plusieurs lignes, et le path va pas aimer...


[EDIT]
Et avec "w", ça serait pas plus homogène entre les configurations ?
Code:
$ w
 00:23:24 up  2:54,  4 users,  load average: 0,06, 0,11, 0,11
USER     TTY        LOGIN@   IDLE   JCPU   PCPU WHAT
casta    :0        21:29   ?xdm?  37:10   0.00s /bin/sh /usr/bin/startkde
casta    pts/2     21:29    1.00s  0.20s  0.00s w
casta    pts/1     21:29    2:23m  0.19s  0.01s ssh coruscant.v6
root     pts/3     21:29    1:47m  0.19s  0.19s -/bin/bash



[EDIT2]
Et mis à part ça, tu confirmes qu'exporter ces 2 variables autorise bien le script à fonctionner via acpid ? (c'est quand même la question principale) :)
_________________
Merci de respecter les règles du forum.

Mon site perso : https://www.xwing.info
Mon PORTDIR_OVERLAY : https://gentoo.xwing.info ou layman -a xwing
Back to top
View user's profile Send private message
Zoboulo
Tux's lil' helper
Tux's lil' helper


Joined: 07 Apr 2007
Posts: 97

PostPosted: Wed Oct 28, 2009 11:59 am    Post subject: Reply with quote

Merci les gars, ça marche en rajoutant les deux lignes de guilc !
Back to top
View user's profile Send private message
Leander256
l33t
l33t


Joined: 05 Jul 2003
Posts: 910
Location: Singapour

PostPosted: Wed Oct 28, 2009 1:05 pm    Post subject: Reply with quote

Juste histoire de rajouter à la confusion, j'utilise slim avec fluxbox et who et w me renvoient :0.0 et non pas seulement :0
Code:
$ who
thomas   :0.0         2009-10-19 05:14
$ w
 13:23:07 up 9 days,  9:09,  1 user,  load average: 0.32, 0.28, 0.35
USER     TTY        LOGIN@   IDLE   JCPU   PCPU WHAT
thomas   :0.0      19Oct09 ?xdm?  13:27m  3:23  fluxbox

Je ne sais pas qui est responsable de la création de cette variable exactement, quoiqu'il en soit pour couvrir mon cas on peut rajouter le .0 en conditionnel:
Code:
who | awk '{if ($0 ~ /[^0-9.]:0(.0)?[^0-9.:]/) print $1}'
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index French 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