linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* absolute firmware paths
@ 2008-07-01  4:04 Sebastian Kuzminsky
  2008-07-01  5:20 ` Marcel Holtmann
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Sebastian Kuzminsky @ 2008-07-01  4:04 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 1380 bytes --]

Hi folks, I'm looking into using request_firmware()/udev to get firmware
into a couple of device drivers i'm writing, but I want to be able
to provide absolute paths for the firmware file and have firmware.sh
honor it.

The drivers are for a family of FPGA-based cards, mostly PCI.  We're
using the cards for motion control of machine tools and other robots,
see <http://www.linuxcnc.org>.

Anyway, the drivers and the firmware are distributed together.  A common
use case for many of our developers and some of our users is to check
out the source code, maybe hack on it some, build it, and run it out of
the sandbox (without installing).  The problem is that udev can't find
the firmwares in peoples home directories.

My proposal is to have the driver accept a modparam giving the absolute
path to the firmware file the user wants, and have the firmware.sh
helper read it from there, bypassing the normal firmware search path.

In the other use case, when the software is installed properly, the
modparam can be skipped and the driver will request default firmware
using relative paths (and udev will find the firmware in /lib/firmware).

I've attached a patch against udev.git showing what I mean.

Comments?


-- 
Sebastian Kuzminsky
"The brain is [a machine]. The fact that it's made out of meat is a
red herring."  -- David Adler <http://www.spectrum.ieee.org/print/6268>


[-- Attachment #2: udev-absolute-firmware-paths.patch --]
[-- Type: text/x-diff, Size: 791 bytes --]

diff --git a/extras/firmware/firmware.sh b/extras/firmware/firmware.sh
index b89b428..3d9cc61 100755
--- a/extras/firmware/firmware.sh
+++ b/extras/firmware/firmware.sh
@@ -9,0 +10,9 @@ err() {
+try_firmware() {
+	FILE=$1
+	[ -e "$FILE" ] || return 0
+	echo 1 > /sys$DEVPATH/loading
+	cat "$FILE" > /sys$DEVPATH/data
+	echo 0 > /sys$DEVPATH/loading
+	exit 0
+}
+
@@ -15,7 +24,9 @@ fi
-for DIR in $FIRMWARE_DIRS; do
-	[ -e "$DIR/$FIRMWARE" ] || continue
-	echo 1 > /sys$DEVPATH/loading
-	cat "$DIR/$FIRMWARE" > /sys$DEVPATH/data
-	echo 0 > /sys$DEVPATH/loading
-	exit 0
-done
+if [ $(echo $FIRMWARE | cut -b 1) = "/" ]; then
+	# absolute path
+	try_firmware $FIRMWARE
+else
+	# relative path, search the FIRMWARE_DIRS
+	for DIR in $FIRMWARE_DIRS; do
+		try_firmware $DIR/$FIRMWARE
+	done
+fi

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-07-05 18:42 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-01  4:04 absolute firmware paths Sebastian Kuzminsky
2008-07-01  5:20 ` Marcel Holtmann
2008-07-04  3:04 ` Sebastian Kuzminsky
2008-07-04  4:50 ` Marcel Holtmann
2008-07-04  6:20 ` Sebastian Kuzminsky
2008-07-04  8:30 ` Marcel Holtmann
2008-07-05 16:13 ` Sebastian Kuzminsky
2008-07-05 17:24 ` Marcel Holtmann
2008-07-05 18:42 ` Sebastian Kuzminsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).