Skip to content

Commit

Permalink
Do not keep trying to mount when it fails
Browse files Browse the repository at this point in the history
Refs #10221

If a USB stick (or other removable drive) is attached to the frontend, and the
user running the frontend is not able to mount it with "mount /dev/sdc1" or the
like, we do not want to keep trying (twice a second!) to mount it.  There's
no purpose to that other than extra load, and filling log files with useless
crap.
  • Loading branch information
Beirdo committed Jan 2, 2012
1 parent 4ce95f8 commit 1193d24
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions mythtv/libs/libmythbase/mythhdd.cpp
Expand Up @@ -33,15 +33,19 @@ MythHDD::MythHDD(QObject *par, const char *DevicePath,
*/
MythMediaStatus MythHDD::checkMedia(void)
{
if (m_Status == MEDIASTAT_ERROR)
return m_Status;

if (isMounted())
{
// A lazy way to present volume name for the user to eject.
// Hotplug devices are usually something like /media/VOLUME
m_VolumeID = m_MountPath;

// device is mounted, trigger event
if (MEDIASTAT_MOUNTED != m_Status)
if (m_Status != MEDIASTAT_MOUNTED)
m_Status = MEDIASTAT_NOTMOUNTED;

return setStatus(MEDIASTAT_MOUNTED);
}

Expand All @@ -51,15 +55,16 @@ MythMediaStatus MythHDD::checkMedia(void)
case MEDIASTAT_NOTMOUNTED:
// a removable device was just plugged in try to mount it.
LOG(VB_MEDIA, LOG_INFO, "MythHDD::checkMedia try mounting " + m_DevicePath);

if (mount())
{
m_Status = MEDIASTAT_NOTMOUNTED;
return setStatus(MEDIASTAT_MOUNTED);
}
return m_Status;

return setStatus(MEDIASTAT_ERROR);

case MEDIASTAT_MOUNTED:
// device was mounted and someone unmounted it.
return m_Status = setStatus(MEDIASTAT_NOTMOUNTED);
return setStatus(MEDIASTAT_NOTMOUNTED);

default:
// leave device state as is
return m_Status;
Expand Down

0 comments on commit 1193d24

Please sign in to comment.