Skip to content

Commit 12c944c

Browse files
Lawrence RustBeirdo
authored andcommitted
Fix mythhdd to permit eject of USB key disks
Closes #10029 Signed-off-by: Gavin Hurlbut <ghurlbut@mythtv.org>
1 parent 027352d commit 12c944c

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

mythtv/libs/libmythbase/mythhdd.cpp

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ 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

@@ -46,26 +46,29 @@ 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())
5455
{
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
70+
MythMediaError MythHDD::eject(bool)
71+
{
72+
setStatus(MEDIASTAT_UNPLUGGED);
73+
return MEDIAERR_UNSUPPORTED;
74+
}

mythtv/libs/libmythbase/mythhdd.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ 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);

0 commit comments

Comments
 (0)