From mboxrd@z Thu Jan 1 00:00:00 1970 From: Philippe Troin Date: Sat, 19 Mar 2005 21:39:39 +0000 Subject: Multiple firmware paths Message-Id: <87mzsz8gdg.fsf@ceramic.fifi.org> MIME-Version: 1 Content-Type: multipart/mixed; boundary="=-=-=" List-Id: To: linux-hotplug@vger.kernel.org --=-=-= [I'm not subscribed to linux-hotplug-devel@lists.sourceforge.net, please CC any replies] Hi, The enclosed patch makes hotplug work with multiple firmware directories (typically in /usr/local, /usr, /lib). There's one patch against cvs, and one patch against the latest release. Phil. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=hotplug-2004_03_29-multiple-firmware-dirs.patch diff -ruN hotplug-2004_03_29.orig/etc/hotplug/firmware.agent hotplug-2004_03_29/etc/hotplug/firmware.agent --- hotplug-2004_03_29.orig/etc/hotplug/firmware.agent Fri Mar 26 14:34:34 2004 +++ hotplug-2004_03_29/etc/hotplug/firmware.agent Sat Mar 19 13:29:29 2005 @@ -20,7 +20,8 @@ # DEBUG=yes export DEBUG # directory of the firmware files -FIRMWARE_DIR=/usr/lib/hotplug/firmware +FIRMWARE_DIRS="/opt/lib/hotplug/firmware /usr/local/lib/hotplug/firmware \ + /usr/lib/hotplug/firmware /lib/hotplug/firmware" # mountpoint of sysfs SYSFS=$(sed -n 's/^.* \([^ ]*\) sysfs .*$/\1/p' /proc/mounts) @@ -40,13 +41,16 @@ sleep 1 fi - if [ -f "$FIRMWARE_DIR/$FIRMWARE" ]; then - echo 1 > $SYSFS/$DEVPATH/loading - cp "$FIRMWARE_DIR/$FIRMWARE" $SYSFS/$DEVPATH/data - echo 0 > $SYSFS/$DEVPATH/loading - else - echo -1 > $SYSFS/$DEVPATH/loading - fi + done=-1 + for i in $FIRMWARE_DIRS; do + if [ -f "$i/$FIRMWARE" ]; then + echo 1 > $SYSFS/$DEVPATH/loading + cp "$i/$FIRMWARE" $SYSFS/$DEVPATH/data + done=0 + break + fi + done + echo $done > $SYSFS/$DEVPATH/loading ;; --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=hotplug-cvs-multiple-firmware-dirs.patch Index: etc/hotplug/firmware.agent =================================================================== RCS file: /cvsroot/linux-hotplug/admin/etc/hotplug/firmware.agent,v retrieving revision 1.5 diff -b -u -r1.5 firmware.agent --- etc/hotplug/firmware.agent 19 Jan 2005 17:42:45 -0000 1.5 +++ etc/hotplug/firmware.agent 19 Mar 2005 21:36:41 -0000 @@ -20,7 +20,8 @@ # DEBUG=yes export DEBUG # directory of the firmware files -FIRMWARE_DIR=/lib/firmware +FIRMWARE_DIRS="/opt/lib/firmware /usr/local/lib/firmware /usr/lib/firmware \ + /lib/firmware" # mountpoint of sysfs SYSFS=$(sed -n 's/^.* \([^ ]*\) sysfs .*$/\1/p' /proc/mounts) @@ -40,13 +41,16 @@ sleep 1 fi - if [ -f "$FIRMWARE_DIR/$FIRMWARE" ]; then + done=-1 + for i in $FIRMWARE_DIRS; do + if [ -f "$i/$FIRMWARE" ]; then echo 1 > $SYSFS/$DEVPATH/loading - cp "$FIRMWARE_DIR/$FIRMWARE" $SYSFS/$DEVPATH/data - echo 0 > $SYSFS/$DEVPATH/loading - else - echo -1 > $SYSFS/$DEVPATH/loading + cp "$i/$FIRMWARE" $SYSFS/$DEVPATH/data + done=0 + break fi + done + echo $done > $SYSFS/$DEVPATH/loading ;; --=-=-=-- ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net Linux-hotplug-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel