From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olivier Blin Date: Mon, 12 Dec 2005 21:45:07 +0000 Subject: Re: [PATCH] The Mandriva Collection Message-Id: List-Id: References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: linux-hotplug@vger.kernel.org md@Linux.IT (Marco d'Itri) writes: > On Dec 12, Olivier Blin 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=3D"add", SUBSYSTEM=3D"usb", \ SYSFS{idProduct}=3D"xxxA", SYSFS{idVendor}=3D"yyyA", \ RUN+=3D"/sbin/fxload -t fx2 -I /lib/firmware/ezusb/foo.hex" ACTION=3D"add", SUBSYSTEM=3D"usb", \ SYSFS{idProduct}=3D"xxxB", SYSFS{idVendor}=3D"yyyB", \ RUN+=3D"/sbin/fxload -t fx2 -I /lib/firmware/ezusb/foo.hex" ACTION=3D"add", SUBSYSTEM=3D"usb", \ SYSFS{idProduct}=3D"xxxC", SYSFS{idVendor}=3D"yyyC", \ RUN+=3D"/sbin/fxload -t fx2 -I /lib/firmware/ezusb/bar.hex" ACTION=3D"add", SUBSYSTEM=3D"usb", \ SYSFS{idProduct}=3D"xxxD", SYSFS{idVendor}=3D"yyyD", \ RUN+=3D"/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=3D"add", SUBSYSTEM=3D"usb", \ ENV{PRODUCT}=3D"xxxA/yyyA/*|xxxB/yyyB/*", \ RUN+=3D"/sbin/fxload -t fx2 -I /lib/firmware/ezusb/foo.hex" ACTION=3D"add", SUBSYSTEM=3D"usb", \ ENV{PRODUCT}=3D"xxxC/yyyC/*|xxxD/yyyD/*" \ RUN+=3D"/sbin/fxload -t fx2 -I /lib/firmware/ezusb/bar.hex" More generally, is there some construction to factorize this? condA, condB, cond1, cond2, RUN+=3D"fxload foo" condA, condB, cond3, cond4, RUN+=3D"fxload foo" condA, condB, cond5, cond6, RUN+=3D"fxload bar" condA, condB, cond7, cond8, RUN+=3D"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}=3Dfoo, GOTO=3D"fxload_do" cond3, cond4, ENV{FXLOAD_FILE}=3Dfoo, GOTO=3D"fxload_do" cond5, cond6, ENV{FXLOAD_FILE}=BAr, GOTO=3D"fxload_do" cond7, cond8, ENV{FXLOAD_FILE}=BAr, GOTO=3D"fxload_do" ENV{FXLOAD_FILE}!=3D"?*", GOTO=3D"fxload_end" LABEL=3D"fxload_do", RUN+=3D"fxload $FXLOAD_FILE" LABEL=3D"fxload_end" --=20 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=16865&op=3Dclick _______________________________________________ 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