From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1763144AbXGFTQx (ORCPT ); Fri, 6 Jul 2007 15:16:53 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757739AbXGFTQo (ORCPT ); Fri, 6 Jul 2007 15:16:44 -0400 Received: from neon.samage.net ([85.17.153.66]:58171 "EHLO neon.samage.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757983AbXGFTQn (ORCPT ); Fri, 6 Jul 2007 15:16:43 -0400 Message-ID: <58019.81.207.0.53.1183749400.squirrel@secure.samage.net> In-Reply-To: <200707061620.44348.duncan.sands@math.u-psud.fr> References: <200707061620.44348.duncan.sands@math.u-psud.fr> Date: Fri, 6 Jul 2007 21:16:40 +0200 (CEST) Subject: Re: understanding firmware loader for speedtouch (kernel 2.6.21.5) From: "Indan Zupancic" To: "Duncan Sands" Cc: "mikie" , linux-kernel@vger.kernel.org User-Agent: SquirrelMail/1.4.8 MIME-Version: 1.0 Content-Type: text/plain;charset=UTF-8 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal X-Spam-Score: -1.8 X-Scan-Signature: cf96151651da5a5ace2e908a4273e1b9 Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On Fri, July 6, 2007 16:20, Duncan Sands wrote: > On Friday 6 July 2007 14:54:18 mikie wrote: >> Hi, >> >> I experience some problems with the speedtch.c module, especially in >> regards to its firmware loader. >> I am not quite sure if this module is going to load the firmware >> itself or does it use some external software to do that ? > > It loads it itself, using some external software! For information, it generates a hotplug event and the kernel calls the program written at /proc/sys/kernel/hotplug with certain information. That used to be /sbin/hotplug, became later udev, but today in general udev reads the uevents generated by the kernel. >> I have read and checked the firmware.agent script from some hotplug >> package, and noticed that it makes something like simple file copy of >> the firmware to the "data" and echoing 1 or 0 to the "loading" file. >> But what is the location of these data/loading ? Also the firmware is >> split into 2 parts -- should I upload them one after another? Is that >> all that should be done to get the firmware loaded? > > You need to write the file that was asked for: the modem starts by asking > for the first file, uploads it, then asks for the second file and uploads it. > The file is written to the "data" file, but note that the data file is created > on the fly when the modem requests a firmware load so you can't write to it > at some random time. If you really don't want to use udevd, you could use the below script I wrote (not really tested, it's an bash version of the Udev rules I've have, more or less.) Echo the script pathname to /proc/sys/kernel/hotplug early at bootup and all should work, assuming your pppd is setup correctly and the script isn't buggy. #!/bin/sh set -e p() { # For debugging/logging, edit for your needs. echo "$*" echo "$*" > /dev/vc/1; echo "$*" >> /tmp/bla; } if [ "$SUBSYSTEM" = "firmware" ]; then p "Loading firmware..." cd /sys/$DEVPATH if [ -f "/lib/firmware/$FIRMWARE" ]; then echo 1 > loading cat "/lib/firmware/$FIRMWARE" > data echo 0 > loading p "Done." else echo -1 > loading p "$FIRMWARE not found." fi elif [ "$SUBSYSTEM" = "atm" ]; then if [[ "$KERNEL" != speedtch* ]]; then exit fi if [ "$ACTION" = "add" ]; then p "Starting pppd." pppd call adsl elif [ "$ACTION" = "remove" ]; then p "Stopping pppd." pkill pppd fi fi Greetings, Indan