← Back to team overview

touch-packages team mailing list archive

Re: [Bug 1354543] mediascanner fails to watch removable devices if/media/$USER doesn't exist when starting

 

On lunes 11 de agosto de 2014 08h'58:22 ART, Jussi Pakkanen wrote:
> The way Mediascanner currently gets to know about mounted drives is a
> bit hacky as it listens to inotify events in that directory. Is there a
> more reliable way of getting mount/unmount events from the system? Maybe
> over dbus?

I wrote ciborium which interfaces with udisks2, I can create a specific 
signal to track or you could watch udisks2 (which is kind of involved IMO, 
but already there):

Here's filesystem-mount:

signal sender=:1.58 -> dest=(null destination) serial=30 
path=/org/freedesktop/UDisks2; 
interface=org.freedesktop.DBus.ObjectManager; member=InterfacesAdded
   object path "/org/freedesktop/UDisks2/jobs/2"
   array [
      dict entry(
         string "org.freedesktop.UDisks2.Job"
         array [
            dict entry(
               string "Operation"
               variant                   string "filesystem-mount"
            )
            dict entry(
               string "Progress"
               variant                   double 0
            )
            dict entry(
               string "ProgressValid"
               variant                   boolean false
            )
            dict entry(
               string "Bytes"
               variant                   uint64 0
            )
            dict entry(
               string "Rate"
               variant                   uint64 0
            )
            dict entry(
               string "StartTime"
               variant                   uint64 1407760864560033
            )
            dict entry(
               string "ExpectedEndTime"
               variant                   uint64 0
            )
            dict entry(
               string "Objects"
               variant                   array [
                     object path 
"/org/freedesktop/UDisks2/block_devices/mmcblk1p1"
                  ]
            )
            dict entry(
               string "StartedByUID"
               variant                   uint32 32011
            )
            dict entry(
               string "Cancelable"
               variant                   boolean true
            )
         ]
      )
   ]
signal sender=:1.58 -> dest=(null destination) serial=31 
path=/org/freedesktop/UDisks2/jobs/2; 
interface=org.freedesktop.UDisks2.Job; member=Completed
   boolean true
   string ""
signal sender=:1.58 -> dest=(null destination) serial=32 
path=/org/freedesktop/UDisks2; 
interface=org.freedesktop.DBus.ObjectManager; member=InterfacesRemoved
   object path "/org/freedesktop/UDisks2/jobs/2"
   array [
      string "org.freedesktop.UDisks2.Job"
   ]
signal sender=:1.58 -> dest=(null destination) serial=34 
path=/org/freedesktop/UDisks2/block_devices/mmcblk1p1; 
interface=org.freedesktop.DBus.Properties; member=PropertiesChanged
   string "org.freedesktop.UDisks2.Filesystem"
   array [
      dict entry(
         string "MountPoints"
         variant             array [
               array of bytes [
                  2f 6d 65 64 69 61 2f 70 68 61 62 6c 65 74 2f 4b 69 6e 67 
73
                  74 6f 6e 00
               ]
            ]
      )
   ]
   array [
   ]

unmounting is a bit more involved too.

I can create two new signals specifc to mountpaths showing up or going away 
 (triggered when ciborium does the mount or notices the device is removed 
or unmounted), like
MountpointAdded(ObjectPath, MountpointPath)
MountpointRemoved(ObjectPath, MountpointPath)

if it makes life easier; the names are illustrative; just tell me what you 
prefer.

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to mediascanner2 in Ubuntu.
https://bugs.launchpad.net/bugs/1354543

Title:
  mediascanner fails to watch removable devices if /media/$USER doesn't
  exist when starting

Status in “mediascanner2” package in Ubuntu:
  Confirmed

Bug description:
  If the system has never mounted a removable device then /media/$USER
  does not exist which causes mediascanner to fail it's watch with this
  error:

  Mount directory does not exist

  if something is mounted after this, then it just doesn't notice it.

  starting mediascanner after /media/$USER is created allows everything
  to work.

  ProblemType: Bug
  DistroRelease: Ubuntu 14.10
  Package: mediascanner2.0 0.102+14.10.20140805-0ubuntu1
  Uname: Linux 3.4.67 armv7l
  ApportVersion: 2.14.5-0ubuntu3
  Architecture: armhf
  Date: Fri Aug  8 14:39:22 2014
  InstallationDate: Installed on 2014-08-08 (0 days ago)
  InstallationMedia: Ubuntu Utopic Unicorn (development branch) - armhf (20140808-020205)
  SourcePackage: mediascanner2
  UpgradeStatus: No upgrade log present (probably fresh install)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mediascanner2/+bug/1354543/+subscriptions


References