Example #1
0
        protected Volume(BlockDevice parent, Hal.Manager manager, Hal.Device device) : base(manager, device)
        {
            this.parent = parent ?? BlockDevice.Resolve <IBlockDevice> (manager, device.Parent);

            method_names = HalDevice.PropertyExists(method_names_property)
                ? device.GetPropertyStringList(method_names_property)
                : new string[0];
        }
Example #2
0
 private IEnumerable <T> GetAllBlockDevices <T> () where T : IBlockDevice
 {
     foreach (Hal.Device hal_device in manager.FindDeviceByCapabilityAsDevice("block"))
     {
         IBlockDevice device = BlockDevice.Resolve <T> (manager, hal_device);
         if (device != null)
         {
             yield return((T)device);
         }
     }
 }
Example #3
0
        private IDevice Resolve(Hal.Device hal_device)
        {
            if (!hal_device.QueryCapability("block") && !hal_device.QueryCapability("portable_audio_player"))
            {
                return(null);
            }

            IDevice device = BlockDevice.Resolve <IBlockDevice> (manager, hal_device);

            if (device == null)
            {
                device = Volume.Resolve(null, manager, hal_device);
                if (device == null)
                {
                    device = new Device(manager, hal_device);
                }
            }

            return(device);
        }