From: Olivier Blin <oblin@mandriva.com>
To: linux-hotplug@vger.kernel.org
Subject: Re: [PATCH] The Mandriva Collection
Date: Mon, 12 Dec 2005 21:45:07 +0000 [thread overview]
Message-ID: <m37jaaouqk.fsf@dynamo.mandriva.com> (raw)
In-Reply-To: <m3k6eaqki0.fsf@dynamo.mandriva.com>
md@Linux.IT (Marco d'Itri) writes:
> On Dec 12, Olivier Blin <oblin@mandriva.com> wrote:
>
>> But is there any way currently to request fxload on hotplug event, or
>> should it be triggered when the device is plugged?
>> The later would require an udev rule per device IDs, which is the
>> equivalent of usermaps.
> Yes, but again there is nothing wrong with this. The first VID/PID
> pair will make udev run fxload, then the second one will appear and the
> kernel driver will be loaded.
It requires to compare twice more all IDs for each plugged USB device,
which is avoided when using request_firmware().
And it needs a VID/PID rules list, which may not be easy to write
without duplication. What's the proper construction to replace this
kind of usermaps?
ACTION="add", SUBSYSTEM="usb", \
SYSFS{idProduct}="xxxA", SYSFS{idVendor}="yyyA", \
RUN+="/sbin/fxload -t fx2 -I /lib/firmware/ezusb/foo.hex"
ACTION="add", SUBSYSTEM="usb", \
SYSFS{idProduct}="xxxB", SYSFS{idVendor}="yyyB", \
RUN+="/sbin/fxload -t fx2 -I /lib/firmware/ezusb/foo.hex"
ACTION="add", SUBSYSTEM="usb", \
SYSFS{idProduct}="xxxC", SYSFS{idVendor}="yyyC", \
RUN+="/sbin/fxload -t fx2 -I /lib/firmware/ezusb/bar.hex"
ACTION="add", SUBSYSTEM="usb", \
SYSFS{idProduct}="xxxD", SYSFS{idVendor}="yyyD", \
RUN+="/sbin/fxload -t fx2 -I /lib/firmware/ezusb/bar.hex"
Writing dozens of such rules is very verbose, not readable at all, and
error prone. Is there at least some tool to automate this?
It can probably be simplified using PRODUCT values:
ACTION="add", SUBSYSTEM="usb", \
ENV{PRODUCT}="xxxA/yyyA/*|xxxB/yyyB/*", \
RUN+="/sbin/fxload -t fx2 -I /lib/firmware/ezusb/foo.hex"
ACTION="add", SUBSYSTEM="usb", \
ENV{PRODUCT}="xxxC/yyyC/*|xxxD/yyyD/*" \
RUN+="/sbin/fxload -t fx2 -I /lib/firmware/ezusb/bar.hex"
More generally, is there some construction to factorize this?
condA, condB, cond1, cond2, RUN+="fxload foo"
condA, condB, cond3, cond4, RUN+="fxload foo"
condA, condB, cond5, cond6, RUN+="fxload bar"
condA, condB, cond7, cond8, RUN+="fxload bar"
It duplicates condA and condB tests for all rules, and copy-paste
errors may be hard to spot because of long rules. (this example looks
short, but it gets trickier when condX and RUN values are expanded to
longer expressions).
Can we use environment variables to solve this, or is there something
better?
!condA, GOTO "fxload_end"
!condB, GOTO "fxload_end"
cond1, cond2, ENV{FXLOAD_FILE}=foo, GOTO="fxload_do"
cond3, cond4, ENV{FXLOAD_FILE}=foo, GOTO="fxload_do"
cond5, cond6, ENV{FXLOAD_FILE}ºr, GOTO="fxload_do"
cond7, cond8, ENV{FXLOAD_FILE}ºr, GOTO="fxload_do"
ENV{FXLOAD_FILE}!="?*", GOTO="fxload_end"
LABEL="fxload_do", RUN+="fxload $FXLOAD_FILE"
LABEL="fxload_end"
--
Olivier Blin - Mandriva
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id\x16865&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
next prev parent reply other threads:[~2005-12-12 21:45 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-12 17:43 [PATCH] The Mandriva Collection Olivier Blin
2005-12-12 18:21 ` Marco d'Itri
2005-12-12 18:25 ` Scott James Remnant
2005-12-12 18:37 ` Olivier Blin
2005-12-12 18:47 ` Marco d'Itri
2005-12-12 19:13 ` Olivier Blin
2005-12-12 19:17 ` Marco d'Itri
2005-12-12 19:44 ` Olivier Blin
2005-12-12 21:45 ` Olivier Blin [this message]
2005-12-13 0:49 ` Marco d'Itri
2005-12-13 5:08 ` Kay Sievers
2005-12-21 17:46 ` Olivier Blin
2005-12-21 17:47 ` Marco d'Itri
2005-12-21 17:51 ` Olivier Blin
2005-12-21 18:04 ` Marco d'Itri
2006-01-03 19:55 ` Olivier Blin
2006-01-04 1:20 ` Kay Sievers
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=m37jaaouqk.fsf@dynamo.mandriva.com \
--to=oblin@mandriva.com \
--cc=linux-hotplug@vger.kernel.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).