[Pkg-kde-commits] rev 1969 - in branches/kde-3.4.0/packages/kdebase/debian: . patches

Christopher Martin chrsmrtn at costa.debian.org
Sat Oct 15 17:59:00 UTC 2005


Author: chrsmrtn
Date: 2005-10-15 17:58:59 +0000 (Sat, 15 Oct 2005)
New Revision: 1969

Added:
   branches/kde-3.4.0/packages/kdebase/debian/kcontrol.postinst
   branches/kde-3.4.0/packages/kdebase/debian/kcontrol.postrm
   branches/kde-3.4.0/packages/kdebase/debian/usermap.pl
Modified:
   branches/kde-3.4.0/packages/kdebase/debian/control
   branches/kde-3.4.0/packages/kdebase/debian/kcontrol.README.Debian
   branches/kde-3.4.0/packages/kdebase/debian/patches/17_logitechmouse.diff
   branches/kde-3.4.0/packages/kdebase/debian/rules
Log:
udev support for kcontrol's logitech mouse special support. What a pain.


Modified: branches/kde-3.4.0/packages/kdebase/debian/control
===================================================================
--- branches/kde-3.4.0/packages/kdebase/debian/control	2005-10-15 17:57:30 UTC (rev 1968)
+++ branches/kde-3.4.0/packages/kdebase/debian/control	2005-10-15 17:58:59 UTC (rev 1969)
@@ -71,7 +71,7 @@
 Section: kde
 Architecture: any
 Depends: ${shlibs:Depends}, kdebase-data (>> ${KDE-Version3}), kdebase-data (<< ${KDE-Version2}.90)
-Recommends: hotplug
+Recommends: udev | hotplug
 Suggests: khelpcenter
 Conflicts: kdebase-libs (<< 4:3.0.0)
 Replaces: kdebase (<< 4:3.0.0), kdebase-doc (<< 4:3.0.0), kdebase-libs (<< 4:3.0.0), konqueror (<< 4:3.0.0)
@@ -83,8 +83,9 @@
  but the control center organizes all of these programs into a convenient
  location.
  .
- In combination with hotplug, KControl supports the advanced configuration
- of Logitech mice, though the user must be a member of the plugdev group.
+ In combination with udev or hotplug, KControl supports the advanced
+ configuration of Logitech mice, though the user must be a member of the
+ plugdev group.
  .
  This package is part of KDE, and a component of the KDE base module.
  See the 'kde' and 'kdebase' packages for more information.

Modified: branches/kde-3.4.0/packages/kdebase/debian/kcontrol.README.Debian
===================================================================
--- branches/kde-3.4.0/packages/kdebase/debian/kcontrol.README.Debian	2005-10-15 17:57:30 UTC (rev 1968)
+++ branches/kde-3.4.0/packages/kdebase/debian/kcontrol.README.Debian	2005-10-15 17:58:59 UTC (rev 1969)
@@ -1,15 +1,15 @@
 KControl and Logitech mice
 ==========================
 
-In combination with the hotplug package, KControl supports the advanced
-configuration of many models of Logitech mice, though regular users must
-be members of the plugdev group for this to work.
+In combination with the udev or hotplug packages, KControl supports the
+advanced configuration of many models of Logitech mice, though regular users
+must be members of the plugdev group for this to work.
 
 The system's kernel must also support hotplugging, as well as usbdevfs.
 
-After installing KControl for the first time, or updating to KControl
-3.4.x or later from an earlier package, you will need to unplug and
-then replug your mouse, in order to force hotplug to grant special
-permissions to your mouse, so that KControl can perform advanced
-configuration. Rebooting or restarting hotplug will of course accomplish
-the same thing.
+After installing KControl for the first time, or updating to KControl 3.4.x
+or later from an earlier package, you will need to unplug and then replug
+your mouse, in order to force udev or hotplug to grant special permissions
+to your mouse, so that KControl can perform advanced configuration.
+Rebooting or restarting udev/hotplug will of course accomplish the same
+thing.

Added: branches/kde-3.4.0/packages/kdebase/debian/kcontrol.postinst
===================================================================
--- branches/kde-3.4.0/packages/kdebase/debian/kcontrol.postinst	2005-10-15 17:57:30 UTC (rev 1968)
+++ branches/kde-3.4.0/packages/kdebase/debian/kcontrol.postinst	2005-10-15 17:58:59 UTC (rev 1969)
@@ -0,0 +1,14 @@
+#!/bin/sh -e
+
+case "$1" in
+
+	configure)
+	LINK="/etc/udev/rules.d/025_logitechmouse.rules"
+	[ -e "$LINK" ] || [ -L "$LINK" ] || ln -s ../logitechmouse.rules "$LINK"
+	;;
+
+esac
+
+#DEBHELPER#
+
+exit 0

Added: branches/kde-3.4.0/packages/kdebase/debian/kcontrol.postrm
===================================================================
--- branches/kde-3.4.0/packages/kdebase/debian/kcontrol.postrm	2005-10-15 17:57:30 UTC (rev 1968)
+++ branches/kde-3.4.0/packages/kdebase/debian/kcontrol.postrm	2005-10-15 17:58:59 UTC (rev 1969)
@@ -0,0 +1,14 @@
+#!/bin/sh -e
+
+case "$1" in
+
+	purge)
+	LINK="/etc/udev/rules.d/025_logitechmouse.rules"
+	[ ! -L "$LINK" ] || rm -f "$LINK"
+	;;
+
+esac
+
+#DEBHELPER#
+
+exit 0

Modified: branches/kde-3.4.0/packages/kdebase/debian/patches/17_logitechmouse.diff
===================================================================
--- branches/kde-3.4.0/packages/kdebase/debian/patches/17_logitechmouse.diff	2005-10-15 17:57:30 UTC (rev 1968)
+++ branches/kde-3.4.0/packages/kdebase/debian/patches/17_logitechmouse.diff	2005-10-15 17:58:59 UTC (rev 1969)
@@ -1,36 +1,32 @@
 --- kde.orig/kcontrol/input/consoleUserPerms
 +++ kde.patched/kcontrol/input/consoleUserPerms
-@@ -1,42 +1,27 @@
- #!/bin/bash
- #
+@@ -1,42 +1,16 @@
+-#!/bin/bash
+-#
 -# /etc/hotplug/usb/consoleUserPerms
-+# /etc/hotplug/usb/logitechmouse
- #
+-#
 -# Sets up newly plugged in USB device so that the user who owns
 -# the console according to pam_console can access it from user space
-+# Sets up newly plugged-in USB device so that members of the plugdev
-+# group can access it from userspace.
- #
- # Note that for this script to work, you'll need all of the following:
- # a) a line in the file /etc/hotplug/usb.usermap or another usermap file
- #    in /etc/hotplug/usb/ that corresponds to the device you are using.
+-#
+-# Note that for this script to work, you'll need all of the following:
+-# a) a line in the file /etc/hotplug/usb.usermap or another usermap file
+-#    in /etc/hotplug/usb/ that corresponds to the device you are using.
 -# b) a setup using pam_console creates the respective lock files
 -#    containing the name of the respective user. You can check for that
 -#    by executing "echo `cat /var/{run,lock}/console.lock`" and
 -#    verifying the appropriate user is mentioned somewhere there.
-+# b) membership in the plugdev group for all users who intend to use
-+#    this setup.
- # c) a Linux kernel supporting hotplug and usbdevfs
- # d) the hotplug package (http://linux-hotplug.sourceforge.net/)
- #
- # In the usermap file, the first field "usb module" should be named
+-# c) a Linux kernel supporting hotplug and usbdevfs
+-# d) the hotplug package (http://linux-hotplug.sourceforge.net/)
+-#
+-# In the usermap file, the first field "usb module" should be named
 -# "consoleUserPerms" to invoke this script.
 -#
-+# "logitechmouse" to invoke this script.
-+
-+GROUP=plugdev
++#!/bin/sh
  
- if [ "${ACTION}" = "add" ] && [ -f "${DEVICE}" ]
+-if [ "${ACTION}" = "add" ] && [ -f "${DEVICE}" ]
++GROUP=plugdev
++
++if [ "${ACTION}" = "add" ]
  then
 -    # New code, using lock files instead of copying /dev/console permissions
 -    # This also works with non-kdm logins (e.g. on a virtual terminal)
@@ -50,62 +46,12 @@
 -        chown "$CONSOLEOWNER" "${DEVICE}"
 -        chmod 0600 "${DEVICE}"
 +    if getent group $GROUP > /dev/null; then
-+        chmod 660 "${DEVICE}"
-+        chown root.$GROUP "${DEVICE}"
++	N=0
++	while [ ! -e $DEVICE ] && [ $N -lt 25 ]; do
++		sleep 1
++		N=$(expr $N + 1)
++	done
++	chmod 660 "${DEVICE}"
++	chown root:$GROUP "${DEVICE}"
      fi
  fi
