MOON
Server: Apache/2.2.31 (Unix) mod_ssl/2.2.31 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4
System: Linux csr818.wilogic.com 2.6.18-419.el5xen #1 SMP Fri Feb 24 22:50:37 UTC 2017 x86_64
User: digitals (531)
PHP: 5.4.45
Disabled: NONE
Upload Files
File: //usr/local/ssl/local/ssl/sbin/fix-mouse-psaux
#!/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)