gnu-linux-libre
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [GNU-linux-libre] The "Free" Kernel In Debian Squeeze


From: Alexandre Oliva
Subject: Re: [GNU-linux-libre] The "Free" Kernel In Debian Squeeze
Date: Mon, 17 Jan 2011 10:55:27 -0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

On Jan 14, 2011, Richard Stallman <address@hidden> wrote:

>     No, it wouldn't be impossible.  A suitable userland hotplug script would
>     be perfectly capable of looking for a local file that satisfies the
>     request.

> It seems impossible to me.  Could you explain how it could do this?

Uhh...  I thought I'd already explained, but here it goes...

Nowadays, a minimal hotplug script looks like this:

# Both $DEVPATH and $FIRMWARE are already provided in the environment.
HOTPLUG_FW_DIR=/lib/firmware/
if test -f $HOTPLUG_FW_DIR/$FIRMWARE; then
  echo 1 > /sys/$DEVPATH/loading # firmware found
  cat $HOTPLUG_FW_DIR/$FIRMWARE > /sys/$DEVPATH/data # upload it
  echo 0 > /sys/$DEVPATH/loading # upload complete
else
  echo -1 > /sys/$DEVPATH/loading # firmware not found
fi


If the kernel passes userland, in addition to DEVPATH and FIRMWARE, a
HASHPREFIX, the hotplug script would run:

case $FIRMWARE in md5/*)
  hash=`echo $FIRMWARE | sed 's,^md5/,,'`
  for f in `cd $HOTPLUG_FW_DIR && find . ! -type d -print | sed 's,\./,,'`; do
    case `echo -n $HASHPREFIX$f | md5sum` in
    "$hash"[    ]*)
      echo 1 > /sys/$DEVPATH/loading
      cat $HOTPLUG_FW_DIR/$f > /sys/$DEVPATH/data
      echo 0 > /sys/$DEVPATH/loading
      exit 0
      ;;
    esac
  done
;;
esac

-- 
Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist      Red Hat Brazil Compiler Engineer



reply via email to

[Prev in Thread] Current Thread [Next in Thread]