What do you think of the attached patch?

-- 
Phil Dibowitz                             p...@ipom.com
Open Source software and tech docs        Insanity Palace of Metallica
http://www.phildev.net/                   http://www.ipom.com/

"Be who you are and say what you feel, because those who mind don't matter
 and those who matter don't mind."
 - Dr. Seuss

Index: INSTALL.linux
===================================================================
RCS file: /cvsroot/concordance/concordance/libconcord/INSTALL.linux,v
retrieving revision 1.14.2.3
diff -u -r1.14.2.3 INSTALL.linux
--- INSTALL.linux	7 Apr 2013 01:33:59 -0000	1.14.2.3
+++ INSTALL.linux	8 Apr 2013 21:09:58 -0000
@@ -33,7 +33,9 @@
 
 If you don't want to have to be root to use concordance (or any other
 libconcord frontend), you'll need to set up udev-acl, hal/consolekit, 
-hal/policykit or old udev support.
+hal/policykit or old udev support. Here are your options:
+
+* UDEV-ACL SUPPORT (recommended)
 
 Most modern distributions should use the udev-acl support. udev versions since
 167, released on 2011-03-30, have the necessary support for this method to
@@ -47,57 +49,63 @@
   make udev
   sudo make install_udev
 
-By default this installs rules in /lib/udev. You can override this by setting
-the UDEVLIBDIR environment variable (as root):
+* GENERIC-UDEV SUPPORT
 
-  UDEVLIBDIR=/etc/udev make install_udev
-
-If you have an older distribution without a recent enough version of udev, you
-can choose between old-style generic udev support, hal/consolekit support, and
-hal/policykit support.
+If you have a modern system, but your login manager doesn't support
+consolekit, (notably, 'xdm'), you'll need to use generic udev support. With
+this option, anyone in the group 'dialout' will have access to the remote
+control. To use this, do:
+
+  make generic_udev
+  sudo make install_generic_udev
+
+* HAL/POLICYKIT SUPPORT
+
+This is for people on older distributions that use HAL+PolicyKit. It will
+generate the appropriate HAL/PolicyKit files and install them in the right
+place for the console user to have access to the remote when it's plugged in.
+It will work only if your distribution has udev, HAL and PolicyKit of around
+the correct vintage - approximately, the versions that were current in early
+2009 - correctly built to work with each other.
 
 To use hal/policykit support, you can do:
 
   make policykit
   sudo make install_policykit
 
-This will generate a different udev file and all the appropriate HAL/policykit
-files and install them in the right place for the console user to have access
-to the remote when it's plugged in. It will work only if your distribution has
-udev, HAL and PolicyKit of around the correct vintage - approximately, the
-versions that were current in early 2009 - correctly built to work with each
-other.
-
-To use hal/consolekit, you can do:
-
-  make consolekit
-  sudo make install_consolekit
+* HAL/CONSOLEKIT SUPPORT
 
 This will do much the same as the hal/policykit support does, only with
 consolekit instead. As with the hal/policykit support, it depends on having
 udev, HAL and ConsoleKit of an early 2009 vintage, correctly built to work
 together.
 
-The safest option for old systems is the old generic udev support:
+* OLD_UDEV SUPPORT
 
-  make old-udev
-  sudo make install_old-udev
+The safest option for old systems is the old generic udev support.  Like
+"UDEV-GENERIC", this will allow anyone in the "dialout" group to read and
+write to harmony remote controls connected to the machine. However, it uses
+the syntax necessary for very old versions of udev.
 
-This will allow anyone in the "dialout" group to read and write to harmony
-remote controls connected to the machine. It should work with any udev system,
-including modern ones, but is a less sophisticated solution than the udev-acl
-support and requires you to add your user to the "dialout" group. 
+  make old_udev
+  sudo make install_old_udev
 
 If you are not sure which method to use, and your distribution came out since
-March 2011, try the new udev option first, as it provides the cleanest
+March 2011, try the udev-acl option first, as it provides the cleanest
 configuration and most transparent operation. If it does not work, you can try
 the hal/consolekit or hal/policykit options, but old-udev is the most likely
 to work.
 
-NOTE: By default the install prefix is /usr/local which means that the
-udev/policykit/consolekit make targets will install in /usr/local/etc which
-won't actually do anything. This means for these to work you must run
-./configure with
+NOTE:
+By default udev files will install in /lib/udev. You can override this by setting
+the UDEVLIBDIR environment variable (as root):
+
+  UDEVLIBDIR=/etc/udev make install_udev
+
+The policykit/consolekit files will install in datarootdir which is a subset
+of prefix, meaning, by default /usr/local/share. This will not work, so if you
+are using the hal/policykit/console kit targets, you must run ./configure
+with:
 *either*:
   --prefix=/usr
 *or*:
Index: Makefile.am
===================================================================
RCS file: /cvsroot/concordance/concordance/libconcord/Makefile.am,v
retrieving revision 1.11.2.8
diff -u -r1.11.2.8 Makefile.am
--- Makefile.am	7 Apr 2013 01:34:00 -0000	1.11.2.8
+++ Makefile.am	8 Apr 2013 21:09:58 -0000
@@ -14,6 +14,12 @@
 udev:
 	./gen_udev_support -u
 
+old_udev:
+	./gen_udev_support -o
+
+generic_udev:
+	./gen_udev_support -g
+
 install_udev_generic:
 	$(MKDIR_P) $(DESTDIR)$(UDEVLIBDIR)/udev/rules.d
 	$(install_sh_DATA) libconcord.rules \
@@ -26,11 +32,8 @@
 		$(DESTDIR)$(UDEVLIBDIR)/udev/
 
 install_udev: udev install_udev_generic
-
-old-udev:
-	./gen_udev_support -o
-
-install_old-udev: old-udev install_udev_generic
+install_old_udev: old-udev install_udev_generic
+install_generic_udev: old-udev install_udev_generic
 
 policykit:
 	./gen_udev_support -p
Index: gen_udev_support
===================================================================
RCS file: /cvsroot/concordance/concordance/libconcord/gen_udev_support,v
retrieving revision 1.1.2.3
diff -u -r1.1.2.3 gen_udev_support
--- gen_udev_support	29 Mar 2012 03:15:05 -0000	1.1.2.3
+++ gen_udev_support	8 Apr 2013 21:09:58 -0000
@@ -14,9 +14,14 @@
 # Copyright 2009 Phil Dibowitz
 #
 
-UDEV_POLICY_TEMPLATE='ATTR{idVendor}=="%s", ATTR{idProduct}=="%s", SYMLINK+="harmony-%%k"'
-UDEV_NEW_NO_POLICY_TEMPLATE='ATTR{idVendor}=="%s", ATTR{idProduct}=="%s", ENV{ID_REMOTE_CONTROL}="1"'
-UDEV_OLD_NO_POLICY_TEMPLATE='SYSFS{idVendor}=="%s", SYSFS{idProduct}=="%s", MODE="0660", GROUP="dialout"'
+UDEV_CONDITION_PARTIAL_TEMPLATE='ATTR{idVendor}=="%s", ATTR{idProduct}=="%s"'
+UDEV_CONDITION_TEMPLATE="SUBSYSTEM==\"usb\", $UDEV_CONDITION_PARTIAL_TEMPLATE"
+UDEV_ACTION='ENV{ID_REMOTE_CONTROL}="1"'
+UDEV_GENERIC_ACTION='MODE="0660", GROUP="dialout"'
+
+UDEV_OLD_CONDITION_TEMPLATE='SYSFS{idVendor}=="%s", SYSFS{idProduct}=="%s"'
+
+UDEV_POLICY_KIT_ACTION='SYMLINK+="harmony-%%k"'
 
 HAL_PRE_TEMPLATE='    <match key="usb_device.vendor_id" int="0x%s">'
 HAL_RULE_TEMPLATE='      <match key="usb_device.product_id" int="0x%s">
@@ -27,11 +32,12 @@
       </match>'
 HAL_POST='    </match>'
 
-NATIONAL_VID=0400
-NATIONAL_PID=c359
-LOGITECH_VID=046d
-LOGITECH_MIN_PID=c110
-LOGITECH_MAX_PID=c14f
+NATIONAL_VID='0400'
+NATIONAL_PID='c359'
+LOGITECH_VID='046d'
+LOGITECH_MIN_PID='c110'
+LOGITECH_MAX_PID='c14f'
+LOGITECH_PID_GLOB='c1[1-4][0-9a-f]'
 
 UDEV_FILE='libconcord.rules'
 UDEV_USBNET_FILE='libconcord-usbnet.rules'
@@ -62,7 +68,7 @@
 #
 # UDEV FUNCTIONS
 #
-emit_udev_header() {
+emit_old_udev_header() {
     file="$1"
     cat >$file <<END
 # Neat trick so that non-harmony devices don't read through a million rules
@@ -74,7 +80,7 @@
 END
 }
 
-emit_udev_footer() {
+emit_old_udev_footer() {
     file="$1"
     cat >>$file <<END
 GOTO="harmony_rules_end"
@@ -82,6 +88,21 @@
 END
 }
 
+emit_udev_rules() {
+  file="$1"
+  mode="$2"
+
+  template="$UDEV_CONDITION_TEMPLATE"
+  if [ "$mode" == 'generic_udev' ] ; then
+    template="$template, $UDEV_GENERIC_ACTION"
+  else
+    template="$template, $UDEV_ACTION"
+  fi
+
+  printf "$template\n" $NATIONAL_VID $NATIONAL_PID >>$file
+  printf "$template\n" $LOGITECH_VID $LOGITECH_PID_GLOB >>$file
+}
+
 # Rule for the usbnet family of remotes to start a DHCP daemon upon detection.
 emit_udev_usbnet_rules() {
     file="$1"
@@ -91,26 +112,43 @@
 END
 }
 
-emit_udev_rules() {
+emit_old_udev_rules() {
     file="$1"
-    type="$2"
-    if [ "$type" == 'policykit' -o "$type" == 'consolekit' ]; then
-        template="$UDEV_POLICY_TEMPLATE"
-    elif [ "$type" == 'old_udev' ]; then
-        template="$UDEV_OLD_NO_POLICY_TEMPLATE"
-    else
-        template="$UDEV_NEW_NO_POLICY_TEMPLATE"
-    fi
+    mode="$2"
+
+    case "$mode" in
+      policykit|consolekit)
+        template="$UDEV_CONDITION_PARTIAL_TEMPLATE, $UDEV_POLICY_KIT_ACTION"
+        ;;
+      old_udev)
+        template="$UDEV_OLD_CONDITION_TEMPLATE, $UDEV_GENERIC_ACTION"
+        ;;
+    esac
 
     emit_for_all $file "$template" 'yes'
 }
 
 create_udev_files() {
     mode=$1
+
     echo -n "Creating udev file: $UDEV_FILE ... "
-    emit_udev_header $UDEV_FILE
-    emit_udev_rules $UDEV_FILE $mode
-    emit_udev_footer $UDEV_FILE
+    # delete wahtever used to be there
+    rm -f $UDEV_FILE
+
+    case "$mode" in
+      policykit|consolekit|old_udev)
+        emit_old_udev_header $UDEV_FILE
+        emit_old_udev_rules $UDEV_FILE $mode
+        emit_old_udev_footer $UDEV_FILE
+        ;;
+      udev|generic_udev)
+        emit_udev_rules $UDEV_FILE $mode
+        ;;
+      *)
+        echo "BAD MODE: $mode"
+        exit 1
+        ;;
+    esac
     echo 'done'
     # USBNET rule needs to be in a separate file because it depends on
     # 75-net-description.rules.
@@ -217,10 +255,13 @@
 # MAIN
 #
 
-while getopts upco opt; do
+while getopts gupco opt; do
     case $opt in
+        g)
+            MODE='generic_udev'
+            ;;
         u)
-            MODE='udev_only'
+            MODE='udev'
             ;;
         p)
             MODE='policykit'

Attachment: signature.asc
Description: Digital signature

------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire 
the most talented Cisco Certified professionals. Visit the 
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
_______________________________________________
concordance-devel mailing list
concordance-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/concordance-devel

Reply via email to