|
Server : Apache/2.2.2 (Fedora) System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686 User : apache ( 48) PHP Version : 5.2.9 Disable Function : NONE Directory : /usr/sbin/ |
Upload File : |
#!/usr/bin/python
import xf86config
import os
import sys
mousedev = ""
if os.access("/dev/mouse", os.O_RDONLY):
mousedev = os.readlink("/dev/mouse")
if mousedev.endswith("psaux"):
os.unlink("/dev/mouse")
os.symlink("/dev/input/mice","/dev/mouse")
os.system("mouseconfig --noui generic3ps/2")
needsFixed = 0
foundZ = 0
(xconfig, xconfigpath) = xf86config.readConfigFile()
if not xconfig:
sys.exit(0)
Xmouse = xf86config.getCorePointer(xconfig)
if not Xmouse:
sys.exit(0)
for o in Xmouse.options:
if o.name == "Device" and o.val == "/dev/psaux":
o.val = "/dev/input/mice"
needsFixed = 1
if o.name == "Device" and o.val == "/dev/mouse" and mousedev.endswith("psaux"):
o.val = "/dev/input/mice"
needsFixed = 1
if o.name == "Protocol":
o.val = "IMPS/2"
if o.name == "ZAxisMapping":
foundZ = 1
if not foundZ:
option = xf86config.XF86Option("ZAxisMapping\" \"4 5")
Xmouse.options.insert(option)
if needsFixed:
xconfig.write(xconfigpath)
sys.exit(0)