[OpenWrt-Devel] block info and DISK_MEDIA_CHANGE events

Karl Palsson karlp at tweak.net.au
Fri Feb 19 12:00:55 EST 2016


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I'm trying to get "block mount" to behave well when a microSD
card is removed/inserted from a fixed USB card reader. I've
compiled the uevent-hotplug debugger example from
https://www.kernel.org/doc/pending/hotplug.txt and running that
on my device, I can see that "block info" is somehow triggering
the uevent change notifications I hope. (I can't see anywhere in
the fstools how the uevent is triggered, but it only happens if I
run "block info" manually, "blkid" doesn't trigger any events, so
it's something in block info

Example event (unfortuntely it's identical for card inserted ->
removed and for removed -> inserted)
```
change@/devices/platform/ehci-platform/usb1/1-1/1-1.1/1-1.1:1.0/host0/target0:0:0/0:0:0:0/block/sda
ACTION=change
DEVPATH=/devices/platform/ehci-platform/usb1/1-1/1-1.1/1-1.1:1.0/host0/target0:0:0/0:0:0:0/block/sda
SUBSYSTEM=block DISK_MEDIA_CHANGE=1 MAJOR=8 MINOR=0 DEVNAME=sda
DEVTYPE=disk SEQNUM=637
```

The block hotplug handler sees this notification, but,
unfortunately, it's only looking for add/remove:
http://git.openwrt.org/?p=project/fstools.git;a=blob;f=block.c;h=c6d1b9049145a453205372b93016572b4c332d4a;hb=HEAD#l823

I know of some other platforms that simply script their way out
of this, see:
https://github.com/WRTnode/openwrt-packages/blob/master/linino/uSDaemon/files/etc/init.d/usd
and the uSDaemon:
https://github.com/WRTnode/openwrt-packages/blob/master/linino/uSDaemon/files/sbin/uSDaemon

However, it seems reasonable (to me at least) that "block mount"
should handle these sorts of devices nicely as well as it does
for removable USB sticks. Would it be appropriate to add the
"change" handling, looking _only_ for the DISK_MEDIA_CHANGE
event, and handle mount/umount as appropriate?

Or should something else be converting these into add/remove
events?

Sincerely,
Karl Palsson

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQIcBAEBAgAGBQJWx0pHAAoJEBmotQ/U1cr2ueoP/2MKiEqsnhBzeDmSDhb1NC9r
E4DHBPQcGAsyFGBAGaZX+dx9kjN/Th5DDRsgAVB4xCjh+ihaUYYmchAVBSayvXs7
Q0RnOIDcokN+d+9X0Bu7Q/NdvwuVk8J/USqH1oA65s0yGRVotVIYdk19oBQutkwB
qD2A5cwAWj9dIBOQsKaB6gNcSVgPA98KZWZJT0wzzzda0Px3yiTrymTHMd4qTbuI
lch/tU+UBsFhAtVbXeHDdhw04wHNY+WvEAvlg/MUiBqKijIhZlmubZY62StQ89+X
S3dgLfRy+sRw0cRmGux/v1qmnGgqxP4S8M/b+opiYv3GuoSdl7qsOy+etxaYkAUe
ZX+t+lxmUn6sQZfiabtaxLXzU2VjhdW1hfHc3ukkmv97AXaLWcCHIRIRMBxwTFIg
SSPXJsJeXcQYZ8GX5rwqnlNvQMA7x1jjmjS1A325DeIkIZVIVJHMWMTFRk8jLHVr
E7LySbeaBAu2OqEG6kfm5mQQDJt8baLxAUhQwjbo/Pnldunh/SCAJrhWDi75siDA
qjVA3dN2ZdxrSPh4EUZItugvHBRFgIr/Dih3AszVjBAZk3AqA9GQs/kl+irXVj0v
vRiM4dVAod2jJcXuRv0m4A6gpYVjm75bSCCagCcBJFIYritwI98H7X5w8hMnOzWR
sxY8/edvFByVLxsT2pAJ
=qTbH
-----END PGP SIGNATURE-----
-------------- next part --------------
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list