X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=debian%2Fusrp.hotplug;fp=debian%2Fusrp.hotplug;h=e8b94320446236b960ad297df60ea40d496766ca;hb=56c8ec23cd587a012933d18ae65afa7636864314;hp=0000000000000000000000000000000000000000;hpb=18a684bf3dc144c48fc4cc6cc72f5070febd8074;p=debian%2Fgnuradio diff --git a/debian/usrp.hotplug b/debian/usrp.hotplug new file mode 100644 index 00000000..e8b94320 --- /dev/null +++ b/debian/usrp.hotplug @@ -0,0 +1,47 @@ +#! /bin/sh + +GROUP=usrp + +# Set the permissions for the USRP devices right. +set_permissions() { + if [ -f "$1" ] + then + if getent group $GROUP > /dev/null; then + chmod 660 "$DEVICE" + chown root.$GROUP "$1" + fi + fi +} + +# +# If we do not have /sbin/hotplug, we are being called by post-sarge udev +# emulating hotplug. In that case, all of this is handled by our udev rules, +# so we don't need to duplicate the work done here. +# +if ! [ -x /sbin/hotplug ]; then + exit +fi + +if [ "$ACTION" != "add" ]; then + exit +fi + +# FIXME: Map the USB device ID to usrper's idea of "which USRP". +# For now, we just assume the user only has a single one. + +case $PRODUCT in + # USRP without loaded firmware + fffe/2/2 | fffe/2/4) + sleep 1 # required on some machines + /usr/bin/usrper load_standard_bits + set_permissions "$DEVICE" + ;; + + # USRP with loaded firmware + fffe/2/102 | fffe/2/104) + set_permissions "$DEVICE" + ;; +esac + + +