X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=debian%2Fusrp-firmware.postinst;fp=debian%2Fusrp-firmware.postinst;h=0c02817b105f4e6217e3804d280962688ee0ebf4;hb=56c8ec23cd587a012933d18ae65afa7636864314;hp=0000000000000000000000000000000000000000;hpb=18a684bf3dc144c48fc4cc6cc72f5070febd8074;p=debian%2Fgnuradio diff --git a/debian/usrp-firmware.postinst b/debian/usrp-firmware.postinst new file mode 100644 index 00000000..0c02817b --- /dev/null +++ b/debian/usrp-firmware.postinst @@ -0,0 +1,43 @@ +#! /bin/sh + +set -e + +#DEBHELPER# + +if [ "$1" != "configure" ]; then + exit 0 +fi + +# +# Activate any unactivated USRPs that are plugged in at install time. +# This is basically a duplication of the loop in /etc/hotplug/usb.rc, +# but Md claims it's the best solution for synthesizing hotplug events +# for the USRPs plugged in at installation time. +# + +# +# Don't bother doing this unless we have all the firmware we need, and +# /sbin/hotplug working. (Rationale: If we don't have hotplug working, +# this will not work next boot/plugin anyhow, so it would be very confusing +# for the user to have it all work up _until_ the next boot/plugin.) +# +[ -r /usr/share/usrp/rev2/std_4rx_0tx.rbf ] || exit 0 +[ -x /sbin/hotplug ] || [ -x /sbin/udevd ] || exit 0 + +# We need sysfs to do this. +[ -d /sys/bus/usb/devices/ ] || exit 0 + +# Go through all USB devices and find unconfigured USRPs (ie. FX2 chips). +for device in /sys/bus/usb/devices/[0-9]*:*; do + devlink=$(readlink -f $device) + DEVPATH=${devlink#/sys} + + [ -f $devlink/../idVendor ] || continue + PRODUCT="$(cat $devlink/../idVendor)/$(cat $devlink/../idProduct)/$(cat $devlink/../bcdDevice)" + + if [ "$PRODUCT" = "fffe/0002/0002" ] || [ "$PRODUCT" = "fffe/0002/0004" ]; then + /usr/bin/usrper load_standard_bits + fi +done + +exit 0