uevent for device state changes

6.18 z/VM guest

The z/VM® unit record device driver generates a uevent when the state of an online z/VM unit record device changes from not-ready to ready.

With a suitable udev rule, you can use the uevent for automatic responses to such state changes.

Example uevent

KERNEL[4389.257683] change /devices/css0/0.0.000b/0.0.000c (ccw)
ACTION=change
DEVPATH=/devices/css0/0.0.000b/0.0.000c
SUBSYSTEM=ccw
EVENT=unsol_de
DRIVER=vmur
CU_TYPE=2540
CU_MODEL=00
DEV_TYPE=0000
DEV_MODEL=00
MODALIAS=ccw:t2540m00dtdm
SEQNUM=1386

Sample udev rule

The following sample udev rule runs a script, /usr/local/bin/ur_event_handler, each time the uevent occurs.
ENV{DRIVER}=="vmur", ACTION=="change", ENV{EVENT}=="unsol_de", RUN{program}="/usr/local/bin/ur_event_handler"

Because the uevent is triggered each time a file arrives in the reader device, the script could receive each file as it arrives.

You can test your udev rule by triggering a uevent, for example, by sending a test file to the reader or with the z/VM CP READY command for the reader device.
# vmcp ready 000c