* [PATCH] udev: persistent FireWire device names
@ 2012-07-04 17:08 Clemens Ladisch
2012-07-04 17:22 ` Kay Sievers
2012-07-04 19:48 ` Clemens Ladisch
0 siblings, 2 replies; 3+ messages in thread
From: Clemens Ladisch @ 2012-07-04 17:08 UTC (permalink / raw)
To: linux-hotplug
---
Makefile.am | 1 +
rules/60-persistent-firewire.rules | 26 ++++++++++++++++++++++++++
2 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 3b7ec0b..415fae6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1510,6 +1510,7 @@ dist_udevrules_DATA += \
rules/60-persistent-input.rules \
rules/60-persistent-alsa.rules \
rules/60-persistent-storage.rules \
+ rules/60-persistent-firewire.rules \
rules/75-net-description.rules \
rules/75-tty-description.rules \
rules/78-sound-card.rules \
diff --git a/rules/60-persistent-firewire.rules b/rules/60-persistent-firewire.rules
new file mode 100644
index 0000000..2eb8cfe
--- /dev/null
+++ b/rules/60-persistent-firewire.rules
@@ -0,0 +1,26 @@
+# do not edit this file, it will be overwritten on update
+
+ACTION="remove", GOTO="persistent_firewire_end"
+SUBSYSTEM!="firewire", GOTO="persistent_firewire_end"
+
+ATTR{is_local}="1", OPTIONS="link_priority=1"
+
+TEST="guid", SYMLINK+="firewire/by-id/guid-$attr{guid}"
+
+# Most devices have the model name in the root directory.
+TEST="vendor_name", TEST="model_name", \
+ OPTIONS="string_escape=replace", \
+ SYMLINK+="firewire/by-name/$attr{vendor_name} $attr{model_name}"
+# Some devices have the model name only in the first unit directory, so we have
+# to get the name from the corresponding subdevice. (The detour through cat is
+# necessary because $attr does not allow substitutions in its file name.)
+TEST="vendor_name", TEST!="model_name", TEST="$kernel.0/model_name", \
+ PROGRAM="/bin/cat $sys$devpath/$kernel.0/model_name", \
+ OPTIONS="string_escape=replace", \
+ SYMLINK+="firewire/by-name/$attr{vendor_name} $result"
+# To make the preceding rule work when the subdevice is added after the parent
+# device, force a 'change' event to rerun that rule in this case.
+ACTION="add", DEVPATH="*/fw[0-9]*/fw[0-9]*.0", TEST="model_name", TEST!="../model_name", \
+ ATTR{../uevent}="change"
+
+LABEL="persistent_firewire_end"
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] udev: persistent FireWire device names
2012-07-04 17:08 [PATCH] udev: persistent FireWire device names Clemens Ladisch
@ 2012-07-04 17:22 ` Kay Sievers
2012-07-04 19:48 ` Clemens Ladisch
1 sibling, 0 replies; 3+ messages in thread
From: Kay Sievers @ 2012-07-04 17:22 UTC (permalink / raw)
To: linux-hotplug
On Wed, Jul 4, 2012 at 7:08 PM, Clemens Ladisch <clemens@ladisch.de> wrote:
> ---
> Makefile.am | 1 +
> rules/60-persistent-firewire.rules | 26 ++++++++++++++++++++++++++
> 2 files changed, 27 insertions(+), 0 deletions(-)
What is this useful for? Firewire is by definiton a hotplug bus, and
application dealing with raw firewire nodes, need to manage that
anyway. It's very much like USB, we don't do anything like that for
USB either, because we require the apps to cope with the nature of the
bus, and don't want them to expect predictable device nodes for the
raw access.
There is no legacy to support for firewire, like we need to do for
most other of the persistent stuff. So, what kind of problem would
that solve, that isn't better solved at the application level?
Kay
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] udev: persistent FireWire device names
2012-07-04 17:08 [PATCH] udev: persistent FireWire device names Clemens Ladisch
2012-07-04 17:22 ` Kay Sievers
@ 2012-07-04 19:48 ` Clemens Ladisch
1 sibling, 0 replies; 3+ messages in thread
From: Clemens Ladisch @ 2012-07-04 19:48 UTC (permalink / raw)
To: linux-hotplug
Kay Sievers wrote:
> On Wed, Jul 4, 2012 at 7:08 PM, Clemens Ladisch <clemens@ladisch.de> wrote:
>> Makefile.am | 1 +
>> rules/60-persistent-firewire.rules | 26 ++++++++++++++++++++++++++
>> 2 files changed, 27 insertions(+), 0 deletions(-)
>
> What is this useful for? Firewire is by definiton a hotplug bus, and
> application dealing with raw firewire nodes, need to manage that
> anyway.
Most normal applications indeed do this.
> what kind of problem would that solve, that isn't better solved at
> the application level?
There are several testing and debugging tools where devices are
selected not by their capabilities but by their identity.
It would certainly be possible to add code to lookup devices by
their GUID or name, but having udev create a bunch of symlinks
is much simpler.
Regards,
Clemens
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-07-04 19:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-04 17:08 [PATCH] udev: persistent FireWire device names Clemens Ladisch
2012-07-04 17:22 ` Kay Sievers
2012-07-04 19:48 ` Clemens Ladisch
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).