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

Re: [PATCH 03/04] Load keyspan firmware with hotplug



Hi,

here's a late reply to this excellent input.

I've successfully used your dumpfw.c to extract the proprietary firmware
blobs.  Without modifying the driver, i.e. using a standard Debian kernel,
I then used the fxload tool to load my corresponding firmware.

Next I wrote myself a hotplug script to do the job for me, it's
attached.  To
reuse it, save the file keyspan (same script name as the driver) as
/etc/hotplug/usb/keyspan.  Change the hardcoded firmware name to the
one you want to use.  Remember first to extract the FW from the Linux
source package with the dumpfw.c tool.

Regards
 /Jocke


#!/bin/bash
#
# Extremely simple keyspan firmware loader script.
# 
# Copyright (C) 2006 Joachim Nilsson <troglobit@gmail.com>
#
# This silly script is released under the BSD license, w/o the advertising
# clause, or the GNU General Public License, at your option.  
#
# Nota Bene: Hardcoded to use keyspan-usa49w.fw!
#
# Arguments :
# -----------
# ACTION=[add|remove]
# DEVICE=/proc/bus/usb/BBB/DDD
# TYPE=usb

# latest hotplug doesn't set DEVICE on 2.6.x kernels
if [ -z "$DEVICE" ] ; then
  IF=`echo $DEVPATH | sed 's/\(bus\/usb\/devices\/\)\(.*\)-\(.*\)/\2/'`
  DEV=$(cat /sys/${DEVPATH}/devnum)
  DEVICE=`printf '/proc/bus/usb/%.03d/%.03d' $IF $DEV`
fi

if [ "$ACTION" = "add" -a "$TYPE" = "usb" ]; then
	let NOW=`date +"%s"`
	let MODIFIED=`stat -c "%Y" /tmp/keyspan-fw.log`
	let JITTER=$(($MODIFIED + 10))
	/usr/bin/logger "NOW=$NOW MODIFIED=$MODIFIED JITTER=$JITTER"
	if [ $JITTER -lt $NOW ]; then
		/usr/bin/logger "Loading keyspan firmware: DEVICE=$DEVICE "
		/sbin/fxload -t fx -I usb/keyspan-usa49w.fw
		if [ "$?" != "0" ]; then
			/usr/bin/logger "Keyspan firmware load failed."
		else
			/usr/bin/logger "Keyspan firmware loaded OK."
		fi
		touch /tmp/keyspan-fw.log
	else
		/usr/bin/logger "Not reloading keyspan firmware, reenumeration event."
	fi
fi


Reply to: