Skip to contentSkip to conversation

Multiple firmware paths

PATCH Philippe Troin 3 participants 3 messages Mar 19, 2005

lore
Share & tools
lore
#0 lore raw

[I'm not subscribed to [email protected], 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.

etc/hotplug/firmware.agent +12 -8
diff -ruN hotplug-2004_03_29.orig/etc/hotplug/firmware.agent hotplug-2004_03_29/etc/hotplug/firmware.agent
@@ -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
 
     ;;
 

Index: etc/hotplug/firmware.agent
===================================================================
RCS file: /cvsroot/linux-hotplug/admin/etc/hotplug/firmware.agent,v retrieving revision 1.5

hotplug/firmware.agent +10 -6
diff -b -u -r1.5 firmware.agent
@@ -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
 
     ;;
 
#1 lore raw

etc/hotplug/firmware.agent line 24

Quoted 4 lines · Philippe Troin
 # directory of the firmware files
etc/hotplug/firmware.agent +2 -1
-FIRMWARE_DIR=/usr/lib/hotplug/firmware
+FIRMWARE_DIRS="/opt/lib/hotplug/firmware /usr/local/lib/hotplug/firmware \
+               /usr/lib/hotplug/firmware /lib/hotplug/firmware"

As I already explained to the user, I see no reason to add /opt to the list of directories.

Signature · 13 lines
ciao,
Marco


-------------------------------------------------------
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_ide95&alloc_id396&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
#2 lore raw
In reply to Philippe Troin

Hi Phil,

Quoted 5 lines

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.

there is no need for that. The distributions use such a patch to keep the transition to /lib/firmware/ easier for the user, but we decided to go with one directory only. Check the Hotplug mailing archive for the postings about this topic.

Regards

Marcel

-------------------------------------------------------
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_ide95&alloc_id396&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel