In order to be able to check if /dev/sda exists I need to have permission to read /dev/sda file.
In order to do so I have to define the in .adef file of my application. When the application is started if /dev/sda isn’t present application won’t be able to start.
Thank you for the hints, I would know how to do this with regular linux distribution and udev/init.d combination. However, we want to use SierraWireless provided SPK file without modifications of kernel and rootfs and have only access to legato framework. Can you help?
I have no idea on udev. But I saw the link below saying we can use mdev instead. You can have a try.
BTW, if you only want to use legato application, you need to first write a shell script to periodically checking if the new USB storage has been inserted (/dev/sda).
Also this script will mount the USB drive and write the logread to USB drive in case /dev/sda is found.
This line instructs mdev mechanism to save detected disk device name to temp file (e.g. sda1) and to start unsandboxed legato application Log2USB when USB disk is inserted. Log2USB application executes shell script which mounts, copies logs and unmounts disk.
Only drawback for this solution is that /etc/mdev.conf file must be edited which is sometimes not handy (e.g. spk update in the field).