I have a linux media player that was very common before android's age. It is a MIPS running Linux Venus 22.214.171.124 and has 2 sata, 2 usb and 1 sdcard port. Since the flash memory is very limited, I installed
nano on sdcard and put in
ln -s /tmp/usbmounts/sdb1/opt /opt
The sdcard can remain plugged for good since I won't use sdcard for media. It works very well if I do not have other usb plugged or if I plug other usb after boot. But if I plug other usb before boot, the sdcard port always be mounted to
sdd and of course the link won't work. I (kind of) resolved this by putting a script at boot to locate
/opt and link accordingly. However, I found that there is other activity that can change the mount point after boot.
The player mainly runs a software called
Dvdplayer. This software has a menu on screen for user to choose media to play. Every time when this menu is called up, the mount point seems to change, EVEN WITHOUT any additional usb plug in. Say if after boot, my sdcard is mounted to
sdb, after calling up the menu, it changed to
sdb has nothing). Calling up the menu again, it becomes
sdc has nothing). Call the menu the 3rd time, it goes back to
sdc and then to and fore between
Searching the internet, I understand this is hotplugging and I am able to locate the software. But different from the usual linux hotplug, the softare is an executable elf file instead of a script, and I cannot find any system variables related the hotplug, such as
DEVICE etc. Instead, it has a sequence number in
/sys/kernel/hotplug_seqnum. It has empty folders like
mount_tmp is the only folder that has its date changed, but still is always empty.
I've tried to trap the hotplug by moving the
/sbin/sbin/hotplug and put in my own hotplug script in
/sbin/hotplug. The script looks like this
mount / -o remount,rw echo $* >> /usr/local/etc/init.d/hotplug.log /sbin/sbin/hotplug $*
But it doesn't work: after calling the menu, nothing was logged and all plug-in mounts were lost.
All I wanted to do now is to trap the hotplug activities and relink my /opt correctly. Appreciate any help or a better method of ensuring the correct link for /opt.