Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#601 closed enhancement (fixed)

Support hotpluggable disc drives in MediaMonitor

Reported by: Aaron McCarthy <mccarthy.aaron@…> Owned by: danielk
Priority: minor Milestone: 0.20
Component: mythtv Version: head
Severity: medium Keywords:
Cc: Ticket locked: no


This patch implements support for hotplugging removable disc drives in MediaMonitor?. A new MythMediaDevice? subclass implements a generic hard disc device. In addition it supports mounting and unmounting via pmount if it is available. If you use pmount you don't need to explicitly define mount points in /etc/fstab. Make sure the user running mythfrontend is a member of the plugdev or equivalent group.

To get hotplug message you will need to (or whatever your distribution does, this is for Debian)

install contrib/mythtv.rules into /etc/udev/ create a link in /etc/udev/rules.d to the newly install /etc/udev/mythtv.rules install contrib/ into /etc/udev/scripts/

This requires udev version 0.71.

There is also a new global keybinding called 'EJECT' that will eject devices. If you have only one device (known to the MediaMonitor?) it will be unmounted and ejected. If you have more than one a dialog box will popup so you can select the device to eject. You can use this to safely remove USB sticks etc.

This code is related to my code to get MythGallery to access my digital camera, I will submit that patch soon.

Attachments (3)

hotplug_hdd.diff (30.0 KB) - added by Aaron McCarthy <mccarthy.aaron@…> 15 years ago.
hotplug_hdd_v2.diff (27.3 KB) - added by Aaron McCarthy <mccarthy.aaron@…> 15 years ago.
hotplug_hdd_v3.diff (31.3 KB) - added by Aaron McCarthy <mccarthy.aaron@…> 15 years ago.
Same as v2 except with the new files included

Download all attachments as: .zip

Change History (8)

Changed 15 years ago by Aaron McCarthy <mccarthy.aaron@…>

Attachment: hotplug_hdd.diff added

comment:1 Changed 15 years ago by danielk

Milestone: 0.20
Owner: changed from Isaac Richards to danielk
Status: newassigned

comment:2 Changed 15 years ago by danielk

Not quite ready for prime time:

  • This appears to break the functionality where inserting a DVD either brings up the DVD menu or starts playing the DVD.
  • When you insert a DVD or a USB drive more than once it shows up in the eject menu more than once, and does not go away when you eject the device.
  • Devices appear in the eject menu even if they fail to mount; this maybe makes sense for a DVD, but not for a USB drive.

I haven't looked closely at the code yet so there may be more problems; but this is what I noticed when testing functionality. The core functionality of noticing and mounting hotplug drives works for me at least.

Changed 15 years ago by Aaron McCarthy <mccarthy.aaron@…>

Attachment: hotplug_hdd_v2.diff added

comment:3 Changed 15 years ago by Aaron McCarthy <mccarthy.aaron@…>

I've just attached version 2 of this patch which has the following changes

I've fixed up the functionality such that the DVD menu gets displayed or the DVD starts playing when one is inserted. During testing I noticed that playing the DVD from the DVD menu fails. Playing directly or selecting play DVD from the CD/DVD menu works. I got the same behaviour when I did a clean recompile without any of my patches applied.

Ejectable drives (ie CD/DVD drives) are always in the eject menu so you can eject the tray when no disc is present. Non ejectable drives are only in the eject menu when they are mounted. I'm not quite sure what you mean by inserting a device more than once, but I've tested ripping out the USB stick without unmounting and the stale devices are removed the eject menu.

I've made MythMediaDevice? forget labels etc when the device enters the MEDIASTAT_OPEN state. This prevents the label of the previous disc being shown when no disc is present.

I've also prevented nested instances of the eject dialog.

Changed 15 years ago by Aaron McCarthy <mccarthy.aaron@…>

Attachment: hotplug_hdd_v3.diff added

Same as v2 except with the new files included

comment:4 Changed 15 years ago by danielk

Resolution: fixed
Status: assignedclosed

(In [9365]) Closes #601, by applying patch from Aaron McCarthy?.

This adds some better media monitoring for Linux users. In order to get the full benefit you need udev 0.71+ and you need pmount, and you need to install the two udev files in contrib.

There is a new binding "EJECT" which will unmount and, if possible, physically eject removable media. I did not add a default binding, but "E" makes sense..

comment:5 Changed 15 years ago by danielk

(In [9409]) Closes #1525, refs #601, by applying patch from #1525.

This ads a sanity check to the monitor to avoid problems on reboot after a frontend crash.

Note: See TracTickets for help on using tickets.