add mouse detect
This commit is contained in:
@@ -29,7 +29,6 @@ logger -t retrodebian-xorg-autoconfig " Vendor : $PCI_VENDOR_NAME [$PCI_VENDOR
|
||||
logger -t retrodebian-xorg-autoconfig " Device : $PCI_DEVICE_NAME [$PCI_DEVICE_ID]"
|
||||
logger -t retrodebian-xorg-autoconfig " BusID : $XORG_BUSID"
|
||||
|
||||
MATCHED=0
|
||||
|
||||
ROOT_DIR="/opt/retrodebian/xorg"
|
||||
XORG_FILE_BASENAME="xorg.conf"
|
||||
@@ -38,6 +37,8 @@ TMP_XORG_FILE_PATH="$(mktemp)"
|
||||
|
||||
cp "${ROOT_DIR}/${TEMPLATE_XORG_FILE}" "${TMP_XORG_FILE_PATH}"
|
||||
|
||||
MATCHED=0
|
||||
|
||||
for module in "${ROOT_DIR}/video-detect.d/"*.sh; do
|
||||
[ -f "$module" ] || continue
|
||||
|
||||
@@ -68,6 +69,28 @@ sed -i \
|
||||
|
||||
[ "$MATCHED" -eq 1 ] || exit 2
|
||||
|
||||
MATCHED=0
|
||||
|
||||
for module in "${ROOT_DIR}/mouse-detect.d/"*.sh; do
|
||||
[ -f "$module" ] || continue
|
||||
|
||||
logger -t retrodebian-xorg-autoconfig "Trying module: $module"
|
||||
|
||||
if "$module" "${TMP_XORG_FILE_PATH}"
|
||||
then
|
||||
logger -t retrodebian-xorg-autoconfig "Matched module: $module"
|
||||
MATCHED=1
|
||||
break
|
||||
else
|
||||
rc=$?
|
||||
if [ "$rc" -ne 1 ]; then
|
||||
logger -p daemon.err -t retrodebian-xorg-autoconfig "ERROR: module failed: $module"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
[ "$MATCHED" -eq 1 ] || exit 2
|
||||
|
||||
cp -f "${TMP_XORG_FILE_PATH}" "$DEST_XORG_CONF"
|
||||
rm -f "${TMP_XORG_FILE_PATH}"
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
# 01000-mouse-qemu-tablet.sh
|
||||
# Prefer QEMU USB Tablet when present
|
||||
|
||||
XORG_CONF="$1"
|
||||
|
||||
[ -n "$XORG_CONF" ] || exit 2
|
||||
[ -f "$XORG_CONF" ] || exit 2
|
||||
[ -r /proc/bus/input/devices ] || exit 1
|
||||
|
||||
EVENT_DEV="$(awk '
|
||||
BEGIN { RS=""; FS="\n" }
|
||||
$0 ~ /QEMU USB Tablet/ {
|
||||
for (i = 1; i <= NF; i++) {
|
||||
if ($i ~ /^H: Handlers=/ && match($i, /event[0-9]+/)) {
|
||||
print "/dev/input/" substr($i, RSTART, RLENGTH)
|
||||
exit
|
||||
}
|
||||
}
|
||||
}' /proc/bus/input/devices)"
|
||||
|
||||
[ -n "$EVENT_DEV" ] || exit 1
|
||||
[ -e "$EVENT_DEV" ] || exit 1
|
||||
|
||||
logger -t retrodebian-xorg-autoconfig "Configuring QEMU tablet mouse: $EVENT_DEV"
|
||||
|
||||
sed -i \
|
||||
-e "s|{InputDeviceDriver}|evdev|g" \
|
||||
-e "s|{InputDeviceDevice}|$EVENT_DEV|g" \
|
||||
-e "s|{InputDeviceProtocol}|auto|g" \
|
||||
"$XORG_CONF" || exit 2
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
# 02000-mouse-wacom.sh
|
||||
# Prefer wacom for explicit Wacom devices
|
||||
|
||||
XORG_CONF="$1"
|
||||
|
||||
[ -n "$XORG_CONF" ] || exit 2
|
||||
[ -f "$XORG_CONF" ] || exit 2
|
||||
[ -r /proc/bus/input/devices ] || exit 1
|
||||
|
||||
EVENT_DEV="$(awk '
|
||||
BEGIN { RS=""; FS="\n" }
|
||||
$0 ~ /Wacom/ {
|
||||
for (i = 1; i <= NF; i++) {
|
||||
if ($i ~ /^H: Handlers=/ && match($i, /event[0-9]+/)) {
|
||||
print "/dev/input/" substr($i, RSTART, RLENGTH)
|
||||
exit
|
||||
}
|
||||
}
|
||||
}' /proc/bus/input/devices)"
|
||||
|
||||
[ -n "$EVENT_DEV" ] || exit 1
|
||||
[ -e "$EVENT_DEV" ] || exit 1
|
||||
|
||||
logger -t retrodebian-xorg-autoconfig "Configuring Wacom pointer: $EVENT_DEV"
|
||||
|
||||
sed -i \
|
||||
-e "s|{InputDeviceDriver}|wacom|g" \
|
||||
-e "s|{InputDeviceDevice}|$EVENT_DEV|g" \
|
||||
-e "s|{InputDeviceProtocol}|auto|g" \
|
||||
"$XORG_CONF" || exit 2
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
# 03000-mouse-synaptics.sh
|
||||
# Prefer synaptics for obvious touchpads
|
||||
|
||||
XORG_CONF="$1"
|
||||
|
||||
[ -n "$XORG_CONF" ] || exit 2
|
||||
[ -f "$XORG_CONF" ] || exit 2
|
||||
[ -r /proc/bus/input/devices ] || exit 1
|
||||
|
||||
EVENT_DEV="$(awk '
|
||||
BEGIN { RS=""; FS="\n" }
|
||||
$0 ~ /SynPS\/2/ || $0 ~ /TouchPad/ || $0 ~ /Touchpad/ || $0 ~ /ALPS/ || $0 ~ /Synaptics/ {
|
||||
for (i = 1; i <= NF; i++) {
|
||||
if ($i ~ /^H: Handlers=/ && match($i, /event[0-9]+/)) {
|
||||
print "/dev/input/" substr($i, RSTART, RLENGTH)
|
||||
exit
|
||||
}
|
||||
}
|
||||
}' /proc/bus/input/devices)"
|
||||
|
||||
[ -n "$EVENT_DEV" ] || exit 1
|
||||
[ -e "$EVENT_DEV" ] || exit 1
|
||||
|
||||
logger -t retrodebian-xorg-autoconfig "Configuring Synaptics touchpad: $EVENT_DEV"
|
||||
|
||||
sed -i \
|
||||
-e "s|{InputDeviceDriver}|synaptics|g" \
|
||||
-e "s|{InputDeviceDevice}|$EVENT_DEV|g" \
|
||||
-e "s|{InputDeviceProtocol}|auto-dev|g" \
|
||||
"$XORG_CONF" || exit 2
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
# 09900-mouse-proc-handler.sh
|
||||
# prefer a direct /dev/input/mouseN handler over /dev/input/mice
|
||||
|
||||
XORG_CONF="$1"
|
||||
|
||||
[ -n "$XORG_CONF" ] || exit 2
|
||||
[ -f "$XORG_CONF" ] || exit 2
|
||||
[ -r /proc/bus/input/devices ] || exit 1
|
||||
|
||||
MOUSE_DEV="$(awk '
|
||||
BEGIN { RS=""; FS="\n" }
|
||||
{
|
||||
for (i = 1; i <= NF; i++) {
|
||||
if ($i ~ /^H: Handlers=/ && match($i, /mouse[0-9]+/)) {
|
||||
print "/dev/input/" substr($i, RSTART, RLENGTH)
|
||||
exit
|
||||
}
|
||||
}
|
||||
}' /proc/bus/input/devices)"
|
||||
|
||||
[ -n "$MOUSE_DEV" ] || exit 1
|
||||
[ -e "$MOUSE_DEV" ] || exit 1
|
||||
|
||||
logger -t retrodebian-xorg-autoconfig "Configuring direct mouse handler fallback: $MOUSE_DEV"
|
||||
|
||||
sed -i \
|
||||
-e "s|{InputDeviceDriver}|mouse|g" \
|
||||
-e "s|{InputDeviceDevice}|$MOUSE_DEV|g" \
|
||||
-e "s|{InputDeviceProtocol}|ImPS/2|g" \
|
||||
"$XORG_CONF" || exit 2
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
# 99999-mouse-fallback.sh
|
||||
# ultimate fallback
|
||||
|
||||
XORG_CONF="$1"
|
||||
|
||||
[ -n "$XORG_CONF" ] || exit 2
|
||||
[ -f "$XORG_CONF" ] || exit 2
|
||||
|
||||
logger -t retrodebian-xorg-autoconfig "Configuring ultimate Mouse fallback"
|
||||
|
||||
sed -i \
|
||||
-e "s|{InputDeviceDriver}|mouse|g" \
|
||||
-e "s|{InputDeviceDevice}|/dev/input/mice|g" \
|
||||
-e "s|{InputDeviceProtocol}|auto|g" \
|
||||
"$XORG_CONF" || exit 2
|
||||
|
||||
exit 0
|
||||
@@ -47,10 +47,10 @@ EndSection
|
||||
Section "InputDevice"
|
||||
#__TAG__AUTOCONFIG_INPUTDEVICE_MOUSE__START__
|
||||
Identifier "Configured Mouse"
|
||||
Driver "mouse"
|
||||
Driver "{InputDeviceDriver}"
|
||||
Option "CorePointer"
|
||||
Option "Device" "/dev/input/mice"
|
||||
Option "Protocol" "ImPS/2"
|
||||
Option "Device" "{InputDeviceDevice}"
|
||||
Option "Protocol" "{InputDeviceProtocol}"
|
||||
Option "Emulate3Buttons" "true"
|
||||
#__TAG__AUTOCONFIG_INPUTDEVICE_MOUSE__END__
|
||||
EndSection
|
||||
|
||||
@@ -42,6 +42,7 @@ update-rc.d retrodebian-fluxbox-watch-menu defaults
|
||||
|
||||
chmod +r,ug+xw,o-w /opt/retrodebian/xorg/autoconfig.sh
|
||||
chmod +r,ug+xw,o-w /opt/retrodebian/xorg/video-detect.d/*.sh
|
||||
chmod +r,ug+xw,o-w /opt/retrodebian/xorg/mouse-detect.d/*.sh
|
||||
chmod +r,ug+xw,o-w /etc/init.d/retrodebian-xorg-autoconfig
|
||||
update-rc.d retrodebian-xorg-autoconfig defaults
|
||||
|
||||
|
||||
Reference in New Issue
Block a user