When mm-detect learns of a device removal, it stops any ongoing
media synchronization of the device, notifies the car's HMI of the device's removal, and
unloads the device's database. These actions ensure that media applications can promptly
inform users of a device's removal and that system resources are quickly freed up for other
tasks.
The mm-detect process
performs the following actions in response to a device removal:
- Media synchronization stopping
When the user removes (detaches) a
device, the appropriate device publisher deletes the corresponding PPS object from
the device listings directory. The content of this PPS object is immediately deleted
from the PPS devices information object (the .all object),
which is constantly monitored by mm-detect. The
mm-detect call to open() then returns a
string consisting of a minus sign (-), which indicates an object removal, followed
by the device name.
This last field is used by mm-detect
to retrieve the device's information, which includes a synchronization completion
flag. If this flag is unset, mm-detect sends a terminate signal
to the active synchronization thread.
- Mountpoint link removal
The mm-detect process
deletes the symbolic link whose target is the newly removed device's mountpoint. The
full path of this symbolic link is:
/apps/mediasources/db<UID>, where
<UID> is the device's unique ID. Deleting this link
removes the device's filesystem from the view of client applications, which can no
longer access the device.
- Synchronization status updating
To notify the car's HMI applications of
the device's removal, mm-detect writes a string of the form
-db<UID> to the PPS synchronization status object. Any
application monitoring this object for updates will quickly learn of the device's
removal and can update its HMI display to inform users.
- Database unloading
The mm-detect process deletes
the device's database configuration object from the PPS database configuration
directory (/pps/qnx/mount/config/). When the QDB database
server notices the deletion of this PPS object, the server unloads the database with
the same name as the object. This design supports better system performance because
databases are removed from memory as soon as their
corresponding devices are detached.