Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 39f7ce99838e7a07e5f1a33584cc35b7 > files > 3

logitech-mouse-common-0.1-6mdv2010.0.noarch.rpm

#!/bin/sh
#
# Copyright (c) 2005 Mandriva Inc.
# the GNU Public License applies
#
# Sets up higher resolution for Logitech mouse, and enable/disable
# Cruise Control (Smart Scroll)
#
# lmctl is used exclusively here; logitech_applet is not supported.
# This is because logitech_applet does not report anything sensible
# for me -- it reports my MX1000 as a 2 button mouse with no wheel!
#
# For now, plugging 2 or more Logitech mice into single system is
# not supported yet.
#
# ChangeLog:
# 2005-05-18 Abel Cheung <abel@oaka.org>
#            Create script, inspired by SuSE logitech_applet package

PATH=/sbin:/bin:/usr/sbin:/usr/bin
lmctl=`which lmctl 2> /dev/null`

[ -x "$lmctl" ] || exit 1

# Exit if Product ID is not provided
[ -n "$1" ] || exit 1
productid="$1"

[ -f /etc/sysconfig/logitechmouse ] && . /etc/sysconfig/logitechmouse

doit=0
lmctl_options="--pid=$productid"

# Check the capability of mouse, and ignore those settings not appropriate
feature=`$lmctl --scan --pid=$productid | sed 's/.*Caps: //'`

if echo "$feature" | grep -q '[A-Z]'; then
	:
else
	logger -t "logitech-mouse" "mouse does not support any feature"
	exit 0
fi

if echo "$feature" | grep -q RES; then
	if [ "$LOGITECH_MOUSE_RESOLUTION" = "400" -o "$LOGITECH_MOUSE_RESOLUTION" = "800" ]; then
		lmctl_options="$lmctl_options --$LOGITECH_MOUSE_RESOLUTION"
		logger -t "logitech-mouse" "set resolution to $LOGITECH_MOUSE_RESOLUTION"
		doit=1
	fi
fi

if echo "$feature" | grep -q SMS; then
	if [ "$LOGITECH_MOUSE_DISABLE_CC" = "0" -o "$LOGITECH_MOUSE_DISABLE_CC" = "no" ]; then
		lmctl_options="$lmctl_options --sms"
		logger -t "logitech-mouse" "enable Cruise Control"
		doit=1
	elif [ "$LOGITECH_MOUSE_DISABLE_CC" = "1" -o "$LOGITECH_MOUSE_DISABLE_CC" = "yes" ]; then
		lmctl_options="$lmctl_options --no-sms"
		logger -t "logitech-mouse" "disable Cruise Control"
		doit=1
	fi
fi

[ "$doit" = "0" ] && exit 0

output=`$lmctl $lmctl_options`
logger -t "logitech-mouse" "$output"