Ticket #10029: 0022-Fix-mythhdd-to-permit-eject-of-USB-key-disks.patch

File 0022-Fix-mythhdd-to-permit-eject-of-USB-key-disks.patch, 2.5 KB (added by Lawrence Rust <lvr@…>, 9 years ago)
  • mythtv/libs/libmythbase/mythhdd.cpp

    From 17da0228729b389dba790f95024d87c56b9d1732 Mon Sep 17 00:00:00 2001
    From: Lawrence Rust <lvr@softsystem.co.uk>
    Date: Sun, 17 Apr 2011 12:27:27 +0200
    Subject: [PATCH 2/2] Fix mythhdd to permit eject of USB key disks
    
    ---
     mythtv/libs/libmythbase/mythhdd.cpp |   23 +++++++++++++----------
     mythtv/libs/libmythbase/mythhdd.h   |    1 +
     2 files changed, 14 insertions(+), 10 deletions(-)
    
    diff --git a/mythtv/libs/libmythbase/mythhdd.cpp b/mythtv/libs/libmythbase/mythhdd.cpp
    index a645ee8..285ab49 100644
    a b MythHDD::MythHDD(QObject *par, const char *DevicePath, 
    2424    : MythMediaDevice(par, DevicePath, SuperMount, AllowEject)
    2525{
    2626    LOG(VB_MEDIA, LOG_INFO, "MythHDD::MythHDD " + m_DevicePath);
    27     m_Status = MEDIASTAT_UNPLUGGED;
     27    m_Status = MEDIASTAT_NOTMOUNTED;
    2828    m_MediaType = MEDIATYPE_DATA;       // default type is data
    2929}
    3030
    MythMediaStatus MythHDD::checkMedia(void) 
    4646    }
    4747
    4848    // device is not mounted
    49     if (m_Status == MEDIASTAT_UNPLUGGED)
     49    switch (m_Status)
    5050    {
     51    case MEDIASTAT_NOTMOUNTED:
    5152        // a removable device was just plugged in try to mount it.
    5253        LOG(VB_MEDIA, LOG_INFO, "MythHDD::checkMedia try mounting " + m_DevicePath);
    5354        if (mount())
    MythMediaStatus MythHDD::checkMedia(void) 
    5556            m_Status = MEDIASTAT_NOTMOUNTED;
    5657            return setStatus(MEDIASTAT_MOUNTED);
    5758        }
    58         else
    59             return setStatus(MEDIASTAT_NOTMOUNTED);
    60     }
    61     else if (m_Status == MEDIASTAT_MOUNTED)
    62     {
     59        return m_Status;
     60    case MEDIASTAT_MOUNTED:
    6361        // device was mounted and someone unmounted it.
    6462        return m_Status = setStatus(MEDIASTAT_NOTMOUNTED);
    65     }
    66     else
    67     {
     63    default:
    6864        // leave device state as is
    6965        return m_Status;
    7066    }
    7167}
     68
     69//virtual
     70MythMediaError MythHDD::eject(bool)
     71{
     72    setStatus(MEDIASTAT_UNPLUGGED);
     73    return MEDIAERR_UNSUPPORTED;
     74}
  • mythtv/libs/libmythbase/mythhdd.h

    diff --git a/mythtv/libs/libmythbase/mythhdd.h b/mythtv/libs/libmythbase/mythhdd.h
    index 709dc40..7af47e8 100644
    a b class MBASE_PUBLIC MythHDD : public MythMediaDevice 
    1010            bool SuperMount, bool AllowEject);
    1111
    1212    virtual MythMediaStatus checkMedia(void);
     13    virtual MythMediaError eject(bool);
    1314
    1415    static MythHDD* Get(QObject* par, const char* devicePath,
    1516                        bool SuperMount, bool AllowEject);