#82357a without firmware
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0957", ATTR{idProduct}=="0007", ENV{DEVICE}="$devnode", RUN+="@UDEV_LIBDIR@/gpib_udev_fxloader"
#82357b without firmware
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0957", ATTR{idProduct}=="0518", ENV{DEVICE}="$devnode", RUN+="@UDEV_LIBDIR@/gpib_udev_fxloader"

#automatically set the correct --board-type option and export SERIAL number for gpib_udev_config
ACTION=="add|change", SUBSYSTEM=="usb", DRIVER=="agilent_82357a", ATTRS{serial}=="*", ENV{GPIB_CONFIG_OPTIONS}+="--board-type agilent_82357a", ENV{SERIAL}="$attr{serial}"

#82357a/b with firmware
ACTION=="add|change", SUBSYSTEM=="usb", DRIVER=="agilent_82357a", RUN+="@UDEV_LIBDIR@/gpib_udev_config"

#this rule generates new "change" udev events for devices supported by the 
#driver after the module is loaded.
#it is needed because if the driver is not already loaded when the hardware is plugged in,
#then the initial hardware "add" event will not be able to accomplish anything.
SUBSYSTEM=="module", ACTION=="add", DEVPATH=="/module/agilent_82357a", RUN+="@UDEV_LIBDIR@/gpib_udevadm_wrapper trigger --property-match DRIVER=agilent_82357a"
