disparador do udevadm
1. experimenta
sudo udevadm trigger --verbose --action=remove --property-match='DEVNAME=/dev/sdd'
acionará /dev/sdd
remove uevent, conteúdo como
remove@/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0/host13/target13:0:0/13:0:0:0/block/sdd
ACTION=remove
DEVPATH=/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0/host13/target13:0:0/13:0:0:0/block/sdd
SUBSYSTEM=block
MAJOR=8
MINOR=48
DEVNAME=sdd
DEVTYPE=disk
SEQNUM=12589
2. strace
it
veja o que ele dose:
sudo strace udevadm trigger --verbose --action=remove --property-match='DEVNAME=/dev/sdd'
...
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 37), ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc0596a7000
write(1, "/sys/devices/pci0000:00/0000:00:"..., 101/sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0/host13/target13:0:0/13:0:0:0/block/sdd
) = 101
open("/sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0/host13/target13:0:0/13:0:0:0/block/sdd/uevent", O_WRONLY) = 3
write(3, "remove", 6) = 6
close(3) = 0
exit_group(0) = ?
+++ exited with 0 +++
3. resumir
na verdade, só faz
echo 'remove' | sudo tee /sys/block/sdd/uevent
dessa forma ainda depende do sysfs:
-
O
- dispositivo sysfs deve existir
- não é totalmente personalizado uevent message body
o arquivo sysfs uevent:
cat /sys/block/sdd/uevent
MAJOR=8
MINOR=48
DEVNAME=sdd
DEVTYPE=disk