2010년 3월 10일 수요일

[Ubuntu] TouchPad 설정하기2

아래에 터치패드를 설정할 수 있는 프로그램을 설치하는것을 보여줬으나 업데이트 이후 프로그램이 설치가 되지 않아 GUI를 사용할수가 없게 되었다. ㅠㅠ


이번엔 수동으로 터치패드를 On/Off 할 수 있는 방법을 알아보자.


참조사이트 : https://help.ubuntu.com/community/SynapticsTouchpad?highlight=%28touchpad%29#head-0987a19d083570b614bbf6648879b7afa18dc480


1. 환경파일 설정


노트북에 터치패드가 있다면 기본적으로 /etc/X11/xorg.conf 파일에 설정이 되어있을 것이다.

없다면 다음 설정을 해주어야 한다.


Section "InputDevice"

        Identifier      "Configured Mouse"

        Driver          "mouse"

        Option          "CorePointer"

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

        Option          "Protocol"              "ExplorerPS/2"

        Option          "ZAxisMapping"          "4 5"

        Option          "Emulate3Buttons"       "true"

EndSection


Section "InputDevice"

        Identifier      "Synaptics Touchpad"

        Driver          "synaptics"

        Option          "SendCoreEvents"        "true"

        Option          "Device"                "/dev/psaux"

        Option          "Protocol"              "auto-dev"

        Option          "HorizScrollDelta"      "0"

        Option          "SHMConfig"             "on"

EndSection



Section "ServerLayout"

        Identifier      "Default Layout"

        Screen          "Default Screen"

        InputDevice     "Generic Keyboard"

        InputDevice     "Configured Mouse"

        InputDevice     "stylus" "SendCoreEvents"

        InputDevice     "cursor" "SendCoreEvents"

        InputDevice     "eraser" "SendCoreEvents"

        InputDevice     "Synaptics Touchpad"

EndSection



위와 같은 설정을 했으면 시스템을 재시작하거나 X윈도우를 재시작한다.


재시작 후 다음 명령으로 터치패드의 작동상태를 확인한다.


synclient -m l터치패드의 움직임이 좌표로 표시될 것이다.



2. 실행명령어 등록


간단히 명령을 실행할 수 있도록 스크립트 파일을 만든다.


/usr/local/bin/tpoff 파일을 생성한다.


cd /usr/local/bin

gksudo gedit tpoff


#!/bin/bash

#


synclient touchpadoff=1



/usr/local/bin/tpon 파일을 생성한다.


gksudo gedit tpon


#!/bin/bash

#


synclient touchpadoff=0



/usr/local/bin/touchpad.py 파일을 생성한다.


gksudo gedit touchpad.py


#!/usr/bin/python

import os

import string



def ReadFile():

myfile = open('/tmp/synclient.tmp', 'rb')

for line in myfile:

TestString(line)

myfile.close()


def TestString(string):

for word in string.split():

if word == "TouchpadOff":

setting = string.split()

ChangeState(setting[2])



def ChangeState(current):

if current == "0":

os.system("synclient touchpadoff=1")

else:

os.system("synclient touchpadoff=0")

os.system("rm /tmp/synclient.tmp")


def Main():

ReadFile()

os.system("synclient -l > /tmp/synclient.tmp")

Main()


파일을 실행할 수 있도록 퍼미션을 변경한다.


sudo chmod 777 tpon tpoff touchpad.py



3. 패스워드를 물어보지 않고 파일을 실행할 수 있도록 설정한다.


sudo visudo


아래 내용을 추가한다.


{user} ALL = NOPASSWD: /usr/local/bin/touchpad.py


{user}에는 자신의 계정을 적고 /etc/sudoers 파일로 저장한다.



4. 이제 모든 설정이 마쳤다.

단축키로 등록하는 방법도 언급되어있으나 프로그램이 설치되지 않아 여기서 마치고 바탕화면이나 패널에 아이콘으로 등록을 하여 클릭만으로 온/오프를 실행할 수 있도록 프로그램을 등록하면 모든 설정은 끝난다.

댓글 없음:

댓글 쓰기