Skip to contentSkip to conversation

Let persistent-cd rules use by-id for usb/firewire

PATCH In review Matthias Schwarzott 3 participants 7 messages Mar 21, 2007 – Mar 22, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Let persistent-cd rules use by-id for usb/firewire

Hi!

I suggest to let extras/rule_generator/75-cd-aliases-generator.rules use by-id for usb/firewire devices.

Attached patch contains a (at least for me) working solution.

Matthias

Signature · 1 line
Matthias Schwarzott (zzam)
extras/rule_generator/75-cd-aliases-generator.rules +2 -1
index c3eb887..df44d31 100644
@@ -1,3 +1,4 @@
 # these rules generate rules for the /dev/{cdrom,dvd,...} symlinks
 
-ACTION=="add", SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{GENERATED}!="?*", PROGRAM="write_cd_rules", SYMLINK+="%c"
+ACTION=="add", SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", SUBSYSTEMS=="usb|ieee1394", ENV{ID_CDROM_PERSISTENCE_METHOD}="by-id"
+ACTION=="add", SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{GENERATED}!="?*", PROGRAM="write_cd_rules $env{ID_CDROM_PERSISTENCE_METHOD}", SYMLINK+="%c"

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#1 lore raw
Quoted 4 lines · Matthias Schwarzott

I suggest to let extras/rule_generator/75-cd-aliases-generator.rules use by-id for usb/firewire devices.

Attached patch contains a (at least for me) working solution.

At the time the script runs, you already have ID_BUS={ata,scsi,usb,ieee1394} in the environment. Shouldn't we put the logic, which default id-type to use in the script?

Kay

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#2 lore raw
In reply to Matthias Schwarzott
Quoted 3 lines · Kay Sievers

At the time the script runs, you already have ID_BUS={ata,scsi,usb,ieee1394} in the environment. Shouldn't we put the logic, which default id-type to use in the script?

Why? I used a similar approach in the Debian package and it has the important advantages of being easier to understand and user-configurable.

Signature · 12 lines
ciao,
Marco

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
#3 lore raw
In reply to Matthias Schwarzott
Quoted 10 lines · Kay Sievers
Quoted 4 lines · Matthias Schwarzott

I suggest to let extras/rule_generator/75-cd-aliases-generator.rules use by-id for usb/firewire devices.

Attached patch contains a (at least for me) working solution.

At the time the script runs, you already have ID_BUS={ata,scsi,usb,ieee1394} in the environment. Shouldn't we put the logic, which default id-type to use in the script?

Sounds like a good idea :)

Matthias

Signature · 11 lines
Matthias Schwarzott (zzam)

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
#4 lore raw
In reply to Matthias Schwarzott
Quoted 8 lines · Marco d'Itri
Quoted 3 lines · Kay Sievers

At the time the script runs, you already have ID_BUS={ata,scsi,usb,ieee1394} in the environment. Shouldn't we put the logic, which default id-type to use in the script?

Why? I used a similar approach in the Debian package and it has the important advantages of being easier to understand and user-configurable.

Sure, you can still pass the type down if you need. It's just that the script could have a matching default itself.

Kay

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#5 lore raw
In reply to Matthias Schwarzott
Quoted 5 lines · Matthias Schwarzott
Quoted 4 lines · Kay Sievers
Quoted 3 lines · Matthias Schwarzott

I suggest to let extras/rule_generator/75-cd-aliases-generator.rules use by-id for usb/firewire devices.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Attached patch contains a (at least for me) working solution.

At the time the script runs, you already have ID_BUS={ata,scsi,usb,ieee1394} in the environment. Shouldn't we put the logic, which default id-type to use in the script?

Sounds like a good idea :)

Try this as a sample implementation.

Matthias

Signature · 1 line
Matthias Schwarzott (zzam)
extras/rule_generator/write_cd_rules +9 -1
index 1dbe6b7..bd951c5 100644
@@ -53,7 +53,15 @@ fi
 if [ "$1" ]; then
 	METHOD="$1"
 else
-	METHOD='by-path'
+	case "$ID_BUS" in
+		usb|ieee1394)
+		METHOD='by-id'
+		;;
+
+		*)
+		METHOD='by-path'
+		;;
+	esac
 fi
 
 case "$METHOD" in

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#6 lore raw
In reply to Matthias Schwarzott
Quoted 8 lines · Matthias Schwarzott
Quoted 7 lines · Matthias Schwarzott
Quoted 6 lines · Kay Sievers
Quoted 4 lines · Matthias Schwarzott

I suggest to let extras/rule_generator/75-cd-aliases-generator.rules use by-id for usb/firewire devices.

Attached patch contains a (at least for me) working solution.

Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

At the time the script runs, you already have ID_BUS={ata,scsi,usb,ieee1394} in the environment. Shouldn't we put the logic, which default id-type to use in the script?

Sounds like a good idea :)

Try this as a sample implementation.

Looks like a good default. I've applied that.

Thanks,
Kay
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel