public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Getting request_firmware() filename info from user space
@ 2011-06-21  1:20 Peter Hsiang
  2011-06-21  7:55 ` Clemens Ladisch
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Hsiang @ 2011-06-21  1:20 UTC (permalink / raw)
  To: Manuel Estrada Sainz, linux-kernel@vger.kernel.org

Hi,

Using the kernel request_firmware() function, it seems one can send any file by:
    cat myfile.bin > /sys/class/firmware/xxxx/data

How does the user space code obtain the filename parameter specified in the request_firmware() call?

The documentation says $DEVPATH and $FIRMWARE variables are provided in 
the environment, but "echo $FIRMWARE" prints an empty string.

I loaded the driver with an & just so I can get the shell prompt back to start the sysfs script.
How would one load the driver and run the sysfs script to send the file from the same shell?

Thanks,

Peter


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

* Re: Getting request_firmware() filename info from user space
  2011-06-21  1:20 Getting request_firmware() filename info from user space Peter Hsiang
@ 2011-06-21  7:55 ` Clemens Ladisch
  0 siblings, 0 replies; 2+ messages in thread
From: Clemens Ladisch @ 2011-06-21  7:55 UTC (permalink / raw)
  To: Peter Hsiang; +Cc: Manuel Estrada Sainz, linux-kernel@vger.kernel.org

Peter Hsiang wrote:
> Using the kernel request_firmware() function, it seems one can send any file by:
>     cat myfile.bin > /sys/class/firmware/xxxx/data
> 
> How does the user space code obtain the filename parameter specified in the request_firmware() call?
> 
> The documentation says $DEVPATH and $FIRMWARE variables are provided in
> the environment, but "echo $FIRMWARE" prints an empty string.

drivers/base/firmware_class.c has:

static int firmware_uevent(struct device *dev, struct kobj_uevent_env *env)
{
	struct firmware_priv *fw_priv = to_firmware_priv(dev);

	if (add_uevent_var(env, "FIRMWARE=%s", fw_priv->fw_id))
		return -ENOMEM;
	if (add_uevent_var(env, "TIMEOUT=%i", loading_timeout))
		return -ENOMEM;
	if (add_uevent_var(env, "ASYNC=%d", fw_priv->nowait))
		return -ENOMEM;

	return 0;
}

Are these available at least in the udev rule?


Regards,
Clemens

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

end of thread, other threads:[~2011-06-21  7:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-21  1:20 Getting request_firmware() filename info from user space Peter Hsiang
2011-06-21  7:55 ` Clemens Ladisch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox