linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: Manuel Estrada Sainz <ranty@debian.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Firmware loading problem
Date: 22 Jul 2003 17:38:15 +0200	[thread overview]
Message-ID: <1058888301.2755.8.camel@pegasus> (raw)
In-Reply-To: <20030722145546.GC23593@ranty.pantax.net>

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

Hi Manuel,

> > I installed linux-2.6.0-test1-ac2 and tried to port my driver for the
> > BlueFRITZ! USB Bluetooth dongle to 2.6. This device needs a firmware
> > download and I want to use the new firmware class for getting the
> > firmware file from userspace. After reading the documentation and
> > testing the driver samples I got the results that I expected.
> > 
> > My problem is now that the firmware loader is not working with my
> > firmware file and it seems that this is a problem of the file size,
> > because copying small files through the same interface is working fine.
> > This is the file I want to load:
> > 
> > -rw-r--r--  1 holtmann staff  418352 Jul 11 12:38 bfubase.frm
> > 
> > I have written my own firmware.agent hotplug script, which looks in
> > general something like this:
> > 
> > 	echo 1 > $LOADING
> > 	cp bfubase.frm $DATA
> > 	echo 0 > $LOADING
> > 
> > Loading the above firmware file through this interface results in
> > different behaviours. The results are complete freezes, instant reboots,
> > X server crashes with black screens and sometimes I see an oops about
> > virtual memory, but it goes bye bye too fast to let me do anything
> > useful with it.
> 
>  Could you send me a tarball with a sample showing the problem. If
>  possible I would like to do "make test" and have it compile and crash
>  the system appropriately :)

I tracked down the problem to request_firmware() or a sysfs problem.
With the firmware included in a header file the driver itself works
perfect.

Attached is a sample of how I use the request_firmware() and from the
documentation it seems correct to me.

Regards

Marcel


[-- Attachment #2: fwldtest.c --]
[-- Type: text/x-c, Size: 2330 bytes --]

/*
 *
 *  Firmware loader test driver
 *
 *  Copyright (C) 2003  Marcel Holtmann <marcel@holtmann.org>
 *
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */

#include <linux/config.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>

#include <linux/device.h>
#include <linux/firmware.h>

#include <linux/usb.h>


static struct usb_device_id fwldtest_table[] = {
	{ USB_DEVICE(0x057c, 0x2200) },

	{ }	/* Terminating entry */
};

MODULE_DEVICE_TABLE(usb, fwldtest_table);


static int fwldtest_probe(struct usb_interface *iface, const struct usb_device_id *id)
{
	const struct firmware *firmware;
	struct usb_device *udev = interface_to_usbdev(iface);

	if (request_firmware(&firmware, "firmware.bin", &udev->dev) < 0) {
		printk(KERN_ERR "Firmware request failed\n");
		goto error;
	}

	printk(KERN_INFO "firmware data %p size %d\n", firmware->data, firmware->size);

error:
	release_firmware(firmware);

	return -EIO;
}

static void fwldtest_disconnect(struct usb_interface *iface)
{
}

static struct usb_driver fwldtest_driver = {
	.owner		= THIS_MODULE,
	.name		= "fwldtest",
	.probe		= fwldtest_probe,
	.disconnect	= fwldtest_disconnect,
	.id_table	= fwldtest_table,
};

static int __init fwldtest_init(void)
{
	return usb_register(&fwldtest_driver);
}

static void __exit fwldtest_cleanup(void)
{
	usb_deregister(&fwldtest_driver);
}

module_init(fwldtest_init);
module_exit(fwldtest_cleanup);

MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>");
MODULE_DESCRIPTION("Firmware loader test driver");
MODULE_LICENSE("GPL");

  reply	other threads:[~2003-07-22 15:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-22 14:45 Marcel Holtmann
2003-07-22 14:55 ` Manuel Estrada Sainz
2003-07-22 15:38   ` Marcel Holtmann [this message]
2003-07-26  9:04     ` [PATCH] " Manuel Estrada Sainz
2003-07-26 11:14       ` Marcel Holtmann
2003-07-26 11:26         ` Manuel Estrada Sainz
2003-07-27 19:21       ` Matthew Wilcox
2003-07-27 21:21         ` Manuel Estrada Sainz
2003-08-01 15:05           ` Manuel Estrada Sainz
2003-08-01 18:50             ` Manuel Estrada Sainz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1058888301.2755.8.camel@pegasus \
    --to=marcel@holtmann.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ranty@debian.org \
    --subject='Re: Firmware loading problem' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).