---- kde.orig/kcontrol/input/logitechmouse.usermap
-+++ kde.patched/kcontrol/input/logitechmouse.usermap
-@@ -1,35 +1,35 @@
- # script           match_flags idVendor idProduct bcdDevice_lo bcdDevice_hi bDeviceClass bDeviceSubClass bDeviceProtocol bInterfaceClass bInterfaceSubClass bInterfaceProtocol driver_info
- # Wheel Mouse Optical
--consoleUserPerms     0x0003      0x046d   0xc00e    0x0000       0xffff      0x00         0x00            0x00            0x00            0x00               0x00               0x00000000
-+logitechmouse     0x0003      0x046d   0xc00e    0x0000       0xffff      0x00         0x00            0x00            0x00            0x00               0x00               0x00000000
- # MouseMan Traveler
--consoleUserPerms     0x0003      0x046d   0xc00f    0x0000       0xffff      0x00         0x00            0x00            0x00            0x00               0x00               0x00000000
-+logitechmouse     0x0003      0x046d   0xc00f    0x0000       0xffff      0x00         0x00            0x00            0x00            0x00               0x00               0x00000000
- # MouseMan Dual Optical
--consoleUserPerms     0x0003      0x046d   0xc012    0x0000       0xffff      0x00         0x00            0x00            0x00            0x00               0x00               0x00000000
-+logitechmouse     0x0003      0x046d   0xc012    0x0000       0xffff      0x00         0x00            0x00            0x00            0x00               0x00               0x00000000
- # MX310 Optical Mouse
--consoleUserPerms     0x0003      0x046d   0xc01b    0x0000       0xffff      0x00         0x00            0x00            0x00            0x00               0x00               0x00000000
-+logitechmouse     0x0003      0x046d   0xc01b    0x0000       0xffff      0x00         0x00            0x00            0x00            0x00               0x00               0x00000000
- # MX510 Optical Mouse
--consoleUserPerms     0x0003      0x046d   0xc01d    0x0000       0xffff      0x00         0x00            0x00            0x00            0x00               0x00               0x00000000
-+logitechmouse     0x0003      0x046d   0xc01d    0x0000       0xffff      0x00         0x00            0x00            0x00            0x00               0x00               0x00000000
- # MX300 Optical Mouse
--consoleUserPerms     0x0003      0x046d   0xc024    0x0000       0xffff      0x00         0x00            0x00            0x00            0x00               0x00               0x00000000
-+logitechmouse     0x0003      0x046d   0xc024    0x0000       0xffff      0x00         0x00            0x00            0x00            0x00               0x00               0x00000000
- # MX500 Optical Mouse
--consoleUserPerms     0x0003      0x046d   0xc025    0x0000       0xffff      0x00         0x00            0x00            0x00            0x00               0x00               0x00000000
-+logitechmouse     0x0003      0x046d   0xc025    0x0000       0xffff      0x00         0x00            0x00            0x00            0x00               0x00               0x00000000
- # iFeel Mouse
--consoleUserPerms     0x0003      0x046d   0xc031    0x0000       0xffff      0x00         0x00            0x00            0x00            0x00               0x00               0x00000000
-+logitechmouse     0x0003      0x046d   0xc031    0x0000       0xffff      0x00         0x00            0x00            0x00            0x00               0x00               0x00000000
- # Mouse Receiver
--consoleUserPerms     0x0003      0x046d   0xc501    0x0000       0xffff      0x00         0x00            0x00            0x00            0x00               0x00               0x00000000
-+logitechmouse     0x0003      0x046d   0xc501    0x0000       0xffff      0x00         0x00            0x00            0x00            0x00               0x00               0x00000000
- # Dual Receiver
--consoleUserPerms     0x0003      0x046d   0xc502    0x0000       0xffff      0x00         0x00            0x00            0x00            0x00               0x00               0x00000000
-+logitechmouse     0x0003      0x046d   0xc502    0x0000       0xffff      0x00         0x00            0x00            0x00            0x00               0x00               0x00000000
- # Cordless Freedom Optical
--consoleUserPerms     0x0003      0x046d   0xc504    0x0000       0xffff      0x00         0x00            0x00            0x00            0x00               0x00               0x00000000
-+logitechmouse     0x0003      0x046d   0xc504    0x0000       0xffff      0x00         0x00            0x00            0x00            0x00               0x00               0x00000000
- # Cordless Elite Duo
--consoleUserPerms     0x0003      0x046d   0xc505    0x0000       0xffff      0x00         0x00            0x00            0x00            0x00               0x00               0x00000000
-+logitechmouse     0x0003      0x046d   0xc505    0x0000       0xffff      0x00         0x00            0x00            0x00            0x00               0x00               0x00000000
- # MX700 Optical Mouse
--consoleUserPerms     0x0003      0x046d   0xc506    0x0000       0xffff      0x00         0x00            0x00            0x00            0x00               0x00               0x00000000
-+logitechmouse     0x0003      0x046d   0xc506    0x0000       0xffff      0x00         0x00            0x00            0x00            0x00               0x00               0x00000000
- # Cordless Optical Trackman
--consoleUserPerms     0x0003      0x046d   0xc508    0x0000       0xffff      0x00         0x00            0x00            0x00            0x00               0x00               0x00000000
-+logitechmouse     0x0003      0x046d   0xc508    0x0000       0xffff      0x00         0x00            0x00            0x00            0x00               0x00               0x00000000
- # Cordless MX Duo Receiver
--consoleUserPerms     0x0003      0x046d   0xc50b    0x0000       0xffff      0x00         0x00            0x00            0x00            0x00               0x00               0x00000000
-+logitechmouse     0x0003      0x046d   0xc50b    0x0000       0xffff      0x00         0x00            0x00            0x00            0x00               0x00               0x00000000
- # MX100 Laser Mouse
--consoleUserPerms     0x0003      0x046d   0xc50e    0x0000       0xffff      0x00         0x00            0x00            0x00            0x00               0x00               0x00000000
-+logitechmouse     0x0003      0x046d   0xc50e    0x0000       0xffff      0x00         0x00            0x00            0x00            0x00               0x00               0x00000000
- # Receiver for Cordless Presenter
--consoleUserPerms     0x0003      0x046d   0xc702    0x0000       0xffff      0x00         0x00            0x00            0x00            0x00               0x00               0x00000000
-+logitechmouse     0x0003      0x046d   0xc702    0x0000       0xffff      0x00         0x00            0x00            0x00            0x00               0x00               0x00000000

Modified: branches/kde-3.4.0/packages/kdebase/debian/rules
===================================================================
--- branches/kde-3.4.0/packages/kdebase/debian/rules	2005-10-15 17:57:30 UTC (rev 1968)
+++ branches/kde-3.4.0/packages/kdebase/debian/rules	2005-10-15 17:58:59 UTC (rev 1969)
@@ -61,5 +61,8 @@
 	dh_installxfonts -pxfonts-konsole
 
 binary-install/kcontrol::
-	install -p -D -m644 kcontrol/input/logitechmouse.usermap debian/kcontrol/etc/hotplug/usb/logitechmouse.usermap
 	install -p -D -m755 kcontrol/input/consoleUserPerms debian/kcontrol/etc/hotplug/usb/logitechmouse
+	cat kcontrol/input/logitechmouse.usermap | sed -e 's/consoleUserPerms/logitechmouse/' \
+		> debian/kcontrol/etc/hotplug/usb/logitechmouse.usermap
+	mkdir -p debian/kcontrol/etc/udev/rules.d
+	debian/usermap.pl kcontrol/input/logitechmouse.usermap > debian/kcontrol/etc/udev/logitechmouse.rules

Added: branches/kde-3.4.0/packages/kdebase/debian/usermap.pl
===================================================================
--- branches/kde-3.4.0/packages/kdebase/debian/usermap.pl	2005-10-15 17:57:30 UTC (rev 1968)
+++ branches/kde-3.4.0/packages/kdebase/debian/usermap.pl	2005-10-15 17:58:59 UTC (rev 1969)
@@ -0,0 +1,55 @@
+#!/usr/bin/perl
+
+# Copyright (C) 2005 Mandriva
+# Olivier Blin
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+my $script = '/etc/hotplug/usb/logitechmouse';
+
+my %flags = (
+    idVendor => 0x0001,
+    idProduct => 0x0002,
+);
+
+sub parse_usermap_line {
+    local $_ = shift;
+    /^#/ and next;
+    my %match;
+    @match{module, match_flags, idVendor, idProduct} = 
+	/^(\S+)\s+0x(\w{2,})\s+0x(\w{2,})\s+0x(\w{2,})\s+0x(\w{2,})\s+0x(\w{2,})\s+0x(\w{2})\s+0x(\w{2})\s+0x(\w{2})\s+0x(\w{2})\s+0x(\w{2})\s+0x(\w{2})(?:\s+0x(\w{2,}))?/
+	or die qq(unable to parse line "$_");
+    $match{match_flags} = hex($match{match_flags});
+    $match{driver_info} ||= 0;
+
+    my @rule;
+    while (my ($key, $flag) = each(%flags)) {
+	hex($match{match_flags}) & $flag and push @rule, qq(SYSFS{$key}=="$match{$key}",);
+    }
+    push @rule,
+    (
+     qq(RUN+="$script"),
+     );
+    print join(' ', @rule) . "\n";
+}
+
+print "BUS!=\"usb\", ACTION!=\"add\"\, GOTO=\"kcontrol_rules_end\"\n\n";
+
+foreach my $usermap (@ARGV) {
+    open(my $IN, $usermap . (-x $usermap && "|")) or die "unable to open usermap $usermap";
+    parse_usermap_line($_) foreach <$IN>;
+}
+
+print "\nLABEL=\"kcontrol_rules_end\"\n";


Property changes on: branches/kde-3.4.0/packages/kdebase/debian/usermap.pl
___________________________________________________________________
Name: svn:executable
   + *




More information about the pkg-kde-commits mailing list