Added udev rules file.
[fw/stlink] / 10-stlink.rules
diff --git a/10-stlink.rules b/10-stlink.rules
new file mode 100644 (file)
index 0000000..a47b2f9
--- /dev/null
@@ -0,0 +1,43 @@
+# This file was taken from arm-utilites project, located at
+# http://code.google.com/p/arm-utilities/, which is licensed under GPL3.
+# An explicit permission to include any code from that project in
+# this one under BSD license was granted by arm-utilites author, Donald Becker.
+
+# This file watches for a STMicro ST-Link or STM32VLDiscovery board
+# and creates a device named /dev/stlink
+# See udev(7) for syntax.
+#
+# Written 2010,2011 by Donald Becker
+#
+# The STLink on the Discovery has a USB ID 0483:3744 and presents itself
+# as a mass storage (i.e. SCSI) device.  The SCSI emulation is signficantly
+# broken, and the kernel spews error reports for a while until it is
+# accepted.  Further problems are encountered when if it is automatically
+# mounted.
+#
+# Options that may prevent the mount are
+# ENV{UDISKS_PRESENTATION_HIDE}:="1",
+# ENV{UDISKS_PRESENTATION_NOPOLICY}:="1",
+# ENV{DM_UDEV_DISABLE_DISK_RULES_FLAG}:="1"
+
+ACTION!="add|change", GOTO="stlink_rules_end"
+
+SUBSYSTEMS=="usb", ATTR{idVendor}=="0483", ATTR{idProduct}=="3744", \
+   MODE="0664", GROUP="tape", NAME="stlinkusb%n", ENV{STLINK}="1", \
+   ENV{UDISKS_PRESENTATION_HIDE}:="1", \
+   ENV{UDISKS_PRESENTATION_NOPOLICY}:="1", \
+   ENV{DM_UDEV_DISABLE_DISK_RULES_FLAG}:="1", \
+   OPTIONS="last_rule"
+
+# Other possible settings:
+# OPTIONS="last_rule", ATTRS{vendor}=="STM32"
+
+KERNEL=="sg[0-9]*", STLINK=="1", MODE="0664", GROUP:="tape", \
+  NAME+="stlink-sg%n", SYMLINK+="stlink", \
+  ENV{UDISKS_PRESENTATION_HIDE}:="1", \
+  ENV{UDISKS_PRESENTATION_NOPOLICY}:="1", \
+  ENV{DM_UDEV_DISABLE_DISK_RULES_FLAG}:="1"
+
+SUBSYSTEM=="scsi", ATTR{vendor}=="STM32", MODE="0664", GROUP="tape", NAME="stlinksg-scsi%n", SYMLINK+="stlinkscsi", OPTIONS="last_rule"
+
+LABEL="stlink_rules_end"