]> git.zerfleddert.de Git - usb-driver/commitdiff
Add setup script for USB cable which works on modern distributions
authorMichael Gernoth <michael@gernoth.net>
Sun, 8 May 2011 18:20:19 +0000 (20:20 +0200)
committerMichael Gernoth <michael@gernoth.net>
Sun, 8 May 2011 18:20:19 +0000 (20:20 +0200)
This completely rewritten version of setup_pcusb works on modern
distributions with newer udev versions which have a different
rules-format and are not detected by the xilinx-version of the
script. It only has the name in common with the xilinx-version.

README
setup_pcusb [new file with mode: 0755]

diff --git a/README b/README
index 6bf1097ed36cadc36b4c96c9d2b8b87feb420e49..802ca7809d8c5a7c9d65dec1d177efc77ebd71a9 100644 (file)
--- a/README
+++ b/README
@@ -66,6 +66,15 @@ the initial firmware has not been loaded (loading it changes the
 product-ID from another value to 8). To load the firmware follow
 these steps:
 
 product-ID from another value to 8). To load the firmware follow
 these steps:
 
+1. Run ./setup_pcusb in this directory, this should set up everything
+   correctly:
+   - When $XILINX is set correctly:
+     $ ./setup_pcusb
+   - When $XILINX is not set, and ISE is installed in /opt/Xilinx/13.1:
+     $ ./setup_pcusb /opt/Xilinx/13.1/ISE_DS/ISE
+
+Old instructions, use only when the above script did not work:
+
 1. If you have no /etc/udev/rules.d/xusbdfwu.rules file, copy it from
    /path/to/ISE/bin/lin/xusbdfwu.rules to /etc/udev/rules.d/xusbdfwu.rules
 
 1. If you have no /etc/udev/rules.d/xusbdfwu.rules file, copy it from
    /path/to/ISE/bin/lin/xusbdfwu.rules to /etc/udev/rules.d/xusbdfwu.rules
 
diff --git a/setup_pcusb b/setup_pcusb
new file mode 100755 (executable)
index 0000000..dfa72f7
--- /dev/null
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+if [ "${XILINX}" = "" ]; then
+       if [ "${1}" = "" ]; then
+               echo "Syntax: ${0} /path/to/ISE"
+               exit 1
+       fi
+       root="${1}"
+else
+       root="${XILINX}"
+fi
+
+if [ "`id -u`" != "0" ]; then
+       echo "You are not root, trying sudo..."
+       ASROOT="sudo"
+else
+       ASROOT=""
+fi
+
+echo -n "Looking for USB cable files: "
+
+dir=""
+
+for check in "${root}/bin/lin64" "${root}/bin/lin"; do
+       if [ -e "${check}/xusbdfwu.rules" ]; then
+               dir="${check}"
+               break;
+       fi
+done
+
+if [ "${dir}" != "" ]; then
+       echo "${dir}"
+else
+       echo "NOT FOUND!"
+       exit 1
+fi
+
+echo "Copying formware to /usr/share:"
+for fw in "${dir}/"xusb*.hex; do
+       $ASROOT cp -v "${fw}" "/usr/share/"
+done
+
+echo "Installing udev rules:"
+$ASROOT bash -c "sed -e 's/TEMPNODE/tempnode/' -e 's/SYSFS/ATTRS/g' -e 's/BUS/SUBSYSTEMS/' \"${dir}/xusbdfwu.rules\" >/etc/udev/rules.d/xusbdfwu.rules"
+echo "done"
Impressum, Datenschutz