|
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17 System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64 User : nobody ( 99) PHP Version : 5.2.17 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